109 | | Features provided by this library include: \begin{enumerate} |
110 | | \item Ethernet frame injection and capture. |
111 | | \item Manipulation of a subset of wireless interface parameters at both aggregate and |
112 | | per-packet levels of granularity. |
113 | | \item Communication of a subset of wireless interface parameters from the sending end of a network |
114 | | connection to the receiving end, on a per-packet granularity level. |
115 | | \item Reception of the entire 802.11 frame, when the receiver is in RFMON mode. |
116 | | \item Appending parameters to all incoming frames and using the pcap filters to receive only |
117 | | those frames that the user of the library is interested in. |
118 | | \end{enumerate} |
| 109 | Features provided by this library include: |
| 110 | 1. Ethernet frame injection and capture. |
| 111 | 2. Manipulation of a subset of wireless interface parameters at both aggregate and per-packet levels of granularity. |
| 112 | 3. Communication of a subset of wireless interface parameters from the sending end of a network connection to the receiving end, on a per-packet granularity level. |
| 113 | 4. Reception of the entire 802.11 frame, when the receiver is in RFMON mode. |
| 114 | 5. Appending parameters to all incoming frames and using the pcap filters to receive only those frames that the user of the library is interested in. |
128 | | \begin{enumerate} |
129 | | \item Obtain parameter information using the mac\_get\_ifinfo function. The argument should be the address of a {NULL} pointer. |
130 | | \item {OPTIONAL:} Allocate memory for, and initialize, the mac\_params and the mac\_params\_flags structures in case you are going |
131 | | to use the mac\_get\_params or mac\_set\_params function. Use the mac\_init\_params function for the same. Again, the arguments |
132 | | {SHOULD BE} addresses of {NULL} pointers. |
133 | | \item {OPTIONAL:} Call any one of the parameter functions, mac\_get\_params or mac\_set\_params or mac\_append\_params. |
134 | | \item For each frame that you want to send and depending on the destination address, either call mac\_send\_broadcast or |
135 | | mac\_send\_unicast. \\For each frame that you want to recv, call mac\_recv. The double pointers, header, |
136 | | payload, send\_parameter\_info and recv\_parameter\_info SHOULD BE addresses of {NULL} pointers. The pointer len, should be |
137 | | the address of an unsigned short. |
138 | | \item {OPTIONAL:} Free memory, if allocated, for the mac\_params and the mac\_pa- |
139 | | rams\_flags structures using the mac\_free\_params function. |
140 | | \item Free interface information using the mac\_free\_ifinfo before exiting. |
141 | | \end{enumerate} |
| 121 | 1. Obtain parameter information using the mac\_get\_ifinfo function. The argument should be the address of a {NULL} pointer. |
| 122 | 2. {OPTIONAL:} Allocate memory for, and initialize, the mac_params and the mac_params_flags structures in case you are going to use the mac_get_params or mac_set_params function. Use the mac_init_params function for the same. Again, the arguments {SHOULD BE} addresses of {NULL} pointers. |
| 123 | 3. {OPTIONAL:} Call any one of the parameter functions, mac\_get\_params or mac_set_params or mac_append_params. |
| 124 | 4. For each frame that you want to send and depending on the destination address, either call mac_send_broadcast or mac_send_unicast. For each frame that you want to recv, call mac_recv. The double pointers, header, payload, send_parameter_info and recv_parameter_info SHOULD BE addresses of {NULL} pointers. The pointer len, should be the address of an unsigned short. |
| 125 | 5. {OPTIONAL:} Free memory, if allocated, for the mac_params and the mac_params_flags structures using the mac_free_params function. |
| 126 | 6. Free interface information using the mac_free_ifinfo before exiting. |
143 | | The function, \texttt{int mac\_get\_ifinfo (struct mac\_ifinfo **mac\_ptr)}, is used to obtain information on all existing interfaces. |
144 | | It has one argument, which is a pointer to a linked list of structures. Each structure in the list contains members |
145 | | which can store the name of interface, hardware address, ip address, whether the interface is wireless or not and other relevant |
146 | | information. The information stored in these structures is used by the rest of the functions in the library. \newline |
| 128 | The function, int mac_get_ifinfo (struct mac_ifinfo **mac_ptr), is used to obtain information on all existing interfaces. It has one argument, which is a pointer to a linked list of structures. Each structure in the list contains members which can store the name of interface, hardware address, ip address, whether the interface is wireless or not and other relevant information. The information stored in these structures is used by the rest of the functions in the library. Likewise, the function, int mac_free_ifinfo (struct mac_ifinfo **mac_ptr), is used to free the memory allocated for interface information. |
| 129 | It also has one argument, which is the pointer to the linked list of structures. The function, int mac_send_broadcast (u_char *payload, short len, struct mac_ifinfo_list *q), is used to assemble an ethernet frame with the specified payload and broadcast (MAC-level) this frame. The first argument is the pointer to the payload, the second one is the length of the payload and the third one is the structure containing |
| 130 | the name of the interface on which this frame needs to be sent. |
148 | | Likewise, the function, \texttt{int mac\_free\_ifinfo (struct mac\_ifinfo \\ |
149 | | **mac\_ptr)}, is used to free the memory allocated for interface information. |
150 | | It also has one argument, which is the pointer to the linked list of structures. \newline |
| 132 | The function, int mac_send_unicast (u_char *payload, short len, struct mac_ifinfo_list *q, unsigned char *ucast_mac), is used to assemble an ethernet frame with the specified payload and send this frame to a unicast MAC address. The first argument is the pointer to the payload, the second one is the length of the payload, the third one is the structure containing the name of the interface on which this frame needs to be sent and the fourth argument is a pointer to the MAC address of the destination. |
152 | | The function, \texttt{int mac\_send\_broadcast (u\_char *payload, short len, \\ |
153 | | struct mac\_ifinfo\_list *q)}, is used to assemble an ethernet frame with the specified payload |
154 | | and broadcast (MAC-level) this frame. The first argument is the pointer to the payload, |
155 | | the second one is the length of the payload and the third one is the structure containing |
156 | | the name of the interface on which this frame needs to be sent. \newline |
| 134 | The function, int mac_recv (struct ether_header **header, char **payload, unsigned short *len, unsigned char **send_params, unsigned char **recv_params, struct mac_ifinfo_list *q, char *filter), is used to receive an ethernet frame. Its arguments include pointers to store ethernet header information, payload, length of the payload, sending side parameters that have been appended, receiving side parameters that have been appended and the pcap filter that is to applied. |
158 | | The function, \texttt{int mac\_send\_unicast (u\_char *payload, short len, \\ |
159 | | struct mac\_ifinfo\_list *q, unsigned char *ucast\_mac)}, is used to |
160 | | assemble an ethernet frame with the specified payload and send this frame |
161 | | to a unicast MAC address. The first argument is the pointer to the payload, |
162 | | the second one is the length of the payload, the third one is the structure |
163 | | containing the name of the interface on which this frame needs to be sent and |
164 | | the fourth argument is a pointer to the MAC address of the destination. \newline |
| 136 | Note that parameters are appended to all incoming frames and the pcap filters can be used to receive only those frames that the user of the library is interested in. |
166 | | The function, \texttt{int mac\_recv (struct ether\_header **header, \\ |
167 | | char **payload, unsigned short *len, unsigned char **send\_params, \\ |
168 | | unsigned char **recv\_params, struct mac\_ifinfo\_list *q, char *filter)}, is used to receive |
169 | | an ethernet frame. Its arguments include pointers to store ethernet header information, payload, length of the payload, |
170 | | sending side parameters that have been appended, receiving side parameters that have been appended and the pcap~\cite{Libpcap+doc} |
171 | | filter that is to applied. \newline |
| 138 | ==== Manipulation of a subset of wireless interface parameters at both aggregate and per-packet levels of granularity ==== |
173 | | Note that parameters are appended to all incoming frames and the pcap filters can be used to |
174 | | receive only those frames that the user of the library is interested in. |
| 140 | The function, int mac_get_params (struct mac_params *h, struct mac_ifinfo_list *if_ptr, int argc, ...), is used to request the driver to return information on interface parameters, specified by the fourth argument onwards. The first argument is the pointer to the mac_params structure, where information, on retrieved parameter values, is to be stored. The second one is a pointer to the struct mac_ifinfo_list that specifies the interface to which, a call to this function, applies. The parameter settings on the specified interface will be returned. The third argument is the number of arguments that follow after this one. Each argument that follows corresponds to the key of a parameter. |
176 | | \subsection{Manipulation of a subset of wireless interface parameters at both aggregate and |
177 | | per-packet levels of granularity} |
| 142 | The function, int mac_set_params (struct mac_params *h, struct mac_ifinfo_list *if_ptr, int argc, ...), is used to request the driver to operate on interface parameter settings, specified by the fourth argument onwards. The first argument is the pointer to the mac\_params structure, where information, on parameter settings, is stored. The second one is a pointer to the struct mac_ifinfo_list that specifies the interface to which, a call to this function, applies. The parameter values on the specified interface will be set. The third argument is the number of (key,value) pairs that follow after this one. |
179 | | The function, \texttt{int mac\_get\_params (struct mac\_params *h, struct mac\_if- |
180 | | info\_list *if\_ptr, int argc, ...)}, is used to request the driver to return information |
181 | | on interface parameters, specified by the fourth argument onwards. The first argument |
182 | | is the pointer to the mac\_params structure, where information, on retrieved parameter |
183 | | values, is to be stored. The second one is a pointer to the struct mac\_ifinfo\_list |
184 | | that specifies the interface to which, a call to this function, applies. The parameter |
185 | | settings on the specified interface will be returned. The third argument is the number |
186 | | of arguments that follow after this one. Each argument that follows corresponds to the |
187 | | key of a parameter. \newline |
| 144 | ==== Communication of a subset of wireless interface parameters from the sending end of a network connection to the receiving end, on a per-packet granularity level ==== |
189 | | The function, \texttt{int mac\_set\_params (struct mac\_params *h, struct mac\_ |
190 | | ifinfo\_list *if\_ptr, int argc, ...)}, is used to request the driver to operate on |
191 | | interface parameter settings, specified by the fourth argument onwards. The first |
192 | | argument is the pointer to the mac\_params structure, where information, on parameter |
193 | | settings, is stored. The second one is a pointer to the struct mac\_ifinfo\_list that |
194 | | specifies the interface to which, a call to this function, applies. The parameter values |
195 | | on the specified interface will be set. The third argument is the number of (key,value) |
196 | | pairs that follow after this one. |
197 | | |
198 | | \subsection{Communication of a subset of wireless interface parameters from the sending end of a network |
199 | | connection to the receiving end, on a per-packet granularity level} |
200 | | |
201 | | The function, \texttt{int mac\_append\_params (struct mac\_ifinfo\_list *if\_ptr, \\ |
202 | | unsigned char direction, int argc, ...)}, is used to request the driver to append |
203 | | interface parameter information, specified by the fourth argument onwards. The first |
204 | | argument is the pointer to the struct mac\_ifinfo\_list that specifies the interface |
205 | | to which, a call to this function, applies. All outgoing/incoming frames on the specified |
206 | | interface will have the specified parameters appended to them. The appending of parameters |
207 | | can also be turned off. The second argument is a variable, direction, that indicates |
208 | | whether parameters should be appended on outgoing and/or incoming frames. The third |
209 | | argument is the number of arguments that follow after this one. Each argument that |
210 | | follows corresponds to the key of a parameter that needs to be appended. |
| 146 | The function, \texttt{int mac\_append\_params (struct mac\_ifinfo\_list *if\_ptr, unsigned char direction, int argc, ...)}, is used to request the driver to append interface parameter information, specified by the fourth argument onwards. The first argument is the pointer to the struct mac\_ifinfo\_list that specifies the interface to which, a call to this function, applies. All outgoing/incoming frames on the specified interface will have the specified parameters appended to them. The appending of parameters can also be turned off. The second argument is a variable, direction, that indicates whether parameters should be appended on outgoing and/or incoming frames. The third argument is the number of arguments that follow after this one. Each argument that follows corresponds to the key of a parameter that needs to be appended. |