Find Jobs
Hire Freelancers

C programming

$15-20 USD

Closed
Posted about 19 years ago

$15-20 USD

Paid on delivery
Your goal in this assignment is to write a rudimentary user-level remote file system using ONC (Sun) RPC supporting open, close, read, and write operations. This is the entire link describing what exactly i want you to do . [login to view URL]~pxk/rutgers/hw/[login to view URL] ## Deliverables You will write three programs for this assignment: a remote file server and two client programs to demonstrate its use: server This is a stateful remote file server. It implements four remote procedures: open, read, write, and close. All files are read from and written to the directory in which the server is running (i.e., / is disallowed in a file name). rget This client implements fetching a remote file. The usage is: rget remote_host remote_file local_file The command will open the remote_file and issue one or more read requests to the server, writing the results to local_file. rput This client implements sending a file to the remote server. The usage is: rput remote_host local_file remote_file The command will open the local_file for reading, open remote_file for writing, and read bytes from local_file, sending write requests to the server. Your remote interface is defined by the file filerpc.x. The only part of this file you should modify is the program number on the last line. server Your server implements the remote procedures defined in filerpc.x. open * The server maintains a table of file descriptors, one for each open file. An open request returns a file handle that is an index into this table (e.g., a file handle of 1 indicates the second entry in the table).. The table is limited to supporting a maximum of ten open files. Any additional open requests should be rejected. * open accepts a file name and a mode for opening the file. o A file name name is limited to a maximum of MAXNAME characters (symbol defined in filerpc.x) and cannot contain the character '/'. This restricts all files to the current directory. o The mode for open is any of the valid modes for the open system call (see the man page for open). Typically these will be O_RDONLY for reading or O_WRONLY|O_CREAT for create&write. * If there is no free file handle available, the open request will fail immediately, returning a -1. * If the open system call succeeds, a free table entry in the table of file descriptors is populated with the file descriptor returned by open and the handle (index of the entry) is returned to the requester. read * A read request contains a file handle (obtained from open) and a number indicating the maximum number of bytes to read from the file. * If the file handle is invalid (does not correspond to an open file or is out of range), an error code of 1000 is returned. * Up to MAXBUF bytes can be read. If the nbytes field is greater than that, MAXBUF bytes will be used instead. * If the read system call succeeds, then the buffer is returned along with the number of bytes that were actually read (which may be 0 for end of file). The return parameter is a variable sized buffer, so you will need to set the buf_len member to the number of bytes and the buf_val member to the buffer. The status element of the return structure is set to 0 to indicate success. * If the read system call fails, the status element of the return structure is set to 1 to indicate failure. Instead of a return buffer, the error element is set to the value of errno (error code from the last system call; you'll need to #include in your server code). write * A write request contains a file handle (obtained from open) and a variable size buffer containing the bytes to be written to the file. Since this is a variable sized buffer, your client programs will need to set the buf_len member to the number of bytes and the buf_val member to the data to be written. * If the file handle is invalid (does not correspond to an open file or is out of range), an error code of 1000 is returned. * If the write system call succeeds, the number of bytes with the number of bytes that were actually written is returned in the nbytes field. The status field of the return structure is set to to indicate success. * If the write system call fails, the status element of the return structure is set to 1 to indicate failure. The error element is set to the value of errno close * A close request contains a file handle (obtained from open) and returns TRUE or FALSE. * If the file handle is invalid (does not correspond to an open file or is out of range), a value of FALSE is returned. * Otherwise, the corresponding file descriptor is closed with the close system call and a TRUE is returned. rget The rget client program fetches a file from the server using the abovementioned remote procedure calls. * The command accepts three parameters: the name of the host running the server, the remote file name, and the local file name. * The remote file is opened for reading (O_RDONLY). If this succeeds, the local file is created. * Data from the remote file is read a block at a time and written to the local file. rput The rput client program fetches a file from the server using the abovementioned remote procedure calls. * The command accepts three parameters: the name of the host running the server, the local file name, and the remote file name. * The local file is opened. If this succeeds, the remote file is then opened for creation (O_WRONLY|O_CREAT). * Data from the local file is read a block at a time and written to the remote file. ## Platform This is the entire link describing what exactly i want you to do . [login to view URL]~pxk/rutgers/hw/[login to view URL]
Project ID: 3591256

About the project

Remote project
Active 19 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs

About the client

Flag of UNITED STATES
United States
0.0
0
Member since Mar 2, 2005

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.