Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-cose.h
blob886a3a8426e24a36f697b10a71eff0011482c6de
1 /* packet-cose.h
2 * Definitions for CBOR Object Signing and Encryption (COSE) dissection
3 * References:
4 * RFC 9052: https://tools.ietf.org/html/rfc9052
6 * Copyright 2019-2021, Brian Sipos <brian.sipos@gmail.com>
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <gerald@wireshark.org>
10 * Copyright 1998 Gerald Combs
12 * SPDX-License-Identifier: LGPL-2.1-or-later
14 #ifndef __PACKET_COSE_H__
15 #define __PACKET_COSE_H__
17 #include <glib.h>
19 /**
20 * COSE message dissectors are registered multiple ways:
21 * 1. The unit-keyed dissector table "cose.msgtag" with keys being
22 * IANA-registered CBOR tag values (e.g., 18 is COSE_Sign1).
23 * 2. The string-keyed dissector table "media_type" with the IANA-registered
24 * key "application/cose" and subtypes registered in dissector table
25 * "cose.mediasub" (e.g., "cose-sign1" is COSE_Sign1).
26 * 3. The registered dissectors for names "cose" and message names in
27 * all-lowercase form (e.g., "cose_sign1").
29 * COSE message dissectors use the tag (wscbor_tag_t *) value, if used to
30 * discriminate the message type, as the user data pointer.
32 * COSE header label dissectors are registered with the dissector table
33 * "cose.header" and key parameter dissectors with the table "cose.keyparam"
34 * both with cose_param_key_t* keys.
35 * The header/parameter dissectors use a cose_header_context_t* as the user
36 * data pointer.
38 * An additional dissector "cose.msg.headers" will dissect an individual
39 * header map structure outside of a COSE message.
42 // A header parameter or key-type parameter key
43 typedef struct {
44 /// The Algorithm or Key Type context or NULL for
45 /// all-context keys.
46 GVariant *principal;
48 /// Label simple value (int or tstr) as variant.
49 /// Object owned by this struct.
50 GVariant *label;
51 } cose_param_key_t;
53 /** Compatible with GHashFunc signature.
55 unsigned cose_param_key_hash(const void *ptr);
57 /** Compatible with GEqualFunc signature.
59 gboolean cose_param_key_equal(const void *a, const void *b);
61 /** Compatible with GDestroyNotify signature.
63 void cose_param_key_free(void *ptr);
65 /// User data for header/key-parameter dissectors
66 typedef struct {
67 /// Principal value (alg or kty) of the map, if defined.
68 GVariant *principal;
69 /// Current label being processed
70 GVariant *label;
71 } cose_header_context_t;
73 #endif /* __PACKET_COSE_H__ */