11 typedef enum tcp_state { CLOSED,
21 TIME_WAIT } tcp_state_t;
25 /*#define ETHERNET_MODEL 0
31 typedef enum model_type{ETHERNET_MODEL,
34 UDP_MODEL } model_type_t;
36 typedef struct ethernet_host_state {
39 } ethernet_host_state_t;
41 typedef struct ethernet_model {
42 ethernet_host_state_t src;
43 ethernet_host_state_t dst;
47 typedef struct ip_host_state {
55 typedef struct ip_model {
61 ethernet_model_t ethernet;
64 typedef struct tcp_host_state {
66 unsigned long seq_num;
67 unsigned long last_ack;
77 typedef struct tcp_model {
84 typedef struct udp_host_state {
88 typedef struct udp_model {
96 typedef struct vtl_model {
98 ethernet_model_t ethernet_model;
100 tcp_model_t tcp_model;
101 udp_model_t udp_model;
108 udp_model_t * new_udp_model();
109 tcp_model_t * new_tcp_model();
110 ip_model_t * new_ip_model();
111 ethernet_model_t * new_ethernet_model();
112 vtl_model_t * new_vtl_model(model_type_t type);
114 int initialize_ip_model(ip_model_t * model, RawEthernetPacket * pkt, int dir = OUTBOUND_PKT);
115 int initialize_tcp_model(tcp_model_t * model, RawEthernetPacket * pkt, int dir = OUTBOUND_PKT);
116 int initialize_udp_model(udp_model_t * model, RawEthernetPacket * pkt, int dir = OUTBOUND_PKT);
117 int initialize_model(vtl_model_t * model, RawEthernetPacket * pkt, int dir = OUTBOUND_PKT);
119 int sync_ip_model(ip_model_t * model, RawEthernetPacket * pkt);
120 int sync_tcp_model(tcp_model_t * model, RawEthernetPacket * pkt);
121 int sync_udp_model(udp_model_t * model, RawEthernetPacket * pkt);
122 int sync_model(vtl_model_t * model, RawEthernetPacket * pkt);
124 int is_udp_model_pkt(udp_model_t * model, RawEthernetPacket * pkt);
125 int is_tcp_model_pkt(tcp_model_t * model, RawEthernetPacket * pkt);
126 int is_ip_model_pkt(ip_model_t * model, RawEthernetPacket * pkt);
127 int is_ethernet_model_pkt(ethernet_model_t * model, RawEthernetPacket * pkt);
128 int is_model_pkt(vtl_model_t * model, RawEthernetPacket * pkt);
132 int create_empty_ethernet_pkt(ethernet_model_t * model, RawEthernetPacket * pkt, int dir = OUTBOUND_PKT);
133 int create_empty_ip_pkt(ip_model_t * model, RawEthernetPacket * pkt, int dir = OUTBOUND_PKT);
134 int create_empty_tcp_pkt(tcp_model_t * model, RawEthernetPacket * pkt, int dir = OUTBOUND_PKT);
135 int create_empty_udp_pkt(udp_model_t * model, RawEthernetPacket * pkt, int dir = OUTBOUND_PKT);
136 int create_empty_pkt(vtl_model_t * model, RawEthernetPacket * pkt, int dir = OUTBOUND_PKT);
138 // User must track tcp state changes
139 //tcp_state_t get_tcp_state(tcp_state_t current_state, RawEthernetPacket * pkt, int dir = OUTBOUND_PKT);
142 void dbg_dump_eth_model(ethernet_model_t * model);
143 void dbg_dump_ip_model(ip_model_t * model);
144 void dbg_dump_tcp_model(tcp_model_t * model);
145 void dbg_dump_udp_model(udp_model_t * model);
146 void dbg_dump_model(vtl_model_t * model);
153 #endif // ! __VTL_MODEL_H