-
Notifications
You must be signed in to change notification settings - Fork 1
/
otaiapsport.h
271 lines (242 loc) · 7.06 KB
/
otaiapsport.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
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
/**
* Copyright (c) 2021 Alibaba Group.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may obtain
* a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT
* LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS
* FOR A PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT.
*
* See the Apache Version 2.0 License for specific language governing
* permissions and limitations under the License.
*
* @file otaiapsport.h
* @brief This module defines the APSPORT for the OTAI
*/
#if !defined (__OTAIAPSPORT_H_)
#define __OTAIAPSPORT_H_
#include <otaitypes.h>
/**
* @defgroup OTAIAPSPORT OTAI - APSPORT specific API definitions
*
* @{
*/
/** @brief APSPORT port type */
typedef enum _otai_apsport_port_type_t
{
OTAI_APSPORT_PORT_TYPE_LINE_PRIMARY_IN,
OTAI_APSPORT_PORT_TYPE_LINE_SECONDARY_IN,
OTAI_APSPORT_PORT_TYPE_COMMON_IN,
OTAI_APSPORT_PORT_TYPE_LINE_PRIMARY_OUT,
OTAI_APSPORT_PORT_TYPE_LINE_SECONDARY_OUT,
OTAI_APSPORT_PORT_TYPE_COMMON_OUTPUT
} otai_apsport_port_type_t;
/**
* @brief APSPORT attribute IDs
*/
typedef enum _otai_apsport_attr_t
{
/**
* @brief Start of attributes
*/
OTAI_APSPORT_ATTR_START,
/**
* @brief ID
*
* @type otai_uint32_t
* @flags MANDATORY_ON_CREATE | CREATE_ONLY
*/
OTAI_APSPORT_ATTR_ID = OTAI_APSPORT_ATTR_START,
/**
* @brief Port type
*
* @type otai_apsport_port_type_t
* @flags MANDATORY_ON_CREATE | CREATE_ONLY
*/
OTAI_APSPORT_ATTR_PORT_TYPE,
/**
* @brief Power LOS threshold
*
* @type otai_double_t
* @flags READ_ONLY
*/
OTAI_APSPORT_ATTR_POWER_LOS_THRESHOLD,
/**
* @brief Power low threshold
*
* @type otai_double_t
* @flags CREATE_AND_SET
*/
OTAI_APSPORT_ATTR_POWER_LOW_THRESHOLD,
/**
* @brief Enabled
*
* @type bool
* @flags CREATE_AND_SET
*/
OTAI_APSPORT_ATTR_ENABLED,
/**
* @brief Target attenuation
*
* @type otai_double_t
* @flags CREATE_AND_SET
*/
OTAI_APSPORT_ATTR_TARGET_ATTENUATION,
/**
* @brief End of attributes
*/
OTAI_APSPORT_ATTR_END,
/** Custom range base value */
OTAI_APSPORT_ATTR_CUSTOM_RANGE_START = 0x10000000,
/** End of custom range base */
OTAI_APSPORT_ATTR_CUSTOM_RANGE_END
} otai_apsport_attr_t;
/**
* @brief APSPORT stat IDs
*
* @flags Contains flags
*/
typedef enum _otai_apsport_stat_t
{
/**
* @brief Start of statistics
*/
OTAI_APSPORT_STAT_START,
/**
* @brief Optical power
*
* @type otai_double_t
* @unit dBm
* @precision precision2
* @iscounter false
*/
OTAI_APSPORT_STAT_OPTICAL_POWER = OTAI_APSPORT_STAT_START,
/**
* @brief Attenuation
*
* @type otai_double_t
* @unit dB
* @precision precision2
* @iscounter false
*/
OTAI_APSPORT_STAT_ATTENUATION,
/**
* @brief End of statistics
*/
OTAI_APSPORT_STAT_END,
} otai_apsport_stat_t;
/**
* @brief Create APSPORT.
*
* Allocates and initializes a APSPORT.
*
* @param[out] apsport_id APSPORT id
* @param[in] linecard_id Linecard id on which the APSPORT exists
* @param[in] attr_count Number of attributes
* @param[in] attr_list Array of attributes
*
* @return #OTAI_STATUS_SUCCESS on success, failure status code on error
*/
typedef otai_status_t (*otai_create_apsport_fn)(
_Out_ otai_object_id_t *apsport_id,
_In_ otai_object_id_t linecard_id,
_In_ uint32_t attr_count,
_In_ const otai_attribute_t *attr_list);
/**
* @brief Remove APSPORT
*
* @param[in] apsport_id APSPORT id
*
* @return #OTAI_STATUS_SUCCESS on success, failure status code on error
*/
typedef otai_status_t (*otai_remove_apsport_fn)(
_In_ otai_object_id_t apsport_id);
/**
* @brief Set APSPORT attribute
*
* @param[in] apsport_id APSPORT id
* @param[in] attr Attribute
*
* @return #OTAI_STATUS_SUCCESS on success, failure status code on error
*/
typedef otai_status_t (*otai_set_apsport_attribute_fn)(
_In_ otai_object_id_t apsport_id,
_In_ const otai_attribute_t *attr);
/**
* @brief Get APSPORT attribute
*
* @param[in] apsport_id APSPORT id
* @param[in] attr_count Number of attributes
* @param[inout] attr_list Array of attributes
*
* @return #OTAI_STATUS_SUCCESS on success, failure status code on error
*/
typedef otai_status_t (*otai_get_apsport_attribute_fn)(
_In_ otai_object_id_t apsport_id,
_In_ uint32_t attr_count,
_Inout_ otai_attribute_t *attr_list);
/**
* @brief Get APSPORT statistics.
*
* @param[in] apsport_id APSPORT id
* @param[in] number_of_counters Number of counters in the array
* @param[in] counter_ids Specifies the array of counter ids
* @param[out] counters Array of resulting counter values.
*
* @return #OTAI_STATUS_SUCCESS on success, failure status code on error
*/
typedef otai_status_t (*otai_get_apsport_stats_fn)(
_In_ otai_object_id_t apsport_id,
_In_ uint32_t number_of_counters,
_In_ const otai_stat_id_t *counter_ids,
_Out_ otai_stat_value_t *counters);
/**
* @brief Get APSPORT statistics extended.
*
* @param[in] apsport_id APSPORT id
* @param[in] number_of_counters Number of counters in the array
* @param[in] counter_ids Specifies the array of counter ids
* @param[in] mode Statistics mode
* @param[out] counters Array of resulting counter values.
*
* @return #OTAI_STATUS_SUCCESS on success, failure status code on error
*/
typedef otai_status_t (*otai_get_apsport_stats_ext_fn)(
_In_ otai_object_id_t apsport_id,
_In_ uint32_t number_of_counters,
_In_ const otai_stat_id_t *counter_ids,
_In_ otai_stats_mode_t mode,
_Out_ otai_stat_value_t *counters);
/**
* @brief Clear APSPORT statistics counters.
*
* @param[in] apsport_id APSPORT id
* @param[in] number_of_counters Number of counters in the array
* @param[in] counter_ids Specifies the array of counter ids
*
* @return #OTAI_STATUS_SUCCESS on success, failure status code on error
*/
typedef otai_status_t (*otai_clear_apsport_stats_fn)(
_In_ otai_object_id_t apsport_id,
_In_ uint32_t number_of_counters,
_In_ const otai_stat_id_t *counter_ids);
/**
* @brief Routing interface methods table retrieved with otai_api_query()
*/
typedef struct _otai_apsport_api_t
{
otai_create_apsport_fn create_apsport;
otai_remove_apsport_fn remove_apsport;
otai_set_apsport_attribute_fn set_apsport_attribute;
otai_get_apsport_attribute_fn get_apsport_attribute;
otai_get_apsport_stats_fn get_apsport_stats;
otai_get_apsport_stats_ext_fn get_apsport_stats_ext;
otai_clear_apsport_stats_fn clear_apsport_stats;
} otai_apsport_api_t;
/**
* @}
*/
#endif /** __OTAIAPSPORT_H_ */