RDK-B
vlan_eth_hal.h
Go to the documentation of this file.
1 /**
2 * @file vlan_eth_hal.h
3 * @brief For CCSP Component: VLAN Termination HAL Layer
4 *
5 * @description This file gives the function prototypes used for the RDK-Broadband
6 * Ethernet VLAN abstraction layer
7 */
8 
9 /*
10  * If not stated otherwise in this file or this component's Licenses.txt file the
11  * following copyright and licenses apply:
12  *
13  * Copyright 2019 RDK Management
14  *
15  * Licensed under the Apache License, Version 2.0 (the "License");
16  * you may not use this file except in compliance with the License.
17  * You may obtain a copy of the License at
18  *
19  * http://www.apache.org/licenses/LICENSE-2.0
20  *
21  * Unless required by applicable law or agreed to in writing, software
22  * distributed under the License is distributed on an "AS IS" BASIS,
23  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24  * See the License for the specific language governing permissions and
25  * limitations under the License.
26 */
27 
28 /**********************************************************************
29 
30  module: vlan_eth_hal.h
31 
32  For CCSP Component: VLAN Termination HAL Layer
33 
34  ---------------------------------------------------------------
35 
36  description:
37 
38  This header file gives the function call prototypes and
39  structure definitions used for the RDK-Broadband
40  VLAN abstraction layer
41 
42  NOTE:
43  THIS VERSION IS AN EARLY DRAFT INTENDED TO GET COMMENTS FROM COMCAST.
44  TESTING HAS NOT YET BEEN COMPLETED.
45 
46  ---------------------------------------------------------------
47 
48  environment:
49 
50  This HAL layer is intended to support VLAN drivers
51  through the System Calls.
52 
53  ---------------------------------------------------------------
54 
55  author:
56 
57 **********************************************************************/
58 
59 #ifndef __VLAN_ETH_HAL_H__
60 #define __VLAN_ETH_HAL_H__
61 
62 #include <stdio.h>
63 #include <stdlib.h>
64 #include <string.h>
65 
66 #ifndef ULONG
67 #define ULONG unsigned long
68 #endif
69 
70 #ifndef BOOL
71 #define BOOL unsigned char
72 #endif
73 
74 #ifndef CHAR
75 #define CHAR char
76 #endif
77 
78 #ifndef UCHAR
79 #define UCHAR unsigned char
80 #endif
81 
82 #ifndef INT
83 #define INT int
84 #endif
85 
86 #ifndef UINT
87 #define UINT unsigned int
88 #endif
89 
90 #ifndef TRUE
91 #define TRUE 1
92 #endif
93 
94 #ifndef FALSE
95 #define FALSE 0
96 #endif
97 
98 #ifndef ENABLE
99 #define ENABLE 1
100 #endif
101 
102 #ifndef RETURN_OK
103 #define RETURN_OK 0
104 #endif
105 
106 #ifndef RETURN_ERR
107 #define RETURN_ERR -1
108 #endif
109 
110 //defines for HAL version 1.0
111 #define VLAN_ETH_HAL_MAJOR_VERSION 1 // This is the major verion of this HAL.
112 #define VLAN_ETH_HAL_MINOR_VERSION 0 // This is the minor verson of the HAL.
113 #define VLAN_ETH_HAL_MAINTENANCE_VERSION 1 // This is the maintenance version of the HAL.
114 
115 /**********************************************************************
116  ENUMERATION DEFINITIONS
117 **********************************************************************/
118 // Enumerator for VLAN interface status
119 typedef enum {
120  VLAN_IF_UP = 1,
121  VLAN_IF_DOWN,
128 
129 /**********************************************************************
130  STRUCTURE DEFINITIONS
131 **********************************************************************/
132 typedef struct _VLAN_SKB_CONFIG
133 {
134  char alias[32]; /* Indicates DATA or VOICE */
135  unsigned int skbMark; /* SKB Marking Value. */
136  unsigned int skbPort; /* SKB Marking Port */
137  unsigned int skbEthPriorityMark; /* SKB Ethernet Priority. */
139 
140 // Structure for VLAN configuration
141 typedef struct _vlan_configuration
142 {
143  CHAR L2Interface[64]; /* L2interface like eth3, ptm0 */
144  CHAR L3Interface[64]; /* L3 interface like erouter0. */
145  INT VLANId; /* Vlan Id */
146  UINT TPId; /* Vlan tag protocol identifier. */
147  vlan_interface_status_e Status; /* vlan interface status */
148  UINT skbMarkingNumOfEntries; /* Number of SKB marking entries. */
149  vlan_skb_config_t *skb_config; /* SKB Marking Data. */
150  BOOL doReconfigure; /* Reconfiguring the interface, FALSE -> Create and configure, TRUE -> Reconfigure interface. */
152 
153 /**********************************************************************
154  *
155  * VLAN ETH HAL function prototypes
156  *
157 ***********************************************************************/
158 
159 /**
160 * @description This HAL is used to initialize the vlan hal client. Connected to rpc
161 * server to send/receive data.
162 * @param vlan_configuration_t config - vlanconfiguration data
163 *
164 * @return The status of the operation.
165 * @retval RETURN_OK if successful (or) RETURN_OK If interface is already exist with given config data
166 * @retval RETURN_ERR if any error is detected
167 *
168 * @execution Synchronous.
169 * @sideeffect None.
170 *
171 */
173 
174 /**
175 * @description This HAL is used to create and configure an vlan interface and assign the vlanID. This
176 * HAL also used to reconfigure the vlan interface incase if any update in SKB marking configuration.
177 * This is being handled by `config->doReconfigure` flag in the vlan_configuration_t. If this flag TRUE,
178 * indicates, reconfigure required and it will update vlan rules on the existing interface. If it FALSE,
179 * create and configure the vlan interface.
180 * @param vlan_configuration_t config - vlanconfiguration data
181 *
182 * @return The status of the operation.
183 * @retval RETURN_OK if successful (or) RETURN_OK If interface is already exist with given config data
184 * @retval RETURN_ERR if any error is detected
185 *
186 * @execution Synchronous.
187 * @sideeffect None.
188 *
189 */
191 
192 /**
193 * @description This HAL is used to deassociate an existing vlan interface
194 * @param const char *vlan_ifname - interface name
195 *
196 * @return The status of the operation.
197 * @retval RETURN_OK if successful (or) RETURN_OK If interface is not exist
198 * @retval RETURN_ERR if any error is detected
199 *
200 * @execution Synchronous.
201 * @sideeffect None.
202 *
203 */
204 int vlan_eth_hal_deleteInterface(const char *vlan_ifname);
205 
206 /**
207 * @description This HAL is used to get current status of an vlan interface
208 * @param vlan configuration data
209 *
210 * @return The status of the operation.
211 * @retval RETURN_OK if successful
212 * @retval RETURN_ERR if any error is detected
213 *
214 * @execution Synchronous.
215 * @sideeffect None.
216 *
217 */
218 int vlan_eth_hal_getInterfaceStatus(const char *vlan_ifname, vlan_interface_status_e *status);
219 #endif /*__VLAN_ETH_HAL_H__*/
VLAN_IF_DOWN
@ VLAN_IF_DOWN
Definition: vlan_eth_hal.h:123
vlan_eth_hal_getInterfaceStatus
int vlan_eth_hal_getInterfaceStatus(const char *vlan_ifname, vlan_interface_status_e *status)
VLAN_IF_UNKNOWN
@ VLAN_IF_UNKNOWN
Definition: vlan_eth_hal.h:124
vlan_eth_hal_deleteInterface
int vlan_eth_hal_deleteInterface(const char *vlan_ifname)
_VLAN_SKB_CONFIG::alias
char alias[32]
Definition: vlan_eth_hal.h:136
_VLAN_SKB_CONFIG::skbMark
unsigned int skbMark
Definition: vlan_eth_hal.h:137
VLAN_IF_DORMANT
@ VLAN_IF_DORMANT
Definition: vlan_eth_hal.h:125
vlan_eth_hal_init
int vlan_eth_hal_init()
_VLAN_SKB_CONFIG
Definition: vlan_eth_hal.h:132
VLAN_IF_NOTPRESENT
@ VLAN_IF_NOTPRESENT
Definition: vlan_eth_hal.h:126
_VLAN_SKB_CONFIG::skbEthPriorityMark
unsigned int skbEthPriorityMark
Definition: vlan_eth_hal.h:139
VLAN_IF_ERROR
@ VLAN_IF_ERROR
Definition: vlan_eth_hal.h:128
_vlan_configuration::L2Interface
char L2Interface[64]
Definition: vlan_eth_hal.h:143
_VLAN_SKB_CONFIG::skbPort
unsigned int skbPort
Definition: vlan_eth_hal.h:138
_vlan_configuration::TPId
unsigned int TPId
Definition: vlan_eth_hal.h:146
UINT
#define UINT
Definition: vlan_eth_hal.h:87
INT
#define INT
Definition: vlan_eth_hal.h:83
_vlan_configuration::Status
vlan_interface_status_e Status
Definition: vlan_eth_hal.h:147
_vlan_configuration::VLANId
int VLANId
Definition: vlan_eth_hal.h:145
VLAN_IF_UP
@ VLAN_IF_UP
Definition: vlan_eth_hal.h:122
_vlan_configuration::skb_config
vlan_skb_config_t * skb_config
Definition: vlan_eth_hal.h:149
vlan_skb_config_t
struct _VLAN_SKB_CONFIG vlan_skb_config_t
CHAR
#define CHAR
Definition: vlan_eth_hal.h:75
vlan_eth_hal_configureInterface
int vlan_eth_hal_configureInterface(vlan_configuration_t *config)
_vlan_configuration::L3Interface
char L3Interface[64]
Definition: vlan_eth_hal.h:144
_vlan_configuration
Definition: vlan_eth_hal.h:141
vlan_configuration_t
struct _vlan_configuration vlan_configuration_t
_vlan_configuration::skbMarkingNumOfEntries
unsigned int skbMarkingNumOfEntries
Definition: vlan_eth_hal.h:148
BOOL
#define BOOL
Definition: vlan_eth_hal.h:71
_vlan_configuration::doReconfigure
unsigned char doReconfigure
Definition: vlan_eth_hal.h:150
VLAN_IF_LOWERLAYERDOWN
@ VLAN_IF_LOWERLAYERDOWN
Definition: vlan_eth_hal.h:127
vlan_interface_status_e
vlan_interface_status_e
Definition: vlan_eth_hal.h:119