#include "pkt.h"
Go to the source code of this file.
Functions | |
| util_byte_array_t * | Pkt_CreateIcmpPkt (array_t *typeArray, array_t *codeArray, array_t *idArray, array_t *seqArray) |
| Create an ICMP packet. | |
| util_byte_array_t * | Pkt_CreateUdpPkt (array_t *srcPorts, array_t *destPorts, array_t *sizes, array_t *byteStrings) |
| Create a UDP packet. | |
| util_byte_array_t * | Pkt_CreateTcpPkt (array_t *srcPorts, array_t *destPorts, array_t *seqNums, array_t *ackNums, st_table *flags, array_t *sizes, array_t *byteStrings) |
| Create a TCP packet. | |
| util_byte_array_t * | Pkt_CreateIpPkt (array_t *srcIps, array_t *destIps, st_table *ipFlagsTable, array_t *offsets, array_t *ids, st_table *ipOptions, array_t *ttls, util_byte_array_t *l4Payload, int l4Protocol) |
| Create a IP packet. | |
| Pkt_EthernetHdr_t * | Pkt_CreateEthPkt (char *srcMac, char *destMac, util_byte_array_t *l3Payload, u_int16_t l3Protocol) |
| Create Ethernet packet with given params. | |
| Pkt_EthernetHdr_t * | Pkt_CreateRandEthPkt (array_t *tmpArray) |
| Create a random ethernet packet. | |
| array_t * | Pkt_SeedRandEthPktArray (Pkt_ByteOrder_t byteOrder, int numSeeds, Pkt_TfcMode_t *tfcMode) |
| Create a random ethernet packet; only tcp for now. | |
| void | Pkt_HTON (Pkt_EthernetHdr_t *anEth) |
| Take an ethernet packet and convert it to network order. | |
| void | Pkt_NTOH (Pkt_EthernetHdr_t *anEth) |
| Take an ethernet packet and convert it to host order. | |
Definition in file pktTfc.c.
| Pkt_EthernetHdr_t* Pkt_CreateEthPkt | ( | char * | srcMac, | |
| char * | destMac, | |||
| util_byte_array_t * | l3Payload, | |||
| u_int16_t | l3Protocol | |||
| ) |
| util_byte_array_t* Pkt_CreateIcmpPkt | ( | array_t * | typeArray, | |
| array_t * | codeArray, | |||
| array_t * | idArray, | |||
| array_t * | seqArray | |||
| ) |
| util_byte_array_t* Pkt_CreateIpPkt | ( | array_t * | srcIps, | |
| array_t * | destIps, | |||
| st_table * | ipFlagsTable, | |||
| array_t * | offsets, | |||
| array_t * | ids, | |||
| st_table * | ipOptions, | |||
| array_t * | ttls, | |||
| util_byte_array_t * | l4Payload, | |||
| int | l4Protocol | |||
| ) |
| Pkt_EthernetHdr_t* Pkt_CreateRandEthPkt | ( | array_t * | tmpArray | ) |
| util_byte_array_t* Pkt_CreateTcpPkt | ( | array_t * | srcPorts, | |
| array_t * | destPorts, | |||
| array_t * | seqNums, | |||
| array_t * | ackNums, | |||
| st_table * | flags, | |||
| array_t * | sizes, | |||
| array_t * | byteStrings | |||
| ) |
Create a TCP packet.
User defines the "interesting" source and dest ports, seq numbers, ack numbers, sizes, and byteStrings to be inserted in the packet. If any of these arrays are empty, we take the corresponding field to be un-constrained. Otherwise, the field takes a value with equal likelihood from the correp array. (The array can be of length 1, which is useful for directed testing.)
User also define flags to be set by a st_table containing strings "fin", "syn", "rst", "psh", "ack", "urg", "ece", "cwr" - default is set with prob 0.5. If the st_table is NIL, flags are set at random.
Since there is no length field in the tcp header, we return a util_byte_array_t *, with the bytes entry being the actual packet, and the length entry being the length of the packet.
| util_byte_array_t* Pkt_CreateUdpPkt | ( | array_t * | srcPorts, | |
| array_t * | destPorts, | |||
| array_t * | sizes, | |||
| array_t * | byteStrings | |||
| ) |
Create a UDP packet.
User defines the "interesting" source and dest ports, and byteStrings to be inserted in the packet.
| void Pkt_HTON | ( | Pkt_EthernetHdr_t * | anEth | ) |
| void Pkt_NTOH | ( | Pkt_EthernetHdr_t * | anEth | ) |
| array_t* Pkt_SeedRandEthPktArray | ( | Pkt_ByteOrder_t | byteOrder, | |
| int | numSeeds, | |||
| Pkt_TfcMode_t * | tfcMode | |||
| ) |