File: lldp_dcbx_cmds.h

package info (click to toggle)
lldpad 1.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,184 kB
  • sloc: ansic: 47,370; sh: 2,006; lex: 1,037; makefile: 138
file content (161 lines) | stat: -rw-r--r-- 4,832 bytes parent folder | download | duplicates (4)
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
/*******************************************************************************

  LLDP Agent Daemon (LLDPAD) Software
  Copyright(c) 2007-2012 Intel Corporation.

  This program is free software; you can redistribute it and/or modify it
  under the terms and conditions of the GNU General Public License,
  version 2, as published by the Free Software Foundation.

  This program is distributed in the hope 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 St - Fifth Floor, Boston, MA 02110-1301 USA.

  The full GNU General Public License is included in this distribution in
  the file called "COPYING".

  Contact Information:
  open-lldp Mailing List <lldp-devel@open-lldp.org>

*******************************************************************************/

#ifndef CLIF_CMDS_H
#define CLIF_CMDS_H

#include <sys/un.h>
#include <stdbool.h>
#include "clif_msgs.h"

struct arg_handlers *dcbx_get_arg_handlers(void);
void dont_advertise_dcbx_all(char *ifname, bool ad);

#define CLIF_RSP_MSG_OFF    0

/* Client interface DCB command codes */
#define CMD_GET_CONFIG  1
#define CMD_SET_CONFIG  2
#define CMD_GET_OPER    3
#define CMD_GET_PEER    4

/* Client interface Feature codes */
#define FEATURE_DCB    1
#define FEATURE_PG     2
#define FEATURE_PFC    3
#define FEATURE_BCN    4
#define FEATURE_APP    5
#define FEATURE_LLINK  6
#define FEATURE_DCBX       0xfe
#define FEATURE_PG_DESC    0xff

/* DCB event message offsets (after port id field) */
#define EV_FEATURE_OFF      0
#define EV_SUBTYPE_OFF      2
#define EV_OP_MODE_CHG_OFF  4
#define EV_OP_CFG_CHG_OFF   5

/* Client interface DCB command message field offsets */
#define CLIF_CMD_OFF    0
#define CLIF_CMD_LEN    1
#define DCB_VER_OFF     (CLIF_CMD_OFF + CLIF_CMD_LEN)
#define DCB_VER_LEN     1
#define DCB_CMD_OFF     (DCB_VER_OFF + DCB_VER_LEN)
#define DCB_CMD_LEN     2
#define DCB_FEATURE_OFF (DCB_CMD_OFF + DCB_CMD_LEN)
#define DCB_FEATURE_LEN 2
#define DCB_SUBTYPE_OFF (DCB_FEATURE_OFF + DCB_FEATURE_LEN)
#define DCB_SUBTYPE_LEN 2
#define DCB_PORTLEN_OFF (DCB_SUBTYPE_OFF + DCB_SUBTYPE_LEN)
#define DCB_PORTLEN_LEN 2
#define DCB_PORT_OFF    (DCB_PORTLEN_OFF + DCB_PORTLEN_LEN)

/* DCBX configuration commands do not need to have a port field */
#define DCBX_CFG_OFF (DCB_FEATURE_OFF + DCB_FEATURE_LEN)

/* Offset into the DCB protocol data section of the client
 * interface message.
 * GetConfig and SetConfig commands */
#define CFG_ENABLE      0
#define CFG_ADVERTISE   1
#define CFG_WILLING     2
#define CFG_LEN         3

/* Offset into the DCB protocol data section of the client
 * interface message.
 * GetOper commands */
#define OPER_OPER_VER   0
#define OPER_MAX_VER    2
#define OPER_ERROR      4
#define OPER_OPER_MODE  6
#define OPER_SYNCD      7
#define OPER_LEN        8

/* Offset into the DCB protocol data section of the client
 * interface message.
 * GetPeer command */
#define PEER_ENABLE     0
#define PEER_WILLING    1
#define PEER_OPER_VER   2
#define PEER_MAX_VER    4
#define PEER_ERROR      6
#define PEER_SUBTYPE    7
#define PEER_LEN        8

/* DCB status data offset */
#define DCB_STATE       0

/* DCB State configuration data length */
#define CFG_DCB_DLEN    1

/* DCBX Version configuration data offset */
#define DCBX_VERSION  0

/* DCBX configuration data length
 * Does not include the Operational version */
#define CFG_DCBX_DLEN   1

/* Priority Flow Control configuration data offsets */
#define PFC_UP(i)         (i)
#define PFC_NUM_TC        (PFC_UP(8))

/* Priority Flow Control configuration data length */
#define CFG_PFC_DLEN      (PFC_NUM_TC+1)

/* Priority Groups configuration data offsets */
#define PG_UP2TC(i)       (i)
#define PG_PG_PCNT(i)     (PG_UP2TC(8)     + (2*i))
#define PG_UP_PGID(i)     (PG_PG_PCNT(8)   +    i)
#define PG_UP_PCNT(i)     (PG_UP_PGID(8)   + (2*i))
#define PG_UP_STRICT(i)   (PG_UP_PCNT(8)   +    i)
#define PG_UP_NUM_TC      (PG_UP_STRICT(8))

/* Priority Groups configuration data length */
#define CFG_PG_DLEN      (PG_UP_NUM_TC+1)

/* Application configuration data offsets */
#define APP_LEN           0
#define APP_DATA          2

/* Priority group description data offsets */
#define PG_DESC_PGID          0
#define PG_DESC_LEN           1
#define PG_DESC_DATA          3

#define PG_DESC_GET_DLEN      1
#define PG_DESC_SET_DLEN      3


/* Logical link data offsets */
#define LLINK_STATUS          0
#define LLINK_DLEN            1

#define CLIF_NOT_SUPPLIED 'x'

#define CHANGED   "changed"
#define NOCHANGE   "no change"

#endif /* CLIF_CMDS_H */