Wireshark 5.1.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
packet-epl.h
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)
4 *
5 * A dissector for:
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1999 Gerald Combs
9 *
10 * SPDX-License-Identifier: GPL-2.0-or-later
11 */
12
13#ifndef __EPL_H_
14#define __EPL_H_
15
16#include <epan/address.h>
17#include <epan/wmem_scopes.h>
18#include <epan/range.h>
19
20struct epl_datatype;
21
22struct profile {
23 uint16_t id;
24 uint8_t nodeid;
25 address node_addr;
26
27 uint32_t vendor_id;
28 uint32_t product_code;
29
30 wmem_map_t *objects;
31 wmem_allocator_t *scope, *parent_scope;
32 wmem_map_t *parent_map;
33
34 char *name;
35 char *path;
36 void *data;
37 unsigned cb_id;
38 /* a shallow copy in the scope of another profile, freed with it */
39 bool is_clone;
40 wmem_array_t *TPDO; /* CN->MN */
41 wmem_array_t *RPDO; /* MN->CN */
42
43 struct profile *next;
44};
45
46enum { OD_ENTRY_SCALAR = 7, OD_ENTRY_ARRAY = 8, OD_ENTRY_RECORD = 9 };
47struct od_entry {
48 uint16_t idx;
49 /* This is called the ObjectType in the standard,
50 * but this is too easy to be mistaken with the
51 * DataType.
52 * ObjectType specifies whether it's a scalar or
53 * an aggregate
54 */
55 uint16_t type_class;
56 char name[64];
57 /* Called DataType by the standard,
58 * Can be e.g. Unsigned32
59 */
60 const struct epl_datatype *type;
61 uint64_t value;
62};
63#define OD_ENTRY_INITIALIZER { 0, 0, { 0 }, 0, 0 }
64
65struct subobject {
66 range_admin_t range;
67 struct od_entry info;
68};
69#define SUBOBJECT_INITIALIZER { RANGE_ADMIN_T_INITIALIZER, OD_ENTRY_INITIALIZER }
70
71typedef struct epl_wmem_iarray epl_wmem_iarray_t;
72
73struct object {
74 struct od_entry info;
75 epl_wmem_iarray_t *subindices;
76};
77
78struct profile;
79
80const struct epl_datatype *epl_type_to_hf(const char *name);
81
82static inline gboolean
83subobject_equal(const void *_a, const void *_b)
84{
85 const struct od_entry *a = &((const struct subobject*)_a)->info;
86 const struct od_entry *b = &((const struct subobject*)_b)->info;
87
88 return a->type_class == b->type_class
89 && a->type == b->type
90 && g_str_equal(a->name, b->name);
91}
92
93struct profile *epl_xdd_load(struct profile *profile, const char *xml_file);
94
95void epl_eds_init(void);
96struct profile *epl_eds_load(struct profile *profile, const char *eds_file);
97
98
99struct object *epl_profile_object_add(struct profile *profile, uint16_t idx);
100struct object *epl_profile_object_lookup_or_add(struct profile *profile, uint16_t idx);
101
102bool epl_profile_object_mapping_add(struct profile *profile, uint16_t idx, uint8_t subindex, uint64_t mapping);
103bool epl_profile_object_mappings_update(struct profile *profile);
104
105range_admin_t * epl_wmem_iarray_find(epl_wmem_iarray_t *arr, uint32_t value);
106bool epl_wmem_iarray_is_empty(epl_wmem_iarray_t *iarr);
107bool epl_wmem_iarray_is_sorted(epl_wmem_iarray_t *iarr);
108
109#define EPL_OBJECT_MAPPING_SIZE ((unsigned)sizeof (uint64_t))
110
111#define CHECK_OVERLAP_ENDS(x1, x2, y1, y2) ((x1) < (y2) && (y1) < (x2))
112#define CHECK_OVERLAP_LENGTH(x, x_len, y, y_len) \
113 CHECK_OVERLAP_ENDS((x), (x) + (x_len), (y), (y) + (y_len))
114
115
116#endif
struct _address address
Holds a network or link-layer address of any supported type.
struct _wmem_array_t wmem_array_t
Opaque type representing a dynamically resizable array in the wmem system.
Definition wmem_array.h:42
struct _wmem_map_t wmem_map_t
Opaque type representing a wmem-managed hash map.
Definition wmem_map.h:46
struct _wmem_allocator_t wmem_allocator_t
Definition wmem_core.h:44
struct range_admin_tag range_admin_t
Represents a single contiguous range of unsigned integer values with an inclusive lower and upper bou...
Definition packet-epl-profile-parser.c:122
Definition file-pcapng.h:57
Definition packet-epl.h:73
Definition packet-epl.h:47
Definition packet-epl.h:22
Definition packet-epl.h:65