Design and develop a unix file sharing system

Assignment Help Programming Languages
Reference no: EM13191872

Design and develop a UNIX file sharing system. For this task you will be required to develop a simple application in C programming language. The application should include the following components:

• a database file, which stores information concerning a specified set of files contained in a given directory, such as your private working directory (pwd).

• A file monitor component of the application will use this database to verify that the files have not been changed by other users since the last check,

• An alert component which will display if the details of a monitored file have changed since the last check.

Stage 1

In order to guide you through the design and implementation of the required application, perform the following steps including:

1.   Write a password protected console-based application, which enables you to create user accounts and specify the name of the file or directory to be shared with other users.

2.   Write a simple console-based (ie text-based) menu system to enable the users to select from a set of functions provided by your system including:

a.   Create a new user

b.   Create  a  database  file,  where  the  implementation  requirements  for  this  are defined in bullet point 3 (below).

c.   Exit the program

3.   Write a function that enables you to create a struct data structure for each file contained in your shared directory. Where each file signature record is stored in a struct of the following form:

struct FileSig {

char name[256];                               // File or directory name int mode;          // protection and file type int user_id;         // User ID of owner

int group_id;                                      // Group ID of owner int size;        // file size in bytes

char time_last_mod[50];                 // modify time as a string

};

4.   Add to your main() function relevant statement(s) to create an instance of the FileSig struct called fileSig. Also use in your main function relevant code to initialise your fileSig struct for two filenames of your choice. Hint: when initialising the fileSig struct ask the user to enter file information/detail rather than by interfacing the Filesystem.

Please note:

For the Stage 1 submission you are not required to do any file I/O for instance to store your file details and/or directory listing. But this will come in Stage 2.

Stage 2:

In order to guide you through the implementation of the new functionality, please follow the following steps including:

Part 1

Extend your program by writing a new C function, which will store and save the logging information into a text file called config.txt. Thus, you will need to amend your code to validate the username and password details entered by a user against those stored on file. Consequently, your system should allow access if users have a valid username and password.

Part 2

Extend your program by writing a new C function to take as input a file containing a list of file names (fully qualified path names; one per line) and produce a database file consisting of file signature records. It is upto you to decide how to generate this file - either manually using the ls command, or by other means. In this file each file signature record is stored in a struct of the following form:

typedef struct {

char name[256];                               /*File or directory name*/ u_short mode;                                                            /*protection and file type*/ short user_id;                                                            /*User ID of owner*/

short group_id;                                 /*Group ID of owner*/

off_t size;                                           /*file size in bytes*/

char time_last_mod[50];                 /*modify time as a string*/

} fileSig;

Hint: All needed information to perform this task can be found in the inode. To modify time, use function ctime to convert to a human readable string. The function prototype can be as follows:

void mkSigData(<fileList>, <database>);

where <fileList> is the name of the file that contains the list of files to get information about. The <database> is the name of the file (your program will create) that will contain the selected inode information for all the files. This database file will contain a series of structs of type fileSig (outlined above), one for each file listed in the fileList.

There must be no other output apart from standard error output associated with system call and function call errors.

Part 3

Extend your program by writing a new C function that will take as input the database file generated in Part 2. The function should simply print to screen the details of each fileSig stored.

Further Requirements

1.   For testing purposes, you can create your own files and a file register, which contains the list of these files that require monitoring.

2.   All required information about the file apart from the file name is to be obtained from the inode of the file.

3.   to make sure the required attributes are defined for your code you should use at least the following #includes in your source files:

#include <stdio.h>

#include <sys/types.h>

#include <sys/stat.h>

#include <unistd.h>

#include <string.h>

#include <stdlib.h>

Submission Requirements

Your written report should include the following:

  • Your application's requirements list and the application design model showing your system's main components (or functions) and showing data transfer between them. It must match your submitted program source code.
  • Also, include screenshots of your running application.

Your source code should include the latest version of your application including:

  • New/amended code to include the new password authentication and file I/O.
  • Source code for mkSigData function.
  • Source code for displayFiles function.
  • Headers and source files of any modules defined/used. The following aspects should be considered including:
  • Commenting:

o Version control comments, etc.

  • Function and module breakup:

o No function longer than one A4 page.

o Put all functions in alphabetic order in your modules.

o Modules containing related functions only.

o Correct use of header files and function prototypes.

Reference no: EM13191872

Questions Cloud

What is the predicted production of a 20 foot tree : the yearly production of a 4 foot orange tree is 16 pounds of oranges. A 17 foot tree produces 82 pounds. Let h represent the height of an orange tree and p the number of pounds of oranges produced.
Describe the shape of isoquant decreasing returns to scale : Suppose the number of points on an economics midterm (P) can be characterized by the following production function: P = 10H - 4B where H is the number of hours spend studying and B is the number of beers in the week prior to the midterm.
Define secret code that uses elemental symbols to spell word : You believe you have cracked a secret code that uses elemental symbols to spell words. The code uses numbers to designate the elemental symbols.
Find the distance between the two cities : Town A is due south of town B, and their latitudes are 50 degrees N and 32 degrees N, respectively. Use 4000 miles as the radius of the earth and find the distance between the two cities, rounded to the nearest 10 miles.
Design and develop a unix file sharing system : Design and develop a UNIX file sharing system. For this task you will be required to develop a simple application in C programming language.
What is the vertical translation of the graph : for the past three years the manager of the math shoppe has observed that the stores revenue reaches a high of about $40,000 each december and a low of about 10,000 each june. a graph of the revenue over this three year period seems to indicate a ..
What is the length of each side of the hexagon : A regular hexagon is inscribed in a circle with a radius of 10 meters. What is the length of each side of the hexagon?
How to carrying out the ph titration : the approximate equivalence point of a ph meter titration before before carrying out the ph titration
How much maximum person would pay to buy insurance : when I was talking about insurance, when I ask about the maximum this person would pay to buy insurance I said that it would be the risk premium: $4823.1 - Then I derived the utility in this case, with certainty this person has wealth $100,000 + $..

Reviews

Write a Review

Programming Languages Questions & Answers

  Design program to enter a series of numbers

Design a program that asks the user to enter a series of 20 numbers. The program should determine whether the number is valid by comparing it to the following list of valid charge account numbers.

  Write the program to model simple calculator

Write the program to model the simple calculator. Each data line must consist of next operation to be performed from list below and right operand.

  Write a utility that converts dollars to coins

For the program, you will write a utility that converts dollars to coins. It is a simple program that must have the following: Multiple outputs to the screen

  Characteristics used for biometric user authentication

You have just been promoted to manager of computer security for large enterprise (XYZ Corporation). Your first project as security manager is to estimate principal physical characteristics used for biometric user authentication.

  Create program to produce a summary of amounts due

Create a program that will produce a summary of the amounts due for Pat's Auto Repair Shop. Display a splash screen first, then display the Job Information Form.

  Create application consisted of three classes

Create an application comprised of three classes. The first class called Crayon represents one crayon of a particular color and length (height).

  Implement a program that prompts the user for an integer

Implement a program that prompts the user for an integer n and prints the nth Fibonacci number, using the above algorithm.

  Reservations system to be horizontal or vertical application

Top Sail Realty Situation: Top Sail Realty is one of the largest time-sharing and rental brokers for vacation cottages. Do you consider the reservations system to be a horizontal or a vertical application? Give reasons for your answer.

  Write down a program to input widths of both hallways

Write down a program which prompts user to input widths of both hallways. The program then outputs length of longest pipe.

  Write css rule to gives all h elements padding

Write down CSS rule which gives all h1 and h2 elements padding of 0.5 ems, grooved border style and margin of 0.5ems. Prepare a layout template which contains header and two columns.

  Create program which tests each member of resistor class

Create program which tests each member of Resistor class to ensure that they work properly. Complete the following Tasks: Create main function and instantiate three Resistor Class objects: Resistor1, Resistor2 and Resistor3.

  Create structure chart-flowchart to store taxpayer-s name

Create the structure chart, also a flowchart and pseudocode, for following problem. Suppose that each input record contains taxpayer's name.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd