Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Functions
uuid_types.c File Reference
#include "config.h"
#include <glib.h>
#include <epan/proto.h>
#include "uuid_types.h"

Classes

struct  _uuid_table_data_t
 

Macros

#define MAX_UUID_TYPE_VALUE   10
 

Typedefs

typedef struct _uuid_table_data_t uuid_table_data_t
 

Functions

void uuid_types_initialize (void)
 Initialize the UUID handling component.
 
int uuid_type_dissector_register (const char *name, GHashFunc hash_func, GEqualFunc key_equal_func, UUIDToString tostr_func)
 Register a UUID type for handling.
 
int uuid_type_get_id_by_name (const char *name)
 Get the ID of a registered UUID type.
 
void uuid_type_foreach (const char *name, GHFunc func, void *param)
 Process all of the UUIDs in the table.
 
void uuid_type_foreach_by_id (int id, GHFunc func, void *param)
 Process all of the UUIDs in the table.
 
void uuid_type_insert (int id, void *uuid, void *value)
 Insert a UUID with value into a table.
 
void * uuid_type_lookup (int id, void *uuid)
 Find value associated with UUID from table.
 
bool uuid_type_remove_if_present (int id, void *uuid)
 Remove UUID from table.
 
const char * uuid_type_get_uuid_name (const char *name, void *uuid, wmem_allocator_t *scope)
 Retrieve UUID "string name".
 

Detailed Description

UUID type handling

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

Function Documentation

◆ uuid_type_dissector_register()

int uuid_type_dissector_register ( const char *  name,
GHashFunc  hash_func,
GEqualFunc  key_equal_func,
UUIDToString  tostr_func 
)

Register a UUID type for handling.

Create a UUID type and provide its processing functions

Parameters
nameName of the UUID to be referenced by external components
hash_funcFunction to hash the UUID to a 32-bit value
key_equal_funcFunction to determine if two UUID values are equal
tostr_funcFunction that converts UUID into a friendly string value (may resolve to name)
Returns
Identifier to be used for subsequent calls of the UUID type

◆ uuid_type_foreach()

void uuid_type_foreach ( const char *  name,
GHFunc  func,
void *  param 
)

Process all of the UUIDs in the table.

Iterate through all of the UUIDs in the table with a callback function. The callback function is responsible for knowing the data structure of the UUID

Parameters
nameName of the UUID type
funcFunction to be called on each UUID
paramOptional data to be passed into the function as well

◆ uuid_type_foreach_by_id()

void uuid_type_foreach_by_id ( int  id,
GHFunc  func,
void *  param 
)

Process all of the UUIDs in the table.

Iterate through all of the UUIDs in the table with a callback function. The callback function is responsible for knowing the data structure of the UUID

Parameters
idIdentifier of the UUID type
funcFunction to be called on each UUID
paramOptional data to be passed into the function as well

◆ uuid_type_get_id_by_name()

int uuid_type_get_id_by_name ( const char *  name)

Get the ID of a registered UUID type.

Get the identifier of a registered UUID type to use for other API calls

Parameters
nameName of the UUID type
Returns
Identifier of the UUID type if found, 0 otherwise

◆ uuid_type_get_uuid_name()

const char * uuid_type_get_uuid_name ( const char *  name,
void *  uuid,
wmem_allocator_t scope 
)

Retrieve UUID "string name".

Convert UUID to a string value. What string returned is based on the identifier type. It may look up the UUID in its table or just know how to turn the datatype into a string

Parameters
nameName of the UUID type
uuidUUID to be converted to a string
scopememory scope the name should be returned in
Returns
Converted UUID string value, may be NULL if UUID isn't found in the table

◆ uuid_type_insert()

void uuid_type_insert ( int  id,
void *  uuid,
void *  value 
)

Insert a UUID with value into a table.

Adds a UUID to data value into the table. The data structure of the UUID and value are type dependent by the identifier

Parameters
idIdentifier of the UUID type table
uuidUUID key for the value
valueValue associated with UUID

◆ uuid_type_lookup()

void * uuid_type_lookup ( int  id,
void *  uuid 
)

Find value associated with UUID from table.

Lookup the UUID to find the associated data with it.The data structure of the UUID and value are type dependent by the identifier

Parameters
idIdentifier of the UUID type table
uuidUUID key for the value
Returns
UUID value if found, NULL otherwise

◆ uuid_type_remove_if_present()

bool uuid_type_remove_if_present ( int  id,
void *  uuid 
)

Remove UUID from table.

Remove the UUID from the table if found. The data structure of the UUID is type dependent by the identifier

Parameters
idIdentifier of the UUID type table
uuidUUID key to be removed
Returns
true if value was found and removed, false otherwise

◆ uuid_types_initialize()

void uuid_types_initialize ( void  )

Initialize the UUID handling component.

Called during epan initialization, this sets up the table for components to register their specific UUID handling