1 /*****************************************************************************
2 * Copyright 2005 Daniel Ferullo *
4 * Licensed under the Apache License, Version 2.0 (the "License"); *
5 * you may not use this file except in compliance with the License. *
6 * You may obtain a copy of the License at *
8 * http://www.apache.org/licenses/LICENSE-2.0 *
10 * Unless required by applicable law or agreed to in writing, software *
11 * distributed under the License is distributed on an "AS IS" BASIS, *
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13 * See the License for the specific language governing permissions and *
14 * limitations under the License. *
16 *****************************************************************************/
20 * @author Daniel Ferullo (ferullo@cmu.edu)
22 * @brief definitions for helper-specific data
24 #ifndef __HELPERDEF_H__
25 #define __HELPERDEF_H__
30 * The timeouts specified below are based on experience on how long it really
31 * takes for natblaster to succeed. They are longer than is probably needed.
34 /** @brief the time in seconds to look for buddy info when searching */
35 #define FIND_BUDDY_TIMEOUT 20
37 /** @brief the time in seconds to look for a second connection */
38 #define FIND_CONN2_TIMEOUT 5
40 /** @brief the time in seconds to wait for the buddy port alloc to be set */
41 #define WAIT_FOR_BUDDY_PORT_ALLOC_TIMEOUT 20
43 /** @brief time in seconds to wait for the buddy's external port to be set */
44 #define WAIT_FOR_BUDDY_PORT_KNOWN_TIMEOUT 20
46 /** @brief time in seconds to wait for the buddy's SYN sequence number */
47 #define WAIT_FOR_BUDDY_SEQ_NUM_TIMEOUT 20
49 /** @brief time in seconds to wait for the buddy to send SYN a SYN FLOOD */
50 #define WAIT_FOR_BUDDY_SYN_FLOOD_TIMEOUT 20
52 /** @brief time in seconds to wait for the buddy external port to be set
53 * through use of the birthday paradox */
54 #define WAIT_FOR_BUDDY_BDAY_PORT_TIMEOUT 20
56 /** @brief a structure to hold information about a bday flood */
58 /** @brief the sequence number in the SYN packets half of the flood */
60 /** @brief a flag indicating if the sequence number has been set */
62 /** @brief the port that the successful synack was sent to */
64 /** @brief indicates if the port value has been set */
66 /** @brief a flag indicating if the bday port prediction failed */
68 } __attribute__((__packed__
));
70 /** @brief a typedef for the bday_helper structure */
71 typedef struct bday_helper bday_helper_t
;
74 /** @brief a structure to hold the sequence number from a SYN packet */
75 struct buddy_syn_seq_num
{
76 /** @brief the sequence number to the buddy */
78 /** @brief a flag indicating if the sequence number has been set */
80 } __attribute__((__packed__
));
82 /** @brief a typedef for teh buddy_syn_seq_num structure */
83 typedef struct buddy_syn_seq_num buddy_syn_seq_num_t
;
85 /** @brief structure with all socket descriptors */
86 struct helper_sock_desc
{
87 /** @brief the socket used for persistent connection to peer */
89 }__attribute__((__packed__
));
91 /** @brief typedef for the helper_sock_desc structure */
92 typedef struct helper_sock_desc helper_sock_desc_t
;
94 /** @brief structure with all the connection information */
95 struct helper_conn_info
{
96 /** @brief the peer info */
98 /** @brief the buddy info */
100 /** @brief the socket descriptors */
101 helper_sock_desc_t socks
;
102 /** @brief the port allocation method */
103 port_alloc_t port_alloc
;
104 /** @brief the sequence number to buddy */
105 buddy_syn_seq_num_t buddy_syn
;
106 /** @brief information about a bday attempt */
108 } __attribute__((__packed__
));
110 /** @brief typedef for teh helper_conn_info structure */
111 typedef struct helper_conn_info helper_conn_info_t
;
113 /** @brief structure to hold observed connection data */
114 struct observed_data
{
115 /** @brief the peer's ip */
117 /** @brief the peer's port */
119 } __attribute__((__packed__
));
121 /** @brief typedef for the observed_data structure */
122 typedef struct observed_data observed_data_t
;
124 #endif /* __HELPERDEF_H__ */