Client and Server for Student Database Maintenance with FIFOs as IPC

The server is the owner of a student database. This student database contains student records with the information:

The server can be communicated with, using its FIFO, which has a well-known name /tmp/server.fifo

Each client that is created will create a FIFO with its executable name and process id concatenated to form the name of the FIFO (ref. to Stevens). The client communicates its FIFO name to the server via the server FIFO. e.g. /tmp/client-xxxx.fifo.

The server reads this information and opens the client FIFO. This information needs to be stored as the server can keep getting information from any of the clients at any point of time and needs to respond to that client. This will mean that each client should be given a unique id that will be part of its later communications with the server.

The server maintains the student database in a file that is written to in the binary format. It looks for this file and if it exists, reads it as soon as it starts. If there is no such file, it initialises its database to NULL. The student database is stored in decreasing order of CGPA. It also handles a signal SIG_USR1, which, when given will dump the current database in memory to the file in binary format.

The clients can perform one of the following actions:

Design the message formats that need to be exchanged between the client and server.

Write the programs which will add/delete/modify/get student records to/from the database held in the server.