JSON: add seperate 3GPP file

Moving specific 3GPP keys handle to its own file
This will also enable custom JSON string dissector
This commit is contained in:
Joakim Karlsson 2022-05-30 09:47:40 +02:00 committed by AndersBroman
parent 0239242fb1
commit 00f4f4ee7d
4 changed files with 1070 additions and 953 deletions

View File

@ -431,6 +431,7 @@ set(DISSECTOR_PUBLIC_HEADERS
packet-isup.h
packet-its.h
packet-iwarp-ddp-rdmap.h
packet-json.h
packet-juniper.h
packet-jxta.h
packet-kerberos.h
@ -1344,6 +1345,7 @@ set(DISSECTOR_SRC
${CMAKE_CURRENT_SOURCE_DIR}/packet-jdwp.c
${CMAKE_CURRENT_SOURCE_DIR}/packet-jmirror.c
${CMAKE_CURRENT_SOURCE_DIR}/packet-jpeg.c
${CMAKE_CURRENT_SOURCE_DIR}/packet-json_3gpp.c
${CMAKE_CURRENT_SOURCE_DIR}/packet-json.c
${CMAKE_CURRENT_SOURCE_DIR}/packet-juniper.c
${CMAKE_CURRENT_SOURCE_DIR}/packet-jxta.c

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,61 @@
/* packet-json.h
* Routines for JSON dissection
* References:
* RFC 4627: https://tools.ietf.org/html/rfc4627
* Website: http://json.org/
*
* Copyright 2010, Jakub Zawadzki <darkjames-ws@darkjames.pl>
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef _PACKET_JSON_H
#define _PACKET_JSON_H
extern GHashTable *json_header_fields_hash;
/* json data decoding function
*/
typedef void(*json_data_decoder_func)(tvbuff_t* tvb, proto_tree* tree, packet_info* pinfo, int offset, int len, char* key_str, gboolean use_compact);
/* Array of functions to dissect IEs
*/
typedef struct _json_ie {
void(*json_data_decoder_func)(tvbuff_t* tvb, proto_tree* tree, packet_info* pinfo, int offset, int len, char* key_str, gboolean use_compact);
} json_ie_t;
/* A struct to hold the hf and callback function stored in a hastable with the json key as key.
* If the callback is null NULL the filter will be used useful to create filterable items in json.
* XXX Todo: Implement hte UAT from the http dissector to enable the users to create filters? and/or
* read config from file, similar to Diameter(filter only)?
*/
typedef struct {
int *hf_id;
json_data_decoder_func json_data_decoder;
} json_data_decoder_t;
typedef struct _json_key {
int offset;
int len;
char* key_str;
gboolean use_compact;
} json_key_t;
#endif /* _PACKET_JSON_H */
/*
* Editor modelines - https://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/

File diff suppressed because it is too large Load Diff