-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTCP_struct.h
70 lines (58 loc) · 1.37 KB
/
TCP_struct.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include <sys/types.h>
#define OPEN 0
#define CLOSE 1
#define WRITE 2
#define READ 3
#define LSEEK 4
#define STAT 5
#define UNLINK 6
#define GETDIRENTRIES 7
#define GETDIRTREE 8
//set offset relatively large
#define OFFSET 5200
typedef struct header_marshalling{
size_t argsTotalLen; //argsTotalLen is number of bytes that follows this header. starting in args
int opcode;
char args[0];
} header_wrapper;
typedef struct Open_marshalling {
size_t pathlen;
int flags;
mode_t mode;
char pathname[0];
} open_wrapper;
typedef struct Close_marshalling {
int fd;
} close_wrapper;
typedef struct Write_marshalling {
size_t msglen;
int fd;
char buf[0];
} write_wrapper;
typedef struct Read_marshalling {
size_t readlen;
int fd;
} read_wrapper;
typedef struct Lseek_marshalling {
off_t offset;
int fd;
int whence;
} lseek_wrapper;
typedef struct Stat_marshalling {
size_t pathlen;
struct stat statbuf;
char pathname[0];
} stat_wrapper;
typedef struct Unlink_marshalling {
size_t pathlen;
char pathname[0];
} unlink_wrapper;
typedef struct Getdirentries_marshalling {
size_t nbytes;
off_t basep;
int fd;
} getdirentries_wrapper;
typedef struct Getdirtree_marshalling {
size_t pathlen;
char pathname[0];
} getdirtree_wrapper;