Go to the documentation of this file.
   32#ifndef __LIBNET_MACROS_H 
   33#define __LIBNET_MACROS_H 
   44#define LIBNET_DONT_RESOLVE 0 
   50#define LIBNET_RESOLVE      1 
   65#ifndef IN6ADDR_ERROR_INIT 
   66#define IN6ADDR_ERROR_INIT { { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \ 
   67                                 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \ 
 
   80#define LIBNET_PRAND_MAX    0xffffffff 
   85#define LIBNET_MAX_PACKET   0xffff 
   87#define IP_MAXPACKET        0xffff 
   93#define ETHER_ADDR_LEN      0x6 
   98#define FDDI_ADDR_LEN       0x6 
  102#ifndef TOKEN_RING_ADDR_LEN 
  103#define TOKEN_RING_ADDR_LEN 0x6 
  107#define LIBNET_ORG_CODE_SIZE  0x3 
  112#define LIBNET_ERRBUF_SIZE      0x100 
  117#define LIBNET_MAXOPTION_SIZE   0x28 
  120#if (LIBNET_BSD_BYTE_SWAP) 
  121#define FIX(n)      ntohs(n) 
  122#define UNFIX(n)    htons(n) 
  129#define LIBNET_DO_PAYLOAD(l, p)                                              \ 
  130if (payload_s && !payload)                                                   \ 
  132    snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,                                 \ 
  133            "%s(): payload inconsistency\n", __func__);                      \ 
  138    n = libnet_pblock_append(l, p, payload, payload_s);                      \ 
  139    if (n == (uint32_t) - 1)                                                 \ 
  146#define LIBNET_LLDP_TLV_SET_TYPE(tlv, type) (tlv |= (type << 9)) 
  147#define LIBNET_LLDP_TLV_SET_LEN(tlv, len)   (tlv |= len) 
  150#define LIBNET_CKSUM_CARRY(x) \ 
  151    (x = (x >> 16) + (x & 0xffff), (~(x + (x >> 16)) & 0xffff)) 
  154#define LIBNET_OSPF_AUTHCPY(x, y) \ 
  155    memcpy((uint8_t *)x, (uint8_t *)y, sizeof(y)) 
  156#define LIBNET_OSPF_CKSUMBUF(x, y) \ 
  157    memcpy((uint8_t *)x, (uint8_t *)y, sizeof(y))   
  160#define LIBNET_NTP_DO_LI_VN_MODE(li, vn, md) \ 
  161    ((uint8_t)((((li) << 6) & 0xc0) | (((vn) << 3) & 0x38) | ((md) & 0x7))) 
  165#define LIBNET_ISLOOPBACK(p) ((p)->ifr_flags & IFF_LOOPBACK) 
  167#define LIBNET_ISLOOPBACK(p) (strcmp((p)->ifr_name, "lo") == 0) 
  171#define LIBNET_ISADVMODE(x) (x & 0x08) 
  174#define LIBNET_LABEL_SIZE   64 
  175#define LIBNET_LABEL_DEFAULT "cardshark" 
  176#define CQ_LOCK_UNLOCKED    (uint32_t)0x00000000 
  177#define CQ_LOCK_READ        (uint32_t)0x00000001 
  178#define CQ_LOCK_WRITE       (uint32_t)0x00000002 
  185#define for_each_context_in_cq(l) \ 
  186    for (l = libnet_cq_head(); libnet_cq_last(); l = libnet_cq_next()) 
 
  189#define cq_is_wlocked() (l_cqd.cq_lock & CQ_LOCK_WRITE) 
  192#define cq_is_rlocked() (l_cqd.cq_lock & CQ_LOCK_READ) 
  195#define cq_is_locked() (l_cqd.cq_lock & (CQ_LOCK_READ | CQ_LOCK_WRITE)) 
  198#define check_cq_lock(x) (l_cqd.cq_lock & x) 
  
Documentation for libnet (version 1.3).
Generated on Sun Oct 22 2023 by
Doxygen 1.9.8.