| Wireshark 4.7.0 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Functions
guid-utils.h File Reference
`#include <stdint.h>`
`#include "ws_symbol_export.h"`
`#include <epan/wmem_scopes.h>`

Go to the source code of this file.

## Classes
struct | _e_guid_t

## Macros
#define | GUID_LEN 16

## Typedefs
typedef struct _e_guid_t | e_guid_t

## Functions
WS_DLL_PUBLIC void | guids_init (void)
| Initialize the GUID handling component.
WS_DLL_PUBLIC void | guids_add_guid (const e_guid_t *guid, const char *name)
| Add a GUID.
WS_DLL_PUBLIC void | guids_delete_guid (const e_guid_t *guid)
| Remove a GUID to name mapping.
WS_DLL_PUBLIC const char * | guids_get_guid_name (const e_guid_t *guid, wmem_allocator_t *scope)
| Retrieve name for GUID value.
WS_DLL_PUBLIC const char * | guids_resolve_guid_to_str (const e_guid_t *guid, wmem_allocator_t *scope)
| Retrieve name for GUID value.
WS_DLL_PUBLIC int | guid_cmp (const e_guid_t *g1, const e_guid_t *g2)
| Compare two GUID values.
WS_DLL_PUBLIC unsigned | guid_hash (const e_guid_t *guid)
| Created 32-bit hash value for GUID.

## Detailed Description

Definitions for GUID 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

## ◆ guid_cmp()

WS_DLL_PUBLIC int guid_cmp | ( | const e_guid_t * | g1,
|  | const e_guid_t * | g2
| ) |  |

Compare two GUID values.

Compare two GUID values for sorting purposes

Parameters

  g1 | First GUID value
  g2 | Second GUID value

Returns
  1 if g1 > g2, -1 if g1 < g2, 0 if g1 == g2

## ◆ guid_hash()

WS_DLL_PUBLIC unsigned guid_hash | ( | const e_guid_t * | guid | ) |

Created 32-bit hash value for GUID.

Take the first 8 bytes of the GUID and create hash value from it

Parameters

  guid | GUID value to hash

Returns
  Hash value for GUID

## ◆ guids_add_guid()

WS_DLL_PUBLIC void guids_add_guid | ( | const e_guid_t * | guid,
|  | const char * | name
| ) |  |

Add a GUID.

Adds the GUID to name mapping item

Parameters

  guid | GUID value
  name | Friendly name associated with the GUID

## ◆ guids_delete_guid()

WS_DLL_PUBLIC void guids_delete_guid | ( | const e_guid_t * | guid | ) |

Remove a GUID to name mapping.

Remove the GUID to name mapping item from the current table

Parameters

  guid | GUID value

## ◆ guids_get_guid_name()

WS_DLL_PUBLIC const char * guids_get_guid_name | ( | const e_guid_t * | guid,
|  | wmem_allocator_t * | scope
| ) |  |

Retrieve name for GUID value.

Retrieve the registered name for this GUID; uses the scope for the fallback case only

Parameters

  guid | GUID value
  scope | memory scope the name should be returned in

Returns
  GUID name if found, NULL otherwise

## ◆ guids_init()

WS_DLL_PUBLIC void guids_init | ( | void |  | ) |

Initialize the GUID handling component.

Called during epan initialization, this sets up the GUID table for looked via the UUID type API

## ◆ guids_resolve_guid_to_str()

WS_DLL_PUBLIC const char * guids_resolve_guid_to_str | ( | const e_guid_t * | guid,
|  | wmem_allocator_t * | scope
| ) |  |

Retrieve name for GUID value.

Tries to match a guid against its name, returns the associated string ptr on a match. Formats uuid number and returns the resulting string via wmem scope, if name is unknown.

(if you need hex string only, use guid_to_str instead)

Parameters

  guid | GUID value
  scope | memory scope the name should be returned in

Returns
  GUID name if found, hex string otherwise