73#define ADDRESS_INIT(type, len, data) {type, len, data, NULL}
76#define ADDRESS_INIT_NONE ADDRESS_INIT(AT_NONE, 0, NULL)
100set_address(
address *addr,
int addr_type,
int addr_len,
const void *addr_data) {
110 addr->
type = addr_type;
111 addr->
len = addr_len;
112 addr->
data = addr_data;
128 uint32_t val = g_htonl(ipv4->addr);
129 addr->
priv = g_memdup2(&val,
sizeof(val));
163set_address_tvb(
address *addr,
int addr_type,
unsigned addr_len,
tvbuff_t *tvb,
unsigned offset) {
172 set_address(addr, addr_type, addr_len, p);
188 int addr_type,
int addr_len,
const void *addr_data) {
191 addr->
type = addr_type;
203 addr->
len = addr_len;
221 int addr_type,
int addr_len,
tvbuff_t *tvb,
int offset) {
225 alloc_address_wmem(scope, addr, addr_type, addr_len, p);
239 if (addr1->
type > addr2->
type)
return 1;
240 if (addr1->
type < addr2->
type)
return -1;
241 if (addr1->
len > addr2->
len)
return 1;
242 if (addr1->
len < addr2->
len)
return -1;
243 if (addr1->
len == 0) {
251 return memcmp(addr1->
data, addr2->
data, addr1->
len);
274 addr1->
len == addr2->
len &&
276 memcmp(addr1->
data, addr2->
data, addr1->
len) == 0))
295 if ( addr1->
len == addr2->
len
296 && memcmp(addr1->
data, addr2->
data, addr1->
len) == 0
313 set_address(to, from->
type, from->
len, from->
data);
326 alloc_address_wmem(scope, to, from->
type, from->
len, from->
data);
337 copy_address_wmem(NULL, to, from);
365 free_address_wmem(NULL, addr);
375static inline unsigned
376add_address_to_hash(
unsigned hash_val,
const address *addr) {
377 const uint8_t *hash_data = (
const uint8_t *)(addr)->data;
380 for (idx = 0; idx < (addr)->len; idx++) {
381 hash_val += hash_data[idx];
382 hash_val += ( hash_val << 10 );
383 hash_val ^= ( hash_val >> 6 );
396static inline uint64_t
397add_address_to_hash64(uint64_t hash_val,
const address *addr) {
398 const uint8_t *hash_data = (
const uint8_t *)(addr)->data;
401 for (idx = 0; idx < (addr)->len; idx++) {
402 hash_val += hash_data[idx];
403 hash_val += ( hash_val << 10 );
404 hash_val ^= ( hash_val >> 6 );
address_type
Identifies the type of a network layer or link layer address.
Definition address.h:37
@ AT_ETHER
Definition address.h:39
@ AT_IPX
Definition address.h:42
@ AT_IB
Definition address.h:47
@ AT_IPv6
Definition address.h:41
@ AT_MCTP
Definition address.h:51
@ AT_NUMERIC
Definition address.h:50
@ AT_FCWWN
Definition address.h:44
@ AT_FC
Definition address.h:43
@ AT_ILNP_NID
Definition address.h:52
@ AT_ILNP_L64
Definition address.h:53
@ AT_IPv4
Definition address.h:40
@ AT_STRINGZ
Definition address.h:45
@ AT_NONE
Definition address.h:38
@ AT_VINES
Definition address.h:49
@ AT_END_OF_LIST
Definition address.h:55
@ AT_ILNP_ILV
Definition address.h:54
@ AT_AX25
Definition address.h:48
@ AT_EUI64
Definition address.h:46
struct _address address
Holds a network or link-layer address of any supported type.
WS_DLL_PUBLIC unsigned address_to_bytes(const address *addr, uint8_t *buf, unsigned buf_len)
Converts an address to a byte array.
Definition address_types.c:989
port_type
Transport-layer port number types recognized by Wireshark.
Definition address.h:425
@ PT_MCTP
Definition address.h:439
@ PT_DDP
Definition address.h:432
@ PT_USB
Definition address.h:434
@ PT_BLUETOOTH
Definition address.h:437
@ PT_IBQP
Definition address.h:436
@ PT_I2C
Definition address.h:435
@ PT_TCP
Definition address.h:428
@ PT_NONE
Definition address.h:426
@ PT_IPX
Definition address.h:431
@ PT_IDP
Definition address.h:433
@ PT_UDP
Definition address.h:429
@ PT_DCCP
Definition address.h:430
@ PT_IWARP_MPA
Definition address.h:438
@ PT_SCTP
Definition address.h:427
const uint8_t * tvb_get_ptr(tvbuff_t *tvb, const unsigned offset, const unsigned length)
Returns a raw pointer to tvbuff data. Use with extreme caution.
Definition tvbuff.c:1122
void * wmem_memdup(wmem_allocator_t *allocator, const void *source, const size_t size)
Copies a block of memory.
Definition wmem_miscutl.c:19
void wmem_free(wmem_allocator_t *allocator, void *ptr)
Returns the allocated memory to the allocator.
Definition wmem_core.c:62
Holds a network or link-layer address of any supported type.
Definition address.h:62
int len
Definition address.h:64
void * priv
Definition address.h:68
int type
Definition address.h:63
const void * data
Definition address.h:65
Internal memory allocator interface used by the wmem subsystem.
Definition wmem_allocator.h:34
Represents a 128-bit IPv6 address.
Definition inet_addr.h:27
Definition inet_cidr.h:22
Definition inet_cidr.h:27
Core tvbuff (testy virtual buffer) structure representing a region of packet data,...
Definition tvbuff-int.h:95
#define ws_assert(expr)
Unconditionally assert an expression when assertions are enabled.
Definition ws_assert.h:102