Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-epl.h
blob39c7cd15c5f198e32ba94ef9071be35c7afd2336
1 /* packet-epl.h
2 * Routines for "Ethernet POWERLINK 2.0" dissection
3 * (Ethernet POWERLINK V2.0 Communication Profile Specification Draft Standard Version 1.2.0)
5 * A dissector for:
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1999 Gerald Combs
10 * SPDX-License-Identifier: GPL-2.0-or-later
13 #ifndef __EPL_H_
14 #define __EPL_H_
16 #include <epan/address.h>
17 #include <epan/wmem_scopes.h>
18 #include <epan/range.h>
20 struct epl_datatype;
22 struct profile {
23 uint16_t id;
24 uint8_t nodeid;
25 address node_addr;
27 uint32_t vendor_id;
28 uint32_t product_code;
30 wmem_map_t *objects;
31 wmem_allocator_t *scope, *parent_scope;
32 wmem_map_t *parent_map;
34 char *name;
35 char *path;
36 void *data;
37 unsigned cb_id;
38 wmem_array_t *TPDO; /* CN->MN */
39 wmem_array_t *RPDO; /* MN->CN */
41 struct profile *next;
44 enum { OD_ENTRY_SCALAR = 7, OD_ENTRY_ARRAY = 8, OD_ENTRY_RECORD = 9 };
45 struct od_entry {
46 uint16_t idx;
47 /* This is called the ObjectType in the standard,
48 * but this is too easy to be mistaken with the
49 * DataType.
50 * ObjectType specifies whether it's a scalar or
51 * an aggregate
53 uint16_t type_class;
54 char name[64];
55 /* Called DataType by the standard,
56 * Can be e.g. Unsigned32
58 const struct epl_datatype *type;
59 uint64_t value;
61 #define OD_ENTRY_INITIALIZER { 0, 0, { 0 }, 0, 0 }
63 struct subobject {
64 range_admin_t range;
65 struct od_entry info;
67 #define SUBOBJECT_INITIALIZER { RANGE_ADMIN_T_INITIALIZER, OD_ENTRY_INITIALIZER }
69 typedef struct epl_wmem_iarray epl_wmem_iarray_t;
71 struct object {
72 struct od_entry info;
73 epl_wmem_iarray_t *subindices;
76 struct profile;
78 const struct epl_datatype *epl_type_to_hf(const char *name);
80 static inline gboolean
81 subobject_equal(const void *_a, const void *_b)
83 const struct od_entry *a = &((const struct subobject*)_a)->info;
84 const struct od_entry *b = &((const struct subobject*)_b)->info;
86 return a->type_class == b->type_class
87 && a->type == b->type
88 && g_str_equal(a->name, b->name);
91 struct profile *epl_xdd_load(struct profile *profile, const char *xml_file);
93 void epl_eds_init(void);
94 struct profile *epl_eds_load(struct profile *profile, const char *eds_file);
97 struct object *epl_profile_object_add(struct profile *profile, uint16_t idx);
98 struct object *epl_profile_object_lookup_or_add(struct profile *profile, uint16_t idx);
100 bool epl_profile_object_mapping_add(struct profile *profile, uint16_t idx, uint8_t subindex, uint64_t mapping);
101 bool epl_profile_object_mappings_update(struct profile *profile);
103 range_admin_t * epl_wmem_iarray_find(epl_wmem_iarray_t *arr, uint32_t value);
104 bool epl_wmem_iarray_is_empty(epl_wmem_iarray_t *iarr);
105 bool epl_wmem_iarray_is_sorted(epl_wmem_iarray_t *iarr);
107 #define EPL_OBJECT_MAPPING_SIZE ((unsigned)sizeof (uint64_t))
109 #define CHECK_OVERLAP_ENDS(x1, x2, y1, y2) ((x1) < (y2) && (y1) < (x2))
110 #define CHECK_OVERLAP_LENGTH(x, x_len, y, y_len) \
111 CHECK_OVERLAP_ENDS((x), (x) + (x_len), (y), (y) + (y_len))
114 #endif