Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Enumerations | Functions
address.h File Reference
#include <string.h>
#include "tvbuff.h"
#include <epan/wmem_scopes.h>
#include <wsutil/ws_assert.h>
#include <wsutil/inet_cidr.h>

Go to the source code of this file.

Classes

struct  _address
 Holds a network or link-layer address of any supported type. More...
 

Macros

#define ADDRESS_INIT(type, len, data)   {type, len, data, NULL}
 Static initializer for an address with explicit type, length, and data pointer.
 
#define ADDRESS_INIT_NONE   ADDRESS_INIT(AT_NONE, 0, NULL)
 Static initializer for an empty address (AT_NONE, zero length, NULL data).
 

Typedefs

typedef struct _address address
 Holds a network or link-layer address of any supported type.
 

Enumerations

enum  address_type {
  AT_NONE , AT_ETHER , AT_IPv4 , AT_IPv6 ,
  AT_IPX , AT_FC , AT_FCWWN , AT_STRINGZ ,
  AT_EUI64 , AT_IB , AT_AX25 , AT_VINES ,
  AT_NUMERIC , AT_MCTP , AT_ILNP_NID , AT_ILNP_L64 ,
  AT_ILNP_ILV , AT_END_OF_LIST
}
 Identifies the type of a network layer or link layer address. More...
 
enum  port_type {
  PT_NONE , PT_SCTP , PT_TCP , PT_UDP ,
  PT_DCCP , PT_IPX , PT_DDP , PT_IDP ,
  PT_USB , PT_I2C , PT_IBQP , PT_BLUETOOTH ,
  PT_IWARP_MPA , PT_MCTP
}
 Transport-layer port number types recognized by Wireshark. More...
 

Functions

WS_DLL_PUBLIC unsigned address_to_bytes (const address *addr, uint8_t *buf, unsigned buf_len)
 Converts an address to a byte array.
 

Detailed Description

Definitions for structures storing addresses, and for the type of variables holding port-type values

Wireshark - Network traffic analyzer By Gerald Combs geral.nosp@m.d@wi.nosp@m.resha.nosp@m.rk.o.nosp@m.rg Copyright 1998 Gerald Combs

SPDX-License-Identifier: GPL-2.0-or-later

Enumeration Type Documentation

◆ address_type

Identifies the type of a network layer or link layer address.

Address types can be added here if there are many dissectors that use them or just within a specific dissector. If an address type is added here, it must be "registered" within address_types.c For dissector address types, just use the address_type_dissector_register function from address_types.h

AT_NUMERIC - a numeric address type can consist of a uint8_t, uint16_t, uint32_t or uint64_t value. If no correct length is provided, to avoid data bleed, a uint8_t is assumed. Only representation (aka conversion of value to string) is implemented for this type.

Enumerator
AT_NONE 

No address / unset.

AT_ETHER 

MAC address (Ethernet, 802.x, FDDI); 6 bytes.

AT_IPv4 

IPv4 address; 4 bytes.

AT_IPv6 

IPv6 address; 16 bytes.

AT_IPX 

IPX network + node address; 10 bytes.

AT_FC 

Fibre Channel address; 3 bytes.

AT_FCWWN 

Fibre Channel World Wide Name; 8 bytes.

AT_STRINGZ 

Null-terminated string address.

AT_EUI64 

IEEE EUI-64 address; 8 bytes.

AT_IB 

InfiniBand GID (16 bytes) or LID (2 bytes).

AT_AX25 

AX.25 amateur radio address; 7 bytes.

AT_VINES 

Banyan VINES address; 6 bytes.

AT_NUMERIC 

Numeric scalar address (uint8/16/32/64); display-only.

AT_MCTP 

Management Component Transport Protocol address.

AT_ILNP_NID 

ILNP Node Identifier (NID); 8 bytes.

AT_ILNP_L64 

ILNP 64-bit Locator (L64); 8 bytes.

AT_ILNP_ILV 

ILNP Identifier-Locator Vector (ILV); 16 bytes.

AT_END_OF_LIST 

Sentinel — must remain the last enumerator.

◆ port_type

enum port_type

Transport-layer port number types recognized by Wireshark.

Enumerator
PT_NONE 

No port number applicable

PT_SCTP 

Stream Control Transmission Protocol (SCTP) port

PT_TCP 

Transmission Control Protocol (TCP) port

PT_UDP 

User Datagram Protocol (UDP) port

PT_DCCP 

Datagram Congestion Control Protocol (DCCP) port

PT_IPX 

IPX socket number

PT_DDP 

AppleTalk Datagram Delivery Protocol (DDP) connection

PT_IDP 

XNS Internet Datagram Protocol (IDP) socket number

PT_USB 

USB endpoint number; 0xffff denotes the host

PT_I2C 

I2C bus endpoint

PT_IBQP 

InfiniBand Queue Pair (QP) number

PT_BLUETOOTH 

Bluetooth endpoint

PT_IWARP_MPA 

iWARP Marker PDU Aligned (MPA) framing endpoint

PT_MCTP 

Management Component Transport Protocol (MCTP) endpoint

Function Documentation

◆ address_to_bytes()

WS_DLL_PUBLIC unsigned address_to_bytes ( const address addr,
uint8_t *  buf,
unsigned  buf_len 
)

Converts an address to a byte array.

This function takes an address structure and converts it into a byte array. The output buffer must be provided with sufficient space to hold the address data.

Parameters
addrPointer to the address structure to convert.
bufBuffer to store the converted byte array.
buf_lenLength of the output buffer.
Returns
Number of bytes copied to the buffer, or 0 if an error occurred.