/******************************************************************************
** Copyright (C) 2006-2007 ascolab GmbH. All Rights Reserved.
** Web: http://www.ascolab.com
**
** SPDX-License-Identifier: GPL-2.0-or-later
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** Project: OpcUa Wireshark Plugin
**
** Description: Parser type definitions.
**
** This file was autogenerated on 6/10/2007 2:35:22 AM.
** DON'T MODIFY THIS FILE!
** XXX - well, except that you may have to.  See the README.
**
******************************************************************************/

#include <glib.h>
#include <epan/packet.h>

/**
 * @brief Callback type for parsing a top-level OPC UA service from a packet.
 *
 * @param tree   The protocol tree to which items are added.
 * @param tvb    The buffer containing the packet data.
 * @param pinfo  Packet metadata and context.
 * @param pOffset Current byte offset into the buffer; updated as data is consumed.
 */
typedef void (*fctServiceParser)(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int *pOffset);

/**
 * @brief Callback type for parsing an enumeration value from a packet.
 *
 * @param tree   The protocol tree to which items are added.
 * @param tvb    The buffer containing the packet data.
 * @param pinfo  Packet metadata and context.
 * @param pOffset Current byte offset into the buffer; updated as data is consumed.
 */
typedef void (*fctEnumParser)(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int *pOffset);

/**
 * @brief Callback type for parsing a named complex type field from a packet.
 *
 * @param tree        The protocol tree to which items are added.
 * @param tvb         The buffer containing the packet data.
 * @param pinfo       Packet metadata and context.
 * @param pOffset     Current byte offset into the buffer; updated as data is consumed.
 * @param szFieldName Display name of the field being parsed.
 */
typedef void (*fctComplexTypeParser)(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int *pOffset, const char *szFieldName);

/**
 * @brief Callback type for parsing a simple scalar type field from a packet.
 *
 * @param tree    The protocol tree to which items are added.
 * @param tvb     The buffer containing the packet data.
 * @param pinfo   Packet metadata and context.
 * @param pOffset Current byte offset into the buffer; updated as data is consumed.
 * @param hfIndex Header field index identifying the field to add to the tree.
 * @return        The newly created proto_item added to the tree.
 */
typedef proto_item* (*fctSimpleTypeParser)(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int *pOffset, int hfIndex);


/**
 * @brief Maps a service request ID to its corresponding parser callback.
 */
typedef struct _ParserEntry
{
    int iRequestId;          /**< Numeric identifier of the service request. */
    fctServiceParser pParser; /**< Parser function invoked for this request ID. */
} ParserEntry;


/**
 * @brief Maps an extension object type ID to its complex-type parser and type name.
 */
typedef struct _ExtensionObjectParserEntry
{
    int iRequestId;              /**< Numeric identifier of the extension object type. */
    fctComplexTypeParser pParser; /**< Parser function invoked for this extension object. */
    const char *typeName;         /**< Human-readable name of the extension object type. */
} ExtensionObjectParserEntry;
