libpcap  1.10.1
About: libpcap is a packet filter library used by tools like tcpdump.
  Fossies Dox: libpcap-1.10.1.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

extract.h File Reference
#include <arpa/inet.h>
#include <pcap/pcap-inttypes.h>
#include <pcap/compiler-tests.h>
#include "portability.h"
Include dependency graph for extract.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define UNALIGNED_OK
 
#define EXTRACT_BE_U_2(p)
 
#define EXTRACT_BE_S_2(p)
 
#define EXTRACT_BE_U_4(p)
 
#define EXTRACT_BE_S_4(p)
 
#define EXTRACT_BE_U_8(p)
 
#define EXTRACT_BE_S_8(p)
 
#define EXTRACT_IPV4_TO_HOST_ORDER(p)
 
#define EXTRACT_BE_U_3(p)
 
#define EXTRACT_BE_S_3(p)
 
#define EXTRACT_BE_U_5(p)
 
#define EXTRACT_BE_S_5(p)
 
#define EXTRACT_BE_U_6(p)
 
#define EXTRACT_BE_S_6(p)
 
#define EXTRACT_BE_U_7(p)
 
#define EXTRACT_BE_S_7(p)
 
#define EXTRACT_LE_U_2(p)
 
#define EXTRACT_LE_S_2(p)
 
#define EXTRACT_LE_U_4(p)
 
#define EXTRACT_LE_S_4(p)
 
#define EXTRACT_LE_U_3(p)
 
#define EXTRACT_LE_S_3(p)
 
#define EXTRACT_LE_U_8(p)
 
#define EXTRACT_LE_S_8(p)
 

Macro Definition Documentation

◆ EXTRACT_BE_S_2

#define EXTRACT_BE_S_2 (   p)
Value:
((int16_t)(((uint16_t)(*((const uint8_t *)(p) + 0)) << 8) | \
((uint16_t)(*((const uint8_t *)(p) + 1)) << 0)))

Definition at line 245 of file extract.h.

◆ EXTRACT_BE_S_3

#define EXTRACT_BE_S_3 (   p)
Value:
(((*((const uint8_t *)(p) + 0)) & 0x80) ? \
((int32_t)(((uint32_t)(*((const uint8_t *)(p) + 0)) << 16) | \
((uint32_t)(*((const uint8_t *)(p) + 1)) << 8) | \
((uint32_t)(*((const uint8_t *)(p) + 2)) << 0))) : \
((int32_t)(0xFF000000U | \
((uint32_t)(*((const uint8_t *)(p) + 0)) << 16) | \
((uint32_t)(*((const uint8_t *)(p) + 1)) << 8) | \
((uint32_t)(*((const uint8_t *)(p) + 2)) << 0))))

Definition at line 296 of file extract.h.

◆ EXTRACT_BE_S_4

#define EXTRACT_BE_S_4 (   p)
Value:
((int32_t)(((uint32_t)(*((const uint8_t *)(p) + 0)) << 24) | \
((uint32_t)(*((const uint8_t *)(p) + 1)) << 16) | \
((uint32_t)(*((const uint8_t *)(p) + 2)) << 8) | \
((uint32_t)(*((const uint8_t *)(p) + 3)) << 0)))

Definition at line 253 of file extract.h.

◆ EXTRACT_BE_S_5

#define EXTRACT_BE_S_5 (   p)
Value:
(((*((const uint8_t *)(p) + 0)) & 0x80) ? \
((int64_t)(((uint64_t)(*((const uint8_t *)(p) + 0)) << 32) | \
((uint64_t)(*((const uint8_t *)(p) + 1)) << 24) | \
((uint64_t)(*((const uint8_t *)(p) + 2)) << 16) | \
((uint64_t)(*((const uint8_t *)(p) + 3)) << 8) | \
((uint64_t)(*((const uint8_t *)(p) + 4)) << 0))) : \
((int64_t)(INT64_T_CONSTANT(0xFFFFFF0000000000U) | \
((uint64_t)(*((const uint8_t *)(p) + 0)) << 32) | \
((uint64_t)(*((const uint8_t *)(p) + 1)) << 24) | \
((uint64_t)(*((const uint8_t *)(p) + 2)) << 16) | \
((uint64_t)(*((const uint8_t *)(p) + 3)) << 8) | \
((uint64_t)(*((const uint8_t *)(p) + 4)) << 0))))

Definition at line 313 of file extract.h.

◆ EXTRACT_BE_S_6

#define EXTRACT_BE_S_6 (   p)
Value:
(((*((const uint8_t *)(p) + 0)) & 0x80) ? \
((int64_t)(((uint64_t)(*((const uint8_t *)(p) + 0)) << 40) | \
((uint64_t)(*((const uint8_t *)(p) + 1)) << 32) | \
((uint64_t)(*((const uint8_t *)(p) + 2)) << 24) | \
((uint64_t)(*((const uint8_t *)(p) + 3)) << 16) | \
((uint64_t)(*((const uint8_t *)(p) + 4)) << 8) | \
((uint64_t)(*((const uint8_t *)(p) + 5)) << 0))) : \
((int64_t)(INT64_T_CONSTANT(0xFFFFFFFF00000000U) | \
((uint64_t)(*((const uint8_t *)(p) + 0)) << 40) | \
((uint64_t)(*((const uint8_t *)(p) + 1)) << 32) | \
((uint64_t)(*((const uint8_t *)(p) + 2)) << 24) | \
((uint64_t)(*((const uint8_t *)(p) + 3)) << 16) | \
((uint64_t)(*((const uint8_t *)(p) + 4)) << 8) | \
((uint64_t)(*((const uint8_t *)(p) + 5)) << 0))))

Definition at line 335 of file extract.h.

◆ EXTRACT_BE_S_7

#define EXTRACT_BE_S_7 (   p)
Value:
(((*((const uint8_t *)(p) + 0)) & 0x80) ? \
((int64_t)(((uint64_t)(*((const uint8_t *)(p) + 0)) << 48) | \
((uint64_t)(*((const uint8_t *)(p) + 1)) << 40) | \
((uint64_t)(*((const uint8_t *)(p) + 2)) << 32) | \
((uint64_t)(*((const uint8_t *)(p) + 3)) << 24) | \
((uint64_t)(*((const uint8_t *)(p) + 4)) << 16) | \
((uint64_t)(*((const uint8_t *)(p) + 5)) << 8) | \
((uint64_t)(*((const uint8_t *)(p) + 6)) << 0))) : \
((int64_t)(INT64_T_CONSTANT(0xFFFFFFFFFF000000U) | \
((uint64_t)(*((const uint8_t *)(p) + 0)) << 48) | \
((uint64_t)(*((const uint8_t *)(p) + 1)) << 40) | \
((uint64_t)(*((const uint8_t *)(p) + 2)) << 32) | \
((uint64_t)(*((const uint8_t *)(p) + 3)) << 24) | \
((uint64_t)(*((const uint8_t *)(p) + 4)) << 16) | \
((uint64_t)(*((const uint8_t *)(p) + 5)) << 8) | \
((uint64_t)(*((const uint8_t *)(p) + 6)) << 0))))

Definition at line 360 of file extract.h.

◆ EXTRACT_BE_S_8

#define EXTRACT_BE_S_8 (   p)
Value:
((int64_t)(((uint64_t)(*((const uint8_t *)(p) + 0)) << 56) | \
((uint64_t)(*((const uint8_t *)(p) + 1)) << 48) | \
((uint64_t)(*((const uint8_t *)(p) + 2)) << 40) | \
((uint64_t)(*((const uint8_t *)(p) + 3)) << 32) | \
((uint64_t)(*((const uint8_t *)(p) + 4)) << 24) | \
((uint64_t)(*((const uint8_t *)(p) + 5)) << 16) | \
((uint64_t)(*((const uint8_t *)(p) + 6)) << 8) | \
((uint64_t)(*((const uint8_t *)(p) + 7)) << 0)))

Definition at line 267 of file extract.h.

◆ EXTRACT_BE_U_2

#define EXTRACT_BE_U_2 (   p)
Value:
((uint16_t)(((uint16_t)(*((const uint8_t *)(p) + 0)) << 8) | \
((uint16_t)(*((const uint8_t *)(p) + 1)) << 0)))

Definition at line 242 of file extract.h.

◆ EXTRACT_BE_U_3

#define EXTRACT_BE_U_3 (   p)
Value:
((uint32_t)(((uint32_t)(*((const uint8_t *)(p) + 0)) << 16) | \
((uint32_t)(*((const uint8_t *)(p) + 1)) << 8) | \
((uint32_t)(*((const uint8_t *)(p) + 2)) << 0)))

Definition at line 291 of file extract.h.

◆ EXTRACT_BE_U_4

#define EXTRACT_BE_U_4 (   p)
Value:
((uint32_t)(((uint32_t)(*((const uint8_t *)(p) + 0)) << 24) | \
((uint32_t)(*((const uint8_t *)(p) + 1)) << 16) | \
((uint32_t)(*((const uint8_t *)(p) + 2)) << 8) | \
((uint32_t)(*((const uint8_t *)(p) + 3)) << 0)))

Definition at line 248 of file extract.h.

◆ EXTRACT_BE_U_5

#define EXTRACT_BE_U_5 (   p)
Value:
((uint64_t)(((uint64_t)(*((const uint8_t *)(p) + 0)) << 32) | \
((uint64_t)(*((const uint8_t *)(p) + 1)) << 24) | \
((uint64_t)(*((const uint8_t *)(p) + 2)) << 16) | \
((uint64_t)(*((const uint8_t *)(p) + 3)) << 8) | \
((uint64_t)(*((const uint8_t *)(p) + 4)) << 0)))

Definition at line 306 of file extract.h.

◆ EXTRACT_BE_U_6

#define EXTRACT_BE_U_6 (   p)
Value:
((uint64_t)(((uint64_t)(*((const uint8_t *)(p) + 0)) << 40) | \
((uint64_t)(*((const uint8_t *)(p) + 1)) << 32) | \
((uint64_t)(*((const uint8_t *)(p) + 2)) << 24) | \
((uint64_t)(*((const uint8_t *)(p) + 3)) << 16) | \
((uint64_t)(*((const uint8_t *)(p) + 4)) << 8) | \
((uint64_t)(*((const uint8_t *)(p) + 5)) << 0)))

Definition at line 327 of file extract.h.

◆ EXTRACT_BE_U_7

#define EXTRACT_BE_U_7 (   p)
Value:
((uint64_t)(((uint64_t)(*((const uint8_t *)(p) + 0)) << 48) | \
((uint64_t)(*((const uint8_t *)(p) + 1)) << 40) | \
((uint64_t)(*((const uint8_t *)(p) + 2)) << 32) | \
((uint64_t)(*((const uint8_t *)(p) + 3)) << 24) | \
((uint64_t)(*((const uint8_t *)(p) + 4)) << 16) | \
((uint64_t)(*((const uint8_t *)(p) + 5)) << 8) | \
((uint64_t)(*((const uint8_t *)(p) + 6)) << 0)))

Definition at line 351 of file extract.h.

◆ EXTRACT_BE_U_8

#define EXTRACT_BE_U_8 (   p)
Value:
((uint64_t)(((uint64_t)(*((const uint8_t *)(p) + 0)) << 56) | \
((uint64_t)(*((const uint8_t *)(p) + 1)) << 48) | \
((uint64_t)(*((const uint8_t *)(p) + 2)) << 40) | \
((uint64_t)(*((const uint8_t *)(p) + 3)) << 32) | \
((uint64_t)(*((const uint8_t *)(p) + 4)) << 24) | \
((uint64_t)(*((const uint8_t *)(p) + 5)) << 16) | \
((uint64_t)(*((const uint8_t *)(p) + 6)) << 8) | \
((uint64_t)(*((const uint8_t *)(p) + 7)) << 0)))

Definition at line 258 of file extract.h.

◆ EXTRACT_IPV4_TO_HOST_ORDER

#define EXTRACT_IPV4_TO_HOST_ORDER (   p)
Value:
((uint32_t)(((uint32_t)(*((const uint8_t *)(p) + 0)) << 24) | \
((uint32_t)(*((const uint8_t *)(p) + 1)) << 16) | \
((uint32_t)(*((const uint8_t *)(p) + 2)) << 8) | \
((uint32_t)(*((const uint8_t *)(p) + 3)) << 0)))

Definition at line 281 of file extract.h.

◆ EXTRACT_LE_S_2

#define EXTRACT_LE_S_2 (   p)
Value:
((int16_t)(((uint16_t)(*((const uint8_t *)(p) + 1)) << 8) | \
((uint16_t)(*((const uint8_t *)(p) + 0)) << 0)))

Definition at line 385 of file extract.h.

◆ EXTRACT_LE_S_3

#define EXTRACT_LE_S_3 (   p)
Value:
((int32_t)(((uint32_t)(*((const uint8_t *)(p) + 2)) << 16) | \
((uint32_t)(*((const uint8_t *)(p) + 1)) << 8) | \
((uint32_t)(*((const uint8_t *)(p) + 0)) << 0)))

Definition at line 402 of file extract.h.

◆ EXTRACT_LE_S_4

#define EXTRACT_LE_S_4 (   p)
Value:
((int32_t)(((uint32_t)(*((const uint8_t *)(p) + 3)) << 24) | \
((uint32_t)(*((const uint8_t *)(p) + 2)) << 16) | \
((uint32_t)(*((const uint8_t *)(p) + 1)) << 8) | \
((uint32_t)(*((const uint8_t *)(p) + 0)) << 0)))

Definition at line 393 of file extract.h.

◆ EXTRACT_LE_S_8

#define EXTRACT_LE_S_8 (   p)
Value:
((int64_t)(((uint64_t)(*((const uint8_t *)(p) + 7)) << 56) | \
((uint64_t)(*((const uint8_t *)(p) + 6)) << 48) | \
((uint64_t)(*((const uint8_t *)(p) + 5)) << 40) | \
((uint64_t)(*((const uint8_t *)(p) + 4)) << 32) | \
((uint64_t)(*((const uint8_t *)(p) + 3)) << 24) | \
((uint64_t)(*((const uint8_t *)(p) + 2)) << 16) | \
((uint64_t)(*((const uint8_t *)(p) + 1)) << 8) | \
((uint64_t)(*((const uint8_t *)(p) + 0)) << 0)))

Definition at line 415 of file extract.h.

◆ EXTRACT_LE_U_2

#define EXTRACT_LE_U_2 (   p)
Value:
((uint16_t)(((uint16_t)(*((const uint8_t *)(p) + 1)) << 8) | \
((uint16_t)(*((const uint8_t *)(p) + 0)) << 0)))

Definition at line 382 of file extract.h.

◆ EXTRACT_LE_U_3

#define EXTRACT_LE_U_3 (   p)
Value:
((uint32_t)(((uint32_t)(*((const uint8_t *)(p) + 2)) << 16) | \
((uint32_t)(*((const uint8_t *)(p) + 1)) << 8) | \
((uint32_t)(*((const uint8_t *)(p) + 0)) << 0)))

Definition at line 398 of file extract.h.

◆ EXTRACT_LE_U_4

#define EXTRACT_LE_U_4 (   p)
Value:
((uint32_t)(((uint32_t)(*((const uint8_t *)(p) + 3)) << 24) | \
((uint32_t)(*((const uint8_t *)(p) + 2)) << 16) | \
((uint32_t)(*((const uint8_t *)(p) + 1)) << 8) | \
((uint32_t)(*((const uint8_t *)(p) + 0)) << 0)))

Definition at line 388 of file extract.h.

◆ EXTRACT_LE_U_8

#define EXTRACT_LE_U_8 (   p)
Value:
((uint64_t)(((uint64_t)(*((const uint8_t *)(p) + 7)) << 56) | \
((uint64_t)(*((const uint8_t *)(p) + 6)) << 48) | \
((uint64_t)(*((const uint8_t *)(p) + 5)) << 40) | \
((uint64_t)(*((const uint8_t *)(p) + 4)) << 32) | \
((uint64_t)(*((const uint8_t *)(p) + 3)) << 24) | \
((uint64_t)(*((const uint8_t *)(p) + 2)) << 16) | \
((uint64_t)(*((const uint8_t *)(p) + 1)) << 8) | \
((uint64_t)(*((const uint8_t *)(p) + 0)) << 0)))

Definition at line 406 of file extract.h.

◆ UNALIGNED_OK

#define UNALIGNED_OK

Definition at line 57 of file extract.h.