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) \
147#define LIBNET_CKSUM_CARRY(x) \
148 (x = (x >> 16) + (x & 0xffff), (~(x + (x >> 16)) & 0xffff))
151#define LIBNET_OSPF_AUTHCPY(x, y) \
152 memcpy((uint8_t *)x, (uint8_t *)y, sizeof(y))
153#define LIBNET_OSPF_CKSUMBUF(x, y) \
154 memcpy((uint8_t *)x, (uint8_t *)y, sizeof(y))
157#define LIBNET_NTP_DO_LI_VN_MODE(li, vn, md) \
158 ((uint8_t)((((li) << 6) & 0xc0) | (((vn) << 3) & 0x38) | ((md) & 0x7)))
162#define LIBNET_ISLOOPBACK(p) ((p)->ifr_flags & IFF_LOOPBACK)
164#define LIBNET_ISLOOPBACK(p) (strcmp((p)->ifr_name, "lo") == 0)
168#define LIBNET_ISADVMODE(x) (x & 0x08)
171#define LIBNET_LABEL_SIZE 64
172#define LIBNET_LABEL_DEFAULT "cardshark"
173#define CQ_LOCK_UNLOCKED (u_int)0x00000000
174#define CQ_LOCK_READ (u_int)0x00000001
175#define CQ_LOCK_WRITE (u_int)0x00000002
182#define for_each_context_in_cq(l) \
183 for (l = libnet_cq_head(); libnet_cq_last(); l = libnet_cq_next())
186#define cq_is_wlocked() (l_cqd.cq_lock & CQ_LOCK_WRITE)
189#define cq_is_rlocked() (l_cqd.cq_lock & CQ_LOCK_READ)
192#define cq_is_locked() (l_cqd.cq_lock & (CQ_LOCK_READ | CQ_LOCK_WRITE))
195#define check_cq_lock(x) (l_cqd.cq_lock & x)
Documentation for libnet (version 1.2).
Generated on Wed Apr 3 2024 by
Doxygen 1.10.0.