Wireshark 4.5.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 <[email protected]>
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 wmem_array_t *TPDO; /* CN->MN */
39 wmem_array_t *RPDO; /* MN->CN */
40
41 struct profile *next;
42};
43
44enum { OD_ENTRY_SCALAR = 7, OD_ENTRY_ARRAY = 8, OD_ENTRY_RECORD = 9 };
45struct 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
52 */
53 uint16_t type_class;
54 char name[64];
55 /* Called DataType by the standard,
56 * Can be e.g. Unsigned32
57 */
58 const struct epl_datatype *type;
59 uint64_t value;
60};
61#define OD_ENTRY_INITIALIZER { 0, 0, { 0 }, 0, 0 }
62
63struct subobject {
64 range_admin_t range;
65 struct od_entry info;
66};
67#define SUBOBJECT_INITIALIZER { RANGE_ADMIN_T_INITIALIZER, OD_ENTRY_INITIALIZER }
68
70
71struct object {
72 struct od_entry info;
73 epl_wmem_iarray_t *subindices;
74};
75
76struct profile;
77
78const struct epl_datatype *epl_type_to_hf(const char *name);
79
80static inline gboolean
81subobject_equal(const void *_a, const void *_b)
82{
83 const struct od_entry *a = &((const struct subobject*)_a)->info;
84 const struct od_entry *b = &((const struct subobject*)_b)->info;
85
86 return a->type_class == b->type_class
87 && a->type == b->type
88 && g_str_equal(a->name, b->name);
89}
90
91struct profile *epl_xdd_load(struct profile *profile, const char *xml_file);
92
93void epl_eds_init(void);
94struct profile *epl_eds_load(struct profile *profile, const char *eds_file);
95
96
97struct object *epl_profile_object_add(struct profile *profile, uint16_t idx);
98struct object *epl_profile_object_lookup_or_add(struct profile *profile, uint16_t idx);
99
100bool epl_profile_object_mapping_add(struct profile *profile, uint16_t idx, uint8_t subindex, uint64_t mapping);
101bool epl_profile_object_mappings_update(struct profile *profile);
102
103range_admin_t * epl_wmem_iarray_find(epl_wmem_iarray_t *arr, uint32_t value);
104bool epl_wmem_iarray_is_empty(epl_wmem_iarray_t *iarr);
105bool epl_wmem_iarray_is_sorted(epl_wmem_iarray_t *iarr);
106
107#define EPL_OBJECT_MAPPING_SIZE ((unsigned)sizeof (uint64_t))
108
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))
112
113
114#endif
Definition address.h:56
Definition wmem_allocator.h:27
Definition wmem_array.c:27
Definition wmem_map.c:44
Definition packet-epl-profile-parser.c:126
Definition file-pcapng.h:57
Definition packet-epl.h:71
Definition packet-epl.h:45
Definition packet-epl.h:22
Definition range.h:34
Definition packet-epl.h:63