/src/wireshark/epan/dissectors/packet-epl.h
Line | Count | Source |
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 | | |
20 | | struct epl_datatype; |
21 | | |
22 | | struct 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 | | |
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 |
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 | 0 | #define OD_ENTRY_INITIALIZER { 0, 0, { 0 }, 0, 0 } |
62 | | |
63 | | struct subobject { |
64 | | range_admin_t range; |
65 | | struct od_entry info; |
66 | | }; |
67 | 0 | #define SUBOBJECT_INITIALIZER { RANGE_ADMIN_T_INITIALIZER, OD_ENTRY_INITIALIZER } |
68 | | |
69 | | typedef struct epl_wmem_iarray epl_wmem_iarray_t; |
70 | | |
71 | | struct object { |
72 | | struct od_entry info; |
73 | | epl_wmem_iarray_t *subindices; |
74 | | }; |
75 | | |
76 | | struct profile; |
77 | | |
78 | | const struct epl_datatype *epl_type_to_hf(const char *name); |
79 | | |
80 | | static inline gboolean |
81 | | subobject_equal(const void *_a, const void *_b) |
82 | 0 | { |
83 | 0 | const struct od_entry *a = &((const struct subobject*)_a)->info; |
84 | 0 | const struct od_entry *b = &((const struct subobject*)_b)->info; |
85 | |
|
86 | 0 | return a->type_class == b->type_class |
87 | 0 | && a->type == b->type |
88 | 0 | && g_str_equal(a->name, b->name); |
89 | 0 | } Unexecuted instantiation: packet-epl.c:subobject_equal Unexecuted instantiation: packet-epl-profile-parser.c:subobject_equal |
90 | | |
91 | | struct profile *epl_xdd_load(struct profile *profile, const char *xml_file); |
92 | | |
93 | | void epl_eds_init(void); |
94 | | struct profile *epl_eds_load(struct profile *profile, const char *eds_file); |
95 | | |
96 | | |
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); |
99 | | |
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); |
102 | | |
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); |
106 | | |
107 | 0 | #define EPL_OBJECT_MAPPING_SIZE ((unsigned)sizeof (uint64_t)) |
108 | | |
109 | 4.99k | #define CHECK_OVERLAP_ENDS(x1, x2, y1, y2) ((x1) < (y2) && (y1) < (x2)) |
110 | | #define CHECK_OVERLAP_LENGTH(x, x_len, y, y_len) \ |
111 | 2.18k | CHECK_OVERLAP_ENDS((x), (x) + (x_len), (y), (y) + (y_len)) |
112 | | |
113 | | |
114 | | #endif |