Define the function and module breakup

Assignment Help Basic Computer Science
Reference no: EM13915064

Assignment Specification

For your first stage you are required to 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.

Assignment Task

Your assignment is organised into two parts:

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: EM13915064

Questions Cloud

Long-term recruitment plan : Outline a long-term recruitment plan that contains at least four (4) components, is aligned with your company's recruitment strategy, but also addresses possible job skill or credential shortages. Note: Consider concepts such as succession plannin..
How reliable is your data : What are some methods you might use to determine the reliability of the data you gather? Why is it important to analyze your data to determine if it is reliable? Be sure that you understand the specialized meaning of this term before responding.
Create an xml file with markup tags and some sample data : Create an XML file with markup tags and some sample data to represent a list of invoices
Create an interface design : Create an Interface design
Define the function and module breakup : Define the Function and module breakup
How will lutzs actions affect ladys profitability : How will Lutz's actions affect Lady's profitability in 2014? How will they affect Lady's profitability in 2015? Were Lutz's actions ethical? Why or why not?
Illustrate correcting entry : 1. A correcting entry A). is another name for a closing entry. B). may involve any combination of accounts. C). is a required step in the accounting cycle. D). must involve one balance sheet account and one income statement account
Test the effectiveness of different types of lawn fertilizer : To test the effectiveness of four different types of lawn fertilizer, each type was applied to six different lawns. The same size patch of lawn was mowed for all 24 test units and the grass clippings were weighed
Validity, credibility, reliability : What are some reasons you might consider data or information to lack validity, credibility, or reliability? Explain your answer by using at least 3 examples--at least one for each concept.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Write the code to read the name of a baseball team

Write the code to read the name of a baseball team, the number of games won, and the number of games lost, and display the name of the team and the percentage of games won.

  Compare and contrast the in terms of cores/microprocessors

Compare and contrast the following, in terms of cores (or microprocessors), random access memory (RAM), disk storage, and networking capabilities.

  Ieee 754-floating point representation

Express the final answer in single precision IEEE 754-floating point representation - In single precision IEEE 754-floating point numbers, perform the subsequent operations.

  What are the benefits of using tangible interfaces

What are the benefits of using tangible interfaces compared with other interfaces like GUI, pen-based or gesture?

  Hardware and system software qualify as infrastructure

What is infrastructure? In what was do hardware and system software qualify as infrastructure? What basic strategic planning questions should be addressed with respect to infrastructure?

  Can the capability also be used to install windows 7

What Windows Server 2008 capability enables them to do the mass installation quickly and efficiently? What general steps are involved in setting up this capability? Can the capability also be used to install Windows 7 on the 24 new client workstat..

  What are cautions regarding use of bold type as text stimuli

What are the guidelines and cautions regarding the use of bold type as text stimuli?

  Cmpute cpi and mips rating for processor

Determine the average CPI? On 500MHz Pentium III program takes 1 second. Compute MIPS rating for this processor? What is CPI?

  A motor vehicle maintenance center wants to improve serv

A motor vehicle maintenance center wants to improve its services by using database management systems (DBMS) and data mining. What tables are needed in such a database and how can it help improve their 2.2, 3.2services?

  Continuously prompts the user for a number

Create the logic for a program that continuously prompts the user for a number of dollars until the user enters 0. Pass each entered amount to a conversion method that displays a breakdown of the passed amount into the fewest bills

  Write a fragment of code that assigns the smallest of x y z

Given the integer variables x , y , and z , write a fragment of code that assigns the smallest of x , y , and z to another integer variable min . Assume that all the variables have already been declared and that x , y , and z have been assigned va..

  Which mib group contains this information

A network manager discovers that a network component is performing poorly and issues an order to the technician to replace it. Which MIB group contains this information for the technician to find out the physical location of the component?

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