38 #ifndef _OPENAPI_COMMON_H_
39 #define _OPENAPI_COMMON_H_
42 #include <arpa/inet.h>
43 #include <netinet/in.h>
48 #if defined (__i386__) || defined (__x86_64__)
49 #define OPEN_PACKED_STRUCT typedef struct __attribute__((__packed__))
51 #define OPEN_PACKED_STRUCT typedef struct
86 OPEN_EVENT_INTERFACE = 0,
89 OPEN_EVENT_ROUTING_INTERFACE = 3,
90 OPEN_EVENT_ISSU_START = 4,
91 OPEN_EVENT_READY_STATE = 5,
92 OPEN_EVENT_CONFIG = 6,
98 unsigned char open_event_mask [((OPEN_EVENT_LAST) / 8) + 1];
113 #define OPEN_REGISTRATION_SERVICE_USERAPPS 100001
119 #define OPEN_CLIENT_INSTANCE_FIRST 1
197 OPEN_ACTION_DELETE = 1
232 #define OPEN_MAC_ADDR_LEN 6
233 #define OPEN_MAC_ADDR_STR_LEN (OPEN_MAC_ADDR_LEN * 3)
235 #define OPEN_MIN_U64_STR_BUFFER_SIZE 21
237 #define OPEN_DATE_TIME_OUTPUT_FORMAT "%4.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d"
238 #define OPEN_DATE_TIME_BUF_LEN 20
260 OPEN_PREF_RESERVED = 0,
262 OPEN_PREF_STATIC = 2,
264 OPEN_PREF_OSPF_INTRA_AREA = 4,
265 OPEN_PREF_OSPF_INTER_AREA = 5,
266 OPEN_PREF_OSPF_EXTERNAL = 6,
271 OPEN_PREF_GLOBAL_DEFAULT_GATEWAY = 11,
272 OPEN_PREF_DEFAULT_DHCP = 12,
273 OPEN_PREF_LOCAL_BGP = 13,
280 OPEN_REDIST_RT_FIRST = 0,
281 OPEN_REDIST_RT_LOCAL = 1,
282 OPEN_REDIST_RT_STATIC = 2,
283 OPEN_REDIST_RT_RIP = 3,
284 OPEN_REDIST_RT_OSPF = 4,
285 OPEN_REDIST_RT_BGP = 5,
286 OPEN_REDIST_RT_OSPFV3 = 6,
333 #define OPEN_IS_ADDR_EQUAL(xaddr, yaddr) \
334 ( (OPEN_AF_INET6 == ((open_inet_addr_t *)(xaddr))->family) ? \
335 ( (((open_inet_addr_t *)(xaddr))->addr.ipv6.u.addr32[0] == \
336 ((open_inet_addr_t *)(yaddr))->addr.ipv6.u.addr32[0]) && \
337 (((open_inet_addr_t *)(xaddr))->addr.ipv6.u.addr32[1] == \
338 ((open_inet_addr_t *)(yaddr))->addr.ipv6.u.addr32[1]) && \
339 (((open_inet_addr_t *)(xaddr))->addr.ipv6.u.addr32[2] == \
340 ((open_inet_addr_t *)(yaddr))->addr.ipv6.u.addr32[2]) && \
341 (((open_inet_addr_t *)(xaddr))->addr.ipv6.u.addr32[3] == \
342 ((open_inet_addr_t *)(yaddr))->addr.ipv6.u.addr32[3]) ) : \
343 ( ((open_inet_addr_t *)(xaddr))->addr.ipv4 == \
344 ((open_inet_addr_t *)(yaddr))->addr.ipv4) )
346 #define OPEN_INTF_NAME_MAX_LENGTH 60
347 #define OPEN_IP_ADDR_DISP_LENGTH 46
348 #define OPENAPI_VER_BUFF_MAX_SIZE 128
349 #define OPEN_IP_ADDR_LENGTH 16
350 #define OPENAPI_VER_BUFF_MAX_SIZE 128
355 OPEN_PASSWORD_ENCRYPT_NONE = 0,
356 OPEN_PASSWORD_ENCRYPT_AES = 1,
357 OPEN_PASSWORD_ENCRYPT_MD5 = 2
378 typedef unsigned char maskValue_t;
380 #define OPEN_MASK_UNIT (sizeof(maskValue_t) * 8)
381 #define OPEN_MASK_LEN(_size) ((((_size) - 1) / OPEN_MASK_UNIT) + 1)
384 #define OPEN_SETMASKBIT(j, k) \
385 ((j)[(k - 1) / L7_MASK_UNIT] |= 1 << ((k - 1) % L7_MASK_UNIT))
388 #define OPEN_CLRMASKBIT(j, k) \
389 ((j)[(k - 1) / OPEN_MASK_UNIT] &= ~(1 << ((k - 1) % L7_MASK_UNIT)))
394 #define OPEN_NONZEROMASK(_mask, _result, _size) \
398 maskValue_t *_p_ = (maskValue_t *)&(_mask); \
401 for (_i_ = 0; _i_ < OPEN_MASK_LEN(_size); _i_++) \
413 #define OPEN_ISMASKBITSET(j, k) \
414 ((j)[((k - 1) / OPEN_MASK_UNIT)] & ( 1 << ((k - 1) % OPEN_MASK_UNIT)))
418 #define OPENAPI_PROTOCOL_HEX_IP 0x0800
419 #define OPENAPI_PROTOCOL_HEX_ARP 0x0806
420 #define OPENAPI_PROTOCOL_HEX_IPX 0x8137
421 #define OPENAPI_PROTOCOL_HEX_MIN 0x0600
422 #define OPENAPI_PROTOCOL_HEX_MAX 0xFFFF
424 #define OPEN_MATCH_EXACT 1
425 #define OPEN_MATCH_GETNEXT 2
426 #define OPEN_MATCH_FREE 3
428 #define OPEN_VRF_MAX_NAME_LEN 15
430 #define OPEN_RPC_CLT_RECV_DEF_TIMEOUT 0
431 #define OPEN_RPC_CLT_RECV_MIN_TIMEOUT 1
432 #define OPEN_RPC_CLT_RECV_MAX_TIMEOUT 65535
442 uint32_t mrecvseqerr;
443 uint32_t mrecvtimeout;
781 int32_t timeout_secs);
798 uint32_t *max_interface_count);
816 uint32_t *system_is_ready);
836 uint32_t *system_is_ready);
901 uint32_t *inetAddrMaxSize);
1009 uint16_t seqNo, uint32_t rtt, uint32_t type,
open_buffdesc *srcIp );
1033 uint16_t hopCount, uint16_t probeCount, uint32_t rtt, uint8_t errSym);
1163 uint32_t *fileNameLen);
1189 uint32_t *fileNameLen);
Untagged or priority tagged frames.
open_error_t openapiImageFileNameMaxLengthGet(openapiClientHandle_t *client_handle, uint32_t *fileNameLen)
Get the maximum length of an image file name (excluding its path) in the file system.
open_error_t openapiAllIntfNumGet(openapiClientHandle_t *client_handle, uint32_t *intfNum)
Get the count of all interfaces.
open_error_t openapiIntfNameGet(openapiClientHandle_t *client_handle, uint32_t intfNum, open_buffdesc *bufdName)
Get interface name for a given internal interface number.
open_error_t openapiIntfNameMaxLengthGet(openapiClientHandle_t *client_handle, uint32_t *maxLen)
Get maximum length of interface name.
open_error_t openapiIntfDisplayNameGet(openapiClientHandle_t *client_handle, uint32_t unit, uint32_t slot, uint32_t port, open_buffdesc *bufdName)
Get the display name of given interface.
struct open_in6_addr_s open_in6_addr_t
Hash Mode names.
Parameter/feature is not supported.
open_error_t openapiCurrentSDMGet(openapiClientHandle_t *client_handle, uint32_t *sdm_template)
Get the current active SDM template in the system.
open_error_t openapiConnectivityCheck(openapiClientHandle_t *client_handle)
Return code indicates whether the OpEN remote procedure call infrastructure is ready.
OPEN_AFX_t
OPEN uses these enumerators to indicate BGP address family index of routes or policy for IPV4 or IPV6...
open_error_t openapiApiVersionGet(openapiClientHandle_t *client_handle, open_revision_data_t *version)
Returns the revision of the OPEN API.
Port is disabled by protocol.
OPEN_REGISTER_FLAGS_t
Open API enhanced registration flags.
OPEN_REDIST_RT_INDICES_t
Redistribution route types.
int openapiClientNotifySocketFDGet(openapiClientHandle_t *client_handle)
Accessor function to retrieve the socket FD for event notifications from OpEN.
OPEN_DOT1Q_ACCEPT_FRAME_TYPE_t
OPEN uses these enumerators to indicate the types of frames that may be received on this port...
open_error_t
OPEN uses these enumerators to indicate the error codes.
open_error_t openapiSystemReadyStateGet(openapiClientHandle_t *client_handle, uint32_t *system_is_ready)
Determine whether the system is currently operational or not operational.
open_error_t openapiTimeToCalenderTimeGet(openapiClientHandle_t *client_handle, uint32_t inputTime, open_buffdesc *outputTime)
Convert time (seconds) to calender time format.
open_error_t openapiInternalClientTearDown(openapiClientHandle_t *client_handle)
Deregister an internal OpEN client.
open_error_t openapiInetAddrGet(openapiClientHandle_t *client_handle, open_buffdesc *ipStr, open_inet_addr_t *ipAddr)
Get the IP address in network byte order from string format.
Operation dependency not met.
open_error_t openapiPendingEventsGet(openapiClientHandle_t *client_handle, openapiEventList_t *changed_mask, openapiEventList_t *purged_mask)
Check what events are pending for this client.
OPEN_RATE_UNIT_t
OpEN uses this enumeration to define rate units.
open_error_t openapiHardwareVersionGet(openapiClientHandle_t *client_handle, open_buffdesc *version)
Returns hardware version of the switch.
open_error_t openapiMaxInterfaceCountGet(openapiClientHandle_t *client_handle, uint32_t *max_interface_count)
Get the maximum number of interfaces on this switch.
open_error_t openapiMacAddrStringToHexGet(openapiClientHandle_t *client_handle, open_buffdesc *inputMac, open_buffdesc *outputMac)
Get the MAC address in 6-byte hexadecimal format from string format.
void openapiEventSet(openapiEventList_t *event_mask, OPEN_EVENT_e event_handle)
Set a particular event type to the event bit mask.
open_error_t openapiEventWait(openapiClientHandle_t *client_handle, int32_t timeout_secs)
Wait for Open API events for this client.
OPEN_AF_t
OPEN uses these enumerators to indicate address family, IPV4 or IPV6.
open_error_t openapiClientReceiveTimeoutSet(openapiClientHandle_t *client_handle, uint32_t timeout)
Set the RPC client receive socket time out.
OPEN_ACTION_t
OPEN uses these enumerators to indicate the interface types.
open_error_t openapiInetAddrCompare(openapiClientHandle_t *client_handle, open_buffdesc *ip1Str, open_buffdesc *ip2Str, OPEN_BOOL_t *equal)
Check if the two IP address strings refer to the same address.
open_error_t openapiClientRegister(char *client_name, openapiClientHandle_t *client_handle)
Register as a client with the OpEN API and wait until OpEN API services are available.
OPEN_PORT_STATE_t
OPEN uses these enumerators to indicate port admin mode enable, disable or diag_disable.
open_error_t openapiClientStatsPrint(void)
Print the RPC client statistics.
open_error_t openapiCpuIntfGet(openapiClientHandle_t *client_handle, uint32_t *intf)
Returns the CPU control plane interface number.
open_error_t openapiNetworkOSVersionGet(openapiClientHandle_t *client_handle, open_buffdesc *version)
Returns the revision of the network operating system running on the switch.
open_error_t openapiEventRegister(openapiClientHandle_t *client_handle, openapiEventList_t *event_mask)
Register the client to receive event notifications for one or more event types.
Useful on openapiIfNextGet() to get all interfaces.
open_error_t openapiClientRegisterEnhanced(char *client_name, OPEN_REGISTER_FLAGS_t reg_flags, openapiClientHandle_t *client_handle)
Register as a client with the OpEN API using enhanced options and wait until OpEN API services are av...
open_error_t openapiInetAddrFromIPAddrHostNameStr(openapiClientHandle_t *client_handle, open_buffdesc *ipOrHostStr, open_inet_addr_t *inetAddr)
Converts network address string containing either an IPv4/IPv6 address or a host name into an inetAdd...
OPEN_CONTROL_t
OPEN uses these enumerators to indicate enable or disable for a given config or status parameter...
Nothing to report or table is empty.
int openapiEventIsSet(openapiEventList_t *event_mask, OPEN_EVENT_e event_handle)
Check if a particular event is set in a bit mask of events.
open_error_t openapiClientTearDown(openapiClientHandle_t *client_handle)
Teardown and cleanup the connection resources.
OPEN_PREF_INDICES_t
Route Preference Types.
OPEN_VLAN_PARTICIPATION_MODE_t
OPEN uses these enumerators to indicate the VLAN participation of a given interface.
OPEN_BOOL_t
OPEN uses these enumerators to indicate true or false for a given config or status parameter...
open_error_t openapiIsInetAddrZero(openapiClientHandle_t *client_handle, open_inet_addr_t ipAddr, OPEN_BOOL_t *isZero)
Check if the given IP address is zero or not.
void openapiEventListClear(openapiEventList_t *event_mask)
Clear all the bit mask of events.
open_error_t openapiServiceClientRegister(char *client_name, int32_t client_inst, int32_t server_id, openapiClientHandle_t *client_handle)
Register as a client of a specified OpEN API service and wait until the service is available...
Rate in percentage of link speed.
OPEN_PASSWORD_ENCRYPT_ALG_t
OpEN uses this enumeration to define encryption types.
OPEN_IP_ADDRESS_TYPE_t
OpEN uses this enumeration to define IP address types.
System is busy (doing some important/time consuming operations/updates)
Multi-threaded application.
open_error_t openapiSystemFileNameMaxLengthGet(openapiClientHandle_t *client_handle, uint32_t *fileNameLen)
Get the maximum length of a file name (including its path) in the file system.
open_error_t openapiClientReceiveTimeoutGet(openapiClientHandle_t *client_handle, uint32_t *timeout)
Get the RPC client receive socket time out.
open_error_t openapiPingCallback(openapiClientHandle_t *client_handle, uint16_t seqNo, uint32_t rtt, uint32_t type, open_buffdesc *srcIp)
Send the ping response to the client(CLI/Telnet/SSH) session.
open_error_t openapiIpAddressMaxStringLength(openapiClientHandle_t *client_handle, uint32_t *maxLen)
Get maximum string length of IP address.
open_error_t openapiOspfEqualCostRoutesMax(openapiClientHandle_t *client_handle, uint32_t *maxPaths)
Get the number of equal cost routes supported by this platform.
open_error_t openapiClientRpcStatsGet(openapiClientRpcStats_t *stats)
Get the RPC client statistics.
open_error_t openapiSystemReadyStateTransitionNextGet(openapiClientHandle_t *client_handle, uint32_t *system_is_ready)
Get the next configurator state transition event.
open_error_t openapiInetAddrMaxSizeGet(openapiClientHandle_t *client_handle, uint32_t *inetAddrMaxSize)
Get the maximum size of inet address length.
OPEN_EVENT_e
Open API Events for which clients can register.
OPEN_LINK_STATE_t
OPEN uses these enumerators to indicate the link status.
Maximum count is already reached or table full.
open_error_t openapiOpenIPtoStringGet(openapiClientHandle_t *client_handle, open_inet_addr_t openAddr, open_buffdesc *bufdName)
Get human readable string format of given IP address.
open_error_t openapiTraceRouteCallbackFn(openapiClientHandle_t *client_handle, uint32_t numProbes, uint32_t ttl, uint32_t ipDa, uint16_t hopCount, uint16_t probeCount, uint32_t rtt, uint8_t errSym)
Send the traceroute response to the client(CLI/Telnet/SSH) session.
Any other interface type.
open_error_t openapiInternalClientRegister(char *client_name, openapiClientHandle_t *client_handle)
Register as an internal client with the OpEN API and wait until OpEN API services are available...