-
Notifications
You must be signed in to change notification settings - Fork 0
/
packet-epl.h
112 lines (94 loc) · 3.1 KB
/
packet-epl.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/* packet-epl.h
* Routines for "Ethernet POWERLINK 2.0" dissection
* (Ethernet POWERLINK V2.0 Communication Profile Specification Draft Standard Version 1.2.0)
*
* A dissector for:
* Wireshark - Network traffic analyzer
* By Gerald Combs <[email protected]>
* Copyright 1999 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef WIRESHARK_PACKET_EPL_H_
#define WIRESHARK_PACKET_EPL_H_
#include <glib.h>
#include <epan/address.h>
#include <epan/wmem/wmem.h>
#include "wmem_iarray.h"
#ifdef __GNUC__
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#pragma GCC diagnostic ignored "-Wmissing-braces"
#endif
gboolean epl_g_int16_equal(gconstpointer v1, gconstpointer v2);
guint epl_g_int16_hash(gconstpointer v);
struct epl_datatype;
const struct epl_datatype *epl_type_to_hf(const char *name);
struct profile {
guint16 id;
guint8 nodeid;
address node_addr;
guint32 VendorId;
guint32 ProductCode;
wmem_map_t *objects;
wmem_allocator_t *scope, *parent_scope;
wmem_map_t *parent_map;
char *name;
char *path;
void *data;
guint cb_id;
wmem_array_t *TPDO; /* CN->MN */
wmem_array_t *RPDO; /* MN->CN */
struct profile *next;
};
#define OD_ENTRY_NO_SUBINDICES 7
struct od_entry {
guint16 idx;
/* This is called the ObjectType in the standard,
* but this is too easy to be mistaken with the
* DataType.
* ObjectType specifies whether it's a scalar or
* an aggregate
*/
guint8 type_class;
char name[64];
/* Called DataType by the standard,
* Can be e.g. Unsigned32
*/
const struct epl_datatype *type;
guint64 value;
};
struct subobject {
range_admin_t range;
struct od_entry info;
};
gboolean subobject_equal(gconstpointer, gconstpointer);
struct object {
struct od_entry info;
epl_wmem_iarray_t *subindices;
};
struct object *profile_object_add(struct profile *profile, guint16 idx);
struct object *profile_object_lookup_or_add(struct profile *profile, guint16 idx);
gboolean profile_object_mapping_add(struct profile *profile, guint16 idx, guint8 subindex, guint64 mapping);
gboolean profile_object_mappings_update(struct profile *profile);
struct object * object_lookup(struct profile *profile, guint16 idx);
#define CHECK_OVERLAP_ENDS(x1, x2, y1, y2) ((x1) < (y2) && (y1) < (x2))
#define CHECK_OVERLAP_LENGTH(x, x_len, y, y_len) \
CHECK_OVERLAP_ENDS((x), (x) + (x_len), (y), (y) + (y_len))
#if GLIB_CHECK_VERSION(2, 40, 0)
#define EPL_INFO(...) g_info(__VA_ARGS__)
#else
#define EPL_INFO(...)
#endif
#endif