编程代考 ICT374 Assignment 2

ICT374 Assignment 2

ICT374 Assignment 2

Copyright By PowCoder代写 加微信 powcoder

Introduction
Deadline and Penalty for Late Submission

Project 1: A Simple Unix Shell

Project 2: A Simple File Transfer Protocol

Project 3: A Simple HTTP Client and a Simple HTTP Server

Documentation Requirements
Policy on the Reuse of the Third Party Source Code
Grievance with Assignment Marking

Introduction
(Back to Beginning)

This is a group assignment. Each group consists of two students who are working
together to complete the assignment. You must confirm your group’s composition
no later than the end of Week 6 by email to your lecturer.

One of the purposes of this assignment is to build up team-work skills,
including communication, planning, task setting and monitoring, negotiation
and conflict resolution, as one of the broad aims of the unit is to develop
team-work skills. The mark for each student in a group is
calculated using the group mark and the student’s percentage
of contributions to the assignment. For details see Group Declaration
in ICT374 Project Declaration sheet.

Each student is required to team up with another student enrolled in this unit
to work on this assignment. Team work skill is worth 20% of the assignment.
In the rare cases where a student completes the assignment alone without
a partner, the maximum mark he or she could achieve is 80%, because the
team-work skills could not be assessed.

This assignment consists of a single project to design and implement
a significant piece of software on Unix systems using C.

There are three standard projects for you to choose from. You are only required to
complete one of the three projects.

Alternatively, you may propose your own project. However, it must have a similar
level of technical contents and be of a similar level of technical difficulty.
The project must be approved by the unit coordinator. If you intend to do your
own project you should discuss it with your unit coordinator and submit a written
proposal to him for approval. You can go ahead with your proposal only if
it is formally approved by your unit coordinator.

The normal size of assignment group is two. However, in some rare circumstances,
a group may be allowed to have more than two persons. However, this requires
the formal approval from the unit coordinator. You must submit a written proposal
of your project to your unit coordinator and the proposal must be approved by
the unit coordinator. The scope of the project, the level of difficulty, the
required technical skills and the amount of work must be justifiable for the size
of the group.

Regardless of the project you select, as a general requirement, you must not
use the function system in the implementation of your project.

The three standard projects are listed below. Detailed requirements for each project
are given in the later sections of this document.

Project 1 – A Simple Unix Shell

The project requires the use of more Unix systems facilities
and other functions than the other two projects. It also
demands good C programming skills in designing the command line
parser. Therefore, the project is considered to be more difficult to
implement than the other two and this will be taken into consideration
during assessment. A lot can be learnt about operating systems by
doing this project.

Project 2 – A Simple File Transfer Protocol

The project requires three pieces of work: a network protocol
specification, a client program that implements the client
side of the protocol, and a server program that implements
the server side of the protocol. As beginners in network
programming, most students tend to overlook the importance of correct
protocol design and specification. They often write a “protocol” after
they have written up the client and the server programs. This is akin
to building a palace without an architectural plan and then drawing up
a blue print after the palace is already erected (or more likely after
the palace is crumbled). The correct specification of the communication
protocol is required in this project, and you can expect to be marked down
significantly if your protocol specification is not complete or correct or not
corresponding to what you have implemented! Having said that, programming
wise, it is relatively straightforward to code once the network protocol
is correctly specified.

Project 3 – A Simple HTTP Client and A Simple HTTP

This project is similar to Project 2 in some aspects.
However, it requires you to learn a non-trivial, existing
network protocol, HTTP, and to thoroughly understand it,
at least in the parts that are required by this project.
Therefore, you will need to make a lot of efforts to conduct
an independent research and self-learning before you can even
start to write a single line of code. Once you understand the
protocol it is not too difficult (but can be tedious)
to write a client and a server that is logically sound but
inefficient. However, it is a challenge to design and implement
an HTTP client and an HTTP server that are both correct to
the protocol specification and also efficient!

The project will be marked out of 100 marks, of which 10% is attributed
to compliance to the Documentation Requirements.
To achieve good marks you must strictly adhere to the
Documentation Requirements.

In presenting your work, you must document the test cases and test
outputs for each feature required by the project. The test output
can be in the form of terminal output. You may copy the text from
the terminal output and paste it to your Word document
(always include the command line). You should format
the terminal output using a monospaced font so that it is
clearly distinguishable from the rest of texts in your document.
It is even better if you place the terminal output in a text box
so that it is clearly separated from other texts in your document.
But do not modify your test output unless it is too long and
repetitive – heavy penalties will be applied if test output is
modified to make your work appear better than what it really is!

Marking will be based on the number of working features demonstrated
in your documentation. If a feature works and you have provided
test evidence that the feature works in the form of test cases
and test outputs, and your explanation of the test is convincing,
you will get the marks allocated to the feature. Otherwise you
will not get marks for that feature even if you have implemented it.

Read Documentation Requirements for further
and more detailed requirements regarding the test documentation.

The project requires a significant amount of work on research, design and
implementation. It is advised that you should start the project
as soon as possible.

Deadline and Penalty for Late Submission
(Back to Beginning)

The submission deadline of this assignment is specified in
the Unit Information Page of the Unit LMS.

Assignments submitted on or before the deadline will be
marked out of 100%.

Late submission of the assignment will have 10% of the group’s raw
mark deducted per day, unless an application for extension of submission
deadline is granted. A submission that is late by more than 10 days
or after the last teaching week (Week 14) will not be accepted.

Applications for extension of your assignment deadline can only be made
via email to the unit coordinator, normally prior to
the specified due date of the assignment. If an extension is granted
(also by email), you must attach a copy of the email to your submission
(see Documentation Requirements). Applications
for extension by phone or in person do not count, even if granted.
The above policy will be rigorously enforced.

Project 1: A Simple Unix Shell
(Back to Beginning)

Design and implement a simple UNIX shell program using the grammar
specified in the later part of this section.
Please allow for at least 100 commands in a command line and at
least 1000 arguments in each command.

In addition to the above, the following are required:

Reconfigurable shell prompt (default %)

The shell must have a shell built-in command prompt
for changing the current prompt. For example, type the
following command

% prompt john$

should change the shell prompt to john$, i.e., the
second token of the command.

The shell built-in command pwd

This command prints the current directory (also known as
working directory) of the shell process.

Directory walk

This command is similar to that provided by the
Bash built-in command cd. In particular, typing
the command without a path should set the current directory
of the shell to the home directory of the user.

Wildcard characters

If a token contains wildcard characters *
or ?, the token is treated as a filename.
The wildcard characters in such a token indicate to the
shell that the filename must be expanded. For example
the command

may be expanded to ls ex1.c ex2.c ex3.c if there
are three matching files ex1.c ex2.c ex3.c in
the current directory.

You may implement this feature using the C function

Standard input and output redirections > and < For example: % ls -lt > foo

would redirect the standard output of the process
ls -lt to file foo. Similarly, in the
following command,

% cat < foo the standard input of the process cat is redirected to file foo. Shell pipeline | For example: % ls -lt | more the standard output of the process ls -lt is connected to the standard input of the process more via a pipe. Background job execution For example: The commannd line starts the command xterm in the background (i.e., the shell will not wait for the process to terminate and you can type in the next command immediately). The following command line % sleep 20 & ps -l starts the command sleep 20 and immediately execute the command ps -l without waiting for the command sleep 20 to finish first. Sequential job execution For example the command line % sleep 20 ; ps -l starts the command sleep 20 first, and wait for it to finish, then execute the command ps -l. The shell environment The shell should inherit its environment from its parent process. The shell built-in command exit Use the built-in command exit to terminate the shell program. The behaviour of the above commands (except prompt) should be as close to those of the Bash shell as possible. In addition, your shell should not be terminated by CTRL-C, CTRL-\, or CTRL-Z. Finally you must not use any existing shell program to implement your shell (for example by calling a shell through the function system). That would defeat the purpose of this project. In the above, the commands such as ls, cat, grep, sleep, ps and xterm are used as examples to illustrate the use of your shell program. However, your shell must be able to handle any command or executable program. Note the commands prompt, pwd, cd and exit should be implemented as shell builtins, not as external commands. The syntax and behaviour of the built-in commands pwd, cd and exit should be similar to the corresponding commands under Bash shell. A major part of this shell is a command line parser. Please read the this note for suggestions on implementing the parser. Definition of Command Line Syntax The following is the formal definition of the command line syntax for the shell, defined in Extended BNF: < command line > ::= < job >
| < job > ‘&’
| < job > ‘&’ < command line >
| < job > ‘;’
| < job > ‘;’ < command line >

< job > ::= < command >
| < job > ‘|’ < command >

< command > ::= < simple command >
| < simple command > ‘<' < pathname >
| < simple command > ‘>’ < pathname >

< simple command > ::= < pathname >
| < simple command > < token >

An informal definition plus additional explanations of the
syntax is given below:

A command line consists of one
or several jobs separated by the
special character “&” and/or “;”. The last
job may be followed by the character “&”
or “;”. If a job is followed by
the character “&”, then it should be executed in the background.

A job consists of one or more
commands separated by pipeline
characters “|”;

A command is either a
simple command or a
simple command followed by
an input redirection
(< pathname) or an output redirection (> pathname);

A simple command consists of a single
pathname followed by zero or more tokens;

The following five characters are the
special characters:
&, ;, |, < , > of the shell;

The white space characters are
defined to be the space character and the tab character;

A token is a string. A string
is a sequence of characters that does not normally contain space
characters or special characters. If a string contains a space
character or a special character, it must be preceded by the back
slash character “\”. In such a case, the back slash character and
the space character, or the back slash character and the special
character are intepreted as a single normal character without the
special meaning. For example, the two character \&
is interpreted as the normal character &.
Note also that in this project we do not consider
quoted strings. Therefore, if single quote or double quote
characters appear in a string, they are treated just like
any other non-special characters without its usually special

Tokens must be separated by one
or more white spaces;

A pathname is either a file name,
or an absolute pathname, or a relative pathname. Examples of
pathnames are grep, /usr/bin/grep,
bin/grep and ./grep;

A command line must end with a newline character.

Project 2: A Simple File Transfer Protocol
(Back to Beginning)

Design and implement a simple network protocol that can be used to
download files from a remote site and to upload files to a remote
site, and a client and a server programs that communicate using
that protocol. The protocol should use TCP as its transport
layer protocol. The server must be able to serve multiple client
requests simultaneously. For simplicity, do not consider any
authentication process in this project, hence the server will
provide its service to any client with the right site address
and port number.

To simplify project marking, please name your server program
myftpd with the following command line syntax (here the
letter d in myftpd stands for daemon, since the
server should run as a daemon process):

myftpd [ initial_current_directory ]

The server process maintains a current directory. Its initial
value should be the one inherited from its parent process
unless the optional

initial_current_directory

is given. In the latter case, the user supplied path should be
used to set the initial current directory of the server.
This can be done using the function chdir. A client
can use the cd command to change the (child) server’s
current directory later.

The client program should be named myftp with the
following command line syntax:

myftp [ hostname | IP_address ]

where the optional hostname
(IP_address) is the name (address) of the remote
host that provides the myftp service. If the
hostname or IP_address is omitted,
the local host and the default port number is assumed. Use the port
number allocated to you as your default port number.

After the connection between the client and the server is
established, the client should display the prompt >
and wait for one of the following commands:

pwd – to display the current directory of the
server that is serving the client;

lpwd – to display the current directory of
the client;

dir – to display the file names under the current
directory of the server that is serving the client;

ldir – to display the file names under the current
directory of the client;

cd directory_pathname – to change the current directory
of the server that is serving the client; Must support “.” and “..” notations.

lcd directory_pathname – to change the current directory
of the client; Must support “.” and “..” notations.

get filename – to download the named file from the
current directory of the remote server and save
it in the current directory of the client;

put filename – to uploa

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com