source: abuse/tags/pd/macabuse/src/net/unix/netfile.hpp @ 49

Last change on this file since 49 was 49, checked in by Sam Hocevar, 11 years ago
  • Imported original public domain release, for future reference.
File size: 1.4 KB
Line 
1#ifndef __NETFILE_HPP_
2#define __NETFILE_HPP_
3
4#include <sys/types.h>
5
6
7void secure_filename(char *filename, char *mode);
8
9class nfs_client    // this is a client only read's a file
10{
11  public :
12  int socket_fd;
13  int file_fd;
14
15  long size_to_read; 
16  long size;
17  nfs_client *next;
18  nfs_client(int Socket_fd, int File_fd, nfs_client *Next);
19  int send_read();     // flushes as much of size_to_read as possible
20  ~nfs_client();
21} ;
22
23
24class remote_file    // a remote client has opened this file with us
25{
26  public :
27  int socket_fd;
28  void r_close(char *reason);
29  long size;   // server tells us the size of the file when we open it
30  int open_local;
31  remote_file *next;
32  remote_file(char *filename, char *mode, remote_file *Next);
33
34  int unbuffered_read(int out_fd, size_t count);
35  int unbuffered_write(void *buf, size_t count) { return 0; } // not supported
36  int unbuffered_tell();
37  int unbuffered_seek(long offset);
38  int file_size() { return size; }
39  int open_failure() { return socket_fd<0; }
40  ~remote_file();
41  int fd() { return socket_fd; }
42} ;
43
44
45extern nfs_client *first_nfs_client;
46extern remote_file *remote_file_list;
47extern char default_fs_name[256];
48
49int process_nfs_command(nfs_client *c);
50void add_nfs_client(int fd);
51int local_address(char *server_name);    // returns 1 if server name is ourself
52remote_file *find_rfile(int fd);
53void unlink_remote_file(remote_file *rf);
54int open_file(char *&filename, char *mode);
55int fetch_crcs(char *server);
56
57#endif
Note: See TracBrowser for help on using the repository browser.