首页
编程语言
数据库
网络开发
Algorithm算法
移动开发
系统相关
金融统计
人工智能
其他
首页
>
> 详细
data编程辅导 、讲解 c/c++,Java语言程序
Operating Systems and Systems
Programming
Semester 1, 2024
Eike Ritter, David Oswald
The University of Birmingham
30 September, 2024
Exercise 1
Deadline: 14 November, 4pm
The Task
Write a set of programs which maintains the firewall configuation.
1. One program is a server program. Once started, the server should run for ever. It waits for requests, process them and produce a specific response.
The server maintains a collection of firewall rules. For each rule in the
collection of rules, the server also maintains a list of pairs of IP addresses
and ports which have been queried and found to match this rule. The
server also maintains a list of all requests submitted to it. The server
program should accept and process requests and return a response as
follows:
❼ Listing all requests in the order they were given. The command for
this request is R
❼ Adding a rule to the stored rules. This request expects a string which
contains a firewall rule as specified below. If the rule is valid, the
rule is added the set of firewall rules. The response is Rule added
if the rule has been added, and Invalid rule if the string is not a
valid rule. The command for this request is
A
❼ Checking whether a given IP address and port are allowed according
to the rules. If this is the case, the IP address and port are added
to list of matched queries for this rule. If the given address and port
are allowed according to several rules, you should add the IP address
and port to only one rule. If the given IP address and port is checked
again, they may be added to a different rule. If the input does not
provide a valid IP address and a valid port, the response should be
Illegal IP address or port specified. If the IP address and
port are valid and should be accepted according to the rules, the
response should be Connection accepted. If the IP address and
port are valid and should be rejected according to the rules, the
response should be Connection rejected. The command for this
request is
C
1
❼ Delete a valid rule from the stored rules. This should also delete the
list of IP addresses and ports stored for this rule. The rule should
only be deleted if the server stores exactly the same rule. In all
other cases, no action should be taken except returning a suitable
message. If the specification of the rule is invalid, the response should
be Rule invalid. If the rule is successfully deleted, the response
should be Rule deleted. If the rule is valid but not found on the
server, the response should be Rule not found. The command for
this request is
D
❼ Return all rules and for each rule list all IP addresses and ports
which are stored with it. More precisely, for each rule, the response
should be
Rule:
where
is the specification of the rule as given below, followed
by
Query:
for each query stored with this firewall rule. The command for this
request is L
❼ For any other request, the response should be Illegal request.
There are two ways of interacting with the server program.
❼ The first one is to start the server with
-i
where
is the way to call the server program, typ ically ./server. In this mode the server reads an command from
standard input, prints the response and waits for the next input.
❼ The second way of running the server is
where
is the way to call the server program, typ ically ./server, and
is the port on which the server listens
for incoming connections. A client program, which you will have to
write as well, makes it possible to send commands to the server pro gram and display the results on standard output. The client should
be called with
without any quotes, e.g.
./client localhost 2200 A 147.188.193.15 22
All other ways of calling the client program should return an error
message.
2
The specification of a firewall rule is below.
A rule is of the form
where
is either a single IP address, which has the form xxx.xxx.xxx.xxx,
where xxx is a number between 0 and 255, or
-
,
where
and
are IP addresses, and
is
smaller than
. Assume that IP addresses and ports are separated
by exactly one space character.
Similarly,
is either a single port number, which is a number between
0 and 65535, or
-
, where
and
are ports and
is smaller than
.
Examples of such rules would be
147.188.193.0-147.188.194.255 21-22
147.188.192.41 443
Your server program should maximise the degree of concurrency and not contain
any memory leaks.
Submission and Marking
❼ You should submit the file server.c and client.c on the appropriate
canvas-quiz. The marking scripts will execute the command make with
the Makefile provided in the archive on canvas to produce all required
binaries.
❼ The zip-archive on canvas contains a Makefile and a basic test script is
provided in the file test.sh. The Makefile and the test script will only
work if server.c and client.c are in the same directory as the Makefile
and the test script respectively. The test script tests the cases of adding
a rule both interactively and via sockets. It is run by changing into the
directory containing the binaries and then running
./test.sh
We will use more advanced scripts for marking which test all the specified
functionality, including concurrency and memory leaks. If the basic test
script does not work, all other scripts are likely to fail as well.
❼ Code which does not compile on the virtual machine provided will be
awarded 0 marks.
Hints
❼ You should start by implementing the interactive version of the server
(the version running with server -i) and the R-command. Sockets and
concurrency will be explained in later lectures.
3
❼ You may use the code provided in the lectures in your assignments as you
see fit.
4
联系我们
QQ:99515681
邮箱:99515681@qq.com
工作时间:8:00-21:00
微信:codinghelp
热点文章
更多
讲解 cs 300: programming ii ...
2024-11-21
辅导 ematm0061: statistical ...
2024-11-21
辅导 mgrc20007 machine learn...
2024-11-21
讲解 individual project讲解 ...
2024-11-21
讲解 lw6108e international f...
2024-11-21
讲解 mu1112 creative composi...
2024-11-21
讲解 ece 2560 intro to micro...
2024-11-21
讲解 fv3001 assignment brief...
2024-11-21
讲解 assignment 2讲解 prolog
2024-11-21
讲解 ceg8419: individual rep...
2024-11-21
辅导 ematm0061: statistical ...
2024-11-21
讲解 bios5001 / pubh6001 int...
2024-11-21
讲解 cs211: fall 2024 progra...
2024-11-21
辅导 scwk90055 the legal and...
2024-11-21
辅导 econ 2560, fall 2024, p...
2024-11-21
辅导 ceg 8019: individual re...
2024-11-21
讲解 cs 4321/5321 project 2讲...
2024-11-21
辅导 fint b337f (autumn 2024...
2024-11-21
辅导 introduction to finance...
2024-11-21
讲解 data mining: projects l...
2024-11-21
热点标签
mktg2509
csci 2600
38170
lng302
csse3010
phas3226
77938
arch1162
engn4536/engn6536
acx5903
comp151101
phl245
cse12
comp9312
stat3016/6016
phas0038
comp2140
6qqmb312
xjco3011
rest0005
ematm0051
5qqmn219
lubs5062m
eee8155
cege0100
eap033
artd1109
mat246
etc3430
ecmm462
mis102
inft6800
ddes9903
comp6521
comp9517
comp3331/9331
comp4337
comp6008
comp9414
bu.231.790.81
man00150m
csb352h
math1041
eengm4100
isys1002
08
6057cem
mktg3504
mthm036
mtrx1701
mth3241
eeee3086
cmp-7038b
cmp-7000a
ints4010
econ2151
infs5710
fins5516
fin3309
fins5510
gsoe9340
math2007
math2036
soee5010
mark3088
infs3605
elec9714
comp2271
ma214
comp2211
infs3604
600426
sit254
acct3091
bbt405
msin0116
com107/com113
mark5826
sit120
comp9021
eco2101
eeen40700
cs253
ece3114
ecmm447
chns3000
math377
itd102
comp9444
comp(2041|9044)
econ0060
econ7230
mgt001371
ecs-323
cs6250
mgdi60012
mdia2012
comm221001
comm5000
ma1008
engl642
econ241
com333
math367
mis201
nbs-7041x
meek16104
econ2003
comm1190
mbas902
comp-1027
dpst1091
comp7315
eppd1033
m06
ee3025
msci231
bb113/bbs1063
fc709
comp3425
comp9417
econ42915
cb9101
math1102e
chme0017
fc307
mkt60104
5522usst
litr1-uc6201.200
ee1102
cosc2803
math39512
omp9727
int2067/int5051
bsb151
mgt253
fc021
babs2202
mis2002s
phya21
18-213
cege0012
mdia1002
math38032
mech5125
07
cisc102
mgx3110
cs240
11175
fin3020s
eco3420
ictten622
comp9727
cpt111
de114102d
mgm320h5s
bafi1019
math21112
efim20036
mn-3503
fins5568
110.807
bcpm000028
info6030
bma0092
bcpm0054
math20212
ce335
cs365
cenv6141
ftec5580
math2010
ec3450
comm1170
ecmt1010
csci-ua.0480-003
econ12-200
ib3960
ectb60h3f
cs247—assignment
tk3163
ics3u
ib3j80
comp20008
comp9334
eppd1063
acct2343
cct109
isys1055/3412
math350-real
math2014
eec180
stat141b
econ2101
msinm014/msing014/msing014b
fit2004
comp643
bu1002
cm2030
联系我们
- QQ: 99515681 微信:codinghelp
© 2024
www.7daixie.com
站长地图
程序辅导网!