2 * Routines for "Ethernet POWERLINK 2.0" dissection
3 * (Ethernet POWERLINK V2.0 Communication Profile Specification Draft Standard Version 1.2.0)
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
16 #include <epan/address.h>
17 #include <epan/wmem_scopes.h>
18 #include <epan/range.h>
28 uint32_t product_code
;
31 wmem_allocator_t
*scope
, *parent_scope
;
32 wmem_map_t
*parent_map
;
38 wmem_array_t
*TPDO
; /* CN->MN */
39 wmem_array_t
*RPDO
; /* MN->CN */
44 enum { OD_ENTRY_SCALAR
= 7, OD_ENTRY_ARRAY
= 8, OD_ENTRY_RECORD
= 9 };
47 /* This is called the ObjectType in the standard,
48 * but this is too easy to be mistaken with the
50 * ObjectType specifies whether it's a scalar or
55 /* Called DataType by the standard,
56 * Can be e.g. Unsigned32
58 const struct epl_datatype
*type
;
61 #define OD_ENTRY_INITIALIZER { 0, 0, { 0 }, 0, 0 }
67 #define SUBOBJECT_INITIALIZER { RANGE_ADMIN_T_INITIALIZER, OD_ENTRY_INITIALIZER }
69 typedef struct epl_wmem_iarray epl_wmem_iarray_t
;
73 epl_wmem_iarray_t
*subindices
;
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
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))