Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

En - Subject.05 FT Irc 175

Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

IRC

Internet Relay Chat

Summary: The goal of this project is to make you write your own IRC server. To do
so, you will test your work with a real IRC client. Internet is ruled by solid and
standards protocols that allow a strong interaction between every connected computer.
It’s always good to know about it.

Version: 5
Contents
I Common Instructions 2

II Introduction 3

III Mandatory Part 4

IV Bonus part 7

1
Chapter I

Common Instructions

• Your program should not crash in any circumstances (even when it runs out of
memory), and should not quit unexpectedly. If this happens, your project will be
considered non functional and will receive a 0 during the evaluation.

• If the subject requires it, you must submit a Makefile which will compile your
source files to the required output. Your Makefile must not relink.

• Your Makefile must at least contain the rules $(NAME), all, clean, fclean and
re.

• We encourage you to create test programs for your project even though this work
won’t have to be submitted and won’t be graded. It will give you a chance
to easily test your work and your peers’ work. You will find those tests especially
useful during your defense. Indeed, during defence, you are free to use your tests
and/or the tests of the peer you are evaluating.

• Submit your work to your assigned git repository. Only the work in the git reposi-
tory will be graded. If Deepthought is assigned to grade your work, it will be done
after your peer evaluations. If an error happens in any section of your work during
Deepthought’s grading, the evaluation will stop.

2
Chapter II

Introduction

Internet Relay Chat or IRC is a textual communication protocol on the Internet. It is


instantaneous communication mainly in the form of discussions in groups via discussion
channels, but can also be used for one-to-one communication.

IRC client programs connect to an IRC server to access a specific channel. IRC servers
are connected between them to provide a global network with unique channels.

3
Chapter III

Mandatory Part

Program name ircserv


Turn in files
Makefile Yes
Arguments
External functs. Everything in C++ 98. socket, setsockopt,
getsockname, getprotobyname, gethostbyname,
getaddrinfo, freeaddrinfo, bind, connect, listen,
accept, htons, htonl, ntohs, ntohl, inet_addr,
inet_ntoa, send, recv, signal, lseek, fstat,fcntl,
poll (or equivalent)
Libft authorized
Description Write an IRC server in C++ 98

• You must write an IRC server in C++ 98.

• If you need more C functions, you can use them but always prefer C++.

• The C++ standard must be C++ 98. Your project must compile with it.

• No external library, no Boost, etc...

• Try to always use the most "C++" code possible (for example use <cstring> over
<string.h>).

• In the subject and the scale we will mention poll but you can use equivalent like
select, kqueue, epoll.

• Communication between client and server must be done via TCP/IP(v4) or (v6)

• You won’t need to code a client

• You won’t need to handle server to server communication

• Your executable will be used as follows:


./ircserv [host:port_network:password_network] <port> <password>

4
IRC Internet Relay Chat

◦ host is the hostname on which IRC must connect to join a already existing
network
◦ port_network is the server port on which IRC must connect on host
◦ password_network is the password needed to connect on host
◦ port is the port number on which your server will accept incoming connections.
◦ password is the password needed by any IRC client who wants to connect to
your server.
◦ If host, port_network and password_network aren’t given, you must create
a new IRC network

• The server must be capable of handling multiple clients at the same time and never
hang. Forking is not allowed, all I/O operations must be non blocking and use only
1 poll (or equivalent) for all (read, write, but also listen, ...)

We’ve let you use fcntl because MacOS X doesn’t implement write the
same way as other Unix OSes.
You must use non-blocking FD to have a result similar to other OSes.

Because you are using non-blocking FD, you could use read/recv or
write/send functions without poll (or equivalent) and your server
would be not blocking. But it would consume more system resources.
So again trying to read/recv or write/send in any FD without going
through a poll (or equivalent) will give you a mark equal to 0 and
the end of the evaluation.

You can only use fcntl as follow: fcntl(fd, F_SETFL, O_NONBLOCK);


Any other flags are forbidden.

• You are of course expected to build a clean code. Verify absolutely every error and
in cases where you might have a problem (partial data received, low bandwidth...)

• To verify that your server correctly uses everything you send, an initial test can be
done with nc (Use ctrl+d to send parts of the command):
\$> nc 127.0.0.1 6667
com^Dman^Dd
\$>

This will allow you to first send the letters com, man, d\n. You must first aggregate
the packets to rebuild the command command to handle it.

5
IRC Internet Relay Chat

• Several IRC clients exist you must choose one as a reference and it will be used
during the defense.

• To be compatible with this client you will need to implement at least some part of
the IRC official RFC.

• Using the client on your server must be like using it on any official IRC server but
to be sure we will list the minimal required features.

• You must be able to connect the reference client to your server without producing
any error.

• You must be able to authenticate, set a nickname, a username, join a channel, send
and receive private messages using this client.

• all messages from one client on a channel are sent to all other clients of the channel.

• You must have operators and regular users.

• Some operator’s specific actions/commands.

6
Chapter IV

Bonus part

Here are the bonuses you can add to your IRC to make it closer to the actual IRC. Of
course, if the mandatory part is not perfect, don’t even think about bonuses.

• File transfer.

• A bot.

You might also like