-
Notifications
You must be signed in to change notification settings - Fork 1
/
lansrm.h
97 lines (81 loc) · 1.6 KB
/
lansrm.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#ifndef LANSRM_H
#define LANSRM_H
#define __packed __attribute__((packed));
#include <glib.h>
#include <netinet/in.h>
#include "srm.h"
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
#define LIF_BLOCK_SIZE 256
typedef enum {
SRM_REQUEST_CONNECT = 1,
SRM_REQUEST_XFER = 2,
SRM_REPLY_CONNECT = 129,
SRM_REPLY_XFER = 130
} lansrm_request_t;
struct srm_connect_request {
uint16_t rec_type;
uint16_t ret_code;
uint16_t option_code;
uint16_t host_node;
uint16_t version;
uint8_t station[6];
} __packed;
struct srm_connect_reply {
uint16_t rec_type;
uint16_t ret_code;
uint32_t host_ip;
uint32_t my_ip;
uint16_t option_code;
uint16_t host_node;
uint16_t version;
uint16_t my_node;
uint8_t my_station[6];
uint8_t host_flag;
} __packed;
struct srm_transfer {
uint16_t rec_type;
uint16_t ret_code;
uint16_t session_id;
uint16_t version;
uint16_t host_node;
uint8_t unum;
uint8_t sequence_no;
} __packed;
struct client_config {
struct sockaddr_in addr;
GList *volumes;
gchar **bootfiles;
char *bootpath;
char *tempdir;
int bootfilefd;
int hostnode;
int node;
};
struct srm_client {
struct client_config *config;
struct sockaddr_in addr;
GTree *files;
char *ipstr;
int debug_level;
int cleanup;
int fd;
};
struct open_file_entry {
struct srm_volume *volume;
GString *filename;
off_t hdr_offset;
srm_filetype_t filetype;
int unlink_on_close;
int client_fd;
int fd;
int cwd;
};
struct lansrm_response_packet {
struct srm_transfer xfer;
struct srm_response_packet srm;
} __packed;
struct lansrm_request_packet {
struct srm_transfer xfer;
struct srm_request_packet srm;
} __packed;
#endif