Data Structures | |
struct | kcom_ifdev_redundancy_info_s |
Redundancy options structure associated with rms ifd. More... | |
struct | kcom_ifdev_detail_info_entry_s |
List for detail info associated with ifd. More... | |
struct | kcom_ifdev_s |
Interface device (IFD) structure. More... | |
struct | kcom_ifl_s |
Logical interface (IFL) structure. More... | |
struct | kcom_iff_s |
Data structure holding information about the interface family (IFF). More... | |
struct | kcom_ifa_s |
Data stducture holding interface address (IFA) information. More... | |
struct | kcom_rtb_s |
Route table (RTB) structure. More... | |
struct | junos_kcom_gencfg_size_pointer_s |
Size-value structure used in the main structure above. More... | |
struct | junos_kcom_gencfg_peer_info_s |
Peer information used in the junos_kcom_gencfg_t data structure. More... | |
struct | junos_kcom_gencfg_s |
This is the main structure for the KCOM-GENCFG and SDK interface. More... | |
struct | junos_kcom_gencfg_dep_s |
Dependency component structure. More... | |
Defines | |
#define | KCOM_OK 0 |
Operation succeeded. | |
#define | KCOM_COOKIE_FAIL -100 |
Cookie creation failed. | |
#define | KCOM_OPEN_FAIL -101 |
Open operation failed. | |
#define | KCOM_ERRREG_FAIL -102 |
Error registration failed. | |
#define | KCOM_ASYNC_FAIL -103 |
Asynchronous operation failed. | |
#define | KCOM_INVALID_OP -104 |
Invalid operation. | |
#define | KCOM_INVAL_PARAM -105 |
Invalid parameters. | |
#define | KCOM_LIB_ERR -106 |
Generic error, refer to errno for more details. | |
#define | KCOM_ITER_END -107 |
User defined functions can use this bail out of kcom get all functions. | |
#define | KCOM_IGNORE_HANDLER -108 |
Used to inform that call back handler. | |
#define | KCOM_ADD 1 |
Add something or something added. | |
#define | KCOM_CHANGE 2 |
Change something which exists. | |
#define | KCOM_DELETE 3 |
Delete something. | |
#define | KCOM_GET 4 |
Get a thing (described by message). | |
#define | KCOM_IFNAMELEN 60 |
#define | KCOM_MAX_PREFIX_LEN 20 |
Maximum prefix length. | |
#define | KCOM_IFDEV_REDUNDANCY_STATE_WAITING_FOR_PRIMARY (1 << 0) |
Rms is waiting for primary ms-a/b/c to come up. | |
#define | KCOM_IFDEV_REDUNDANCY_STATE_PRIMARY_ACTIVE (1 << 1) |
Primary ms-a/b/c is active. | |
#define | KCOM_IFDEV_REDUNDANCY_STATE_SECONDARY_ACTIVE (1 << 2) |
Secondary ms-x/y/z is active. | |
#define | KCOM_IFDEV_REDUNDANCY_STATE_NONE_ACTIVE (1 << 3) |
Both primary and secondday ar down. | |
#define | KCOM_IFDEV_REDUNDANCY_CMD_NONE 0 |
Default cmd (No command executed from cli to swtich/revert. | |
#define | KCOM_IFDEV_REDUNDANCY_CMD_SWITCH 1 |
Switch to secondary ms-x/y/z. | |
#define | KCOM_IFDEV_REDUNDANCY_CMD_REVERT 2 |
Revert to primary ms-a/b/c. | |
#define | KCOM_IFDEV_REDUNDANCY_N_CMDS 3 |
#define | KCOM_IFDEV_REDUNDANCY_INFO (1 << 0) |
Flag for redundancy options. | |
#define | KCOM_RTBNAMELEN 128 |
#define | JUNOS_KCOM_GENCFG_VERSION 1 |
Version of the junos_kcom_gencfg_t data structure. | |
#define | JUNOS_KCOM_GENCFG_INIT(_data) |
Macro to initialize junos_kcom_gencfg_t data structure. | |
#define | JUNOS_KCOM_GENCFG_KEY_MAX 32 |
Maximum kcom gencfg key size. | |
#define | JUNOS_KCOM_BLOB_ID_MAX 0x3f |
Maximum kcom gencfg blob ID. | |
Typedefs | |
typedef kcom_ifdev_redundancy_info_s | kcom_ifdev_redundancy_info_t |
Redundancy options structure associated with rms ifd. | |
typedef kcom_ifdev_detail_info_entry_s | kcom_ifdev_detail_info_entry_t |
List for detail info associated with ifd. | |
typedef kcom_ifdev_s | kcom_ifdev_t |
Interface device (IFD) structure. | |
typedef kcom_ifl_s | kcom_ifl_t |
Logical interface (IFL) structure. | |
typedef kcom_iff_s | kcom_iff_t |
Data structure holding information about the interface family (IFF). | |
typedef kcom_ifa_s | kcom_ifa_t |
Data stducture holding interface address (IFA) information. | |
typedef kcom_rtb_s | kcom_rtb_t |
Route table (RTB) structure. | |
typedef enum junos_kcom_gencfg_opcode_e | junos_kcom_gencfg_opcode_t |
Operation codes convey all requests in the single-interface approach and for asynchronous messages in both cases. | |
typedef junos_kcom_gencfg_size_pointer_s | junos_kcom_gencfg_szptr_t |
Size-value structure used in the main structure above. | |
typedef enum junos_kcom_gencfg_dest_e | junos_kcom_gencfg_dest_t |
Gencfg blob destination flag. | |
typedef junos_kcom_gencfg_peer_info_s | junos_kcom_gencfg_peer_info_t |
Peer information used in the junos_kcom_gencfg_t data structure. | |
typedef junos_kcom_gencfg_s | junos_kcom_gencfg_t |
This is the main structure for the KCOM-GENCFG and SDK interface. | |
typedef junos_kcom_gencfg_dep_s | junos_kcom_gencfg_dep_t |
Dependency component structure. | |
typedef int(* | kcom_ifd_handler_ptr )(kcom_ifdev_t *, void *) |
kcom_ifd_handler is a user-supplied function called when retrieving device information. | |
typedef int(* | kcom_ifl_handler_ptr )(kcom_ifl_t *, void *) |
kcom_ifl_handler_ptr is a user-supplied function called when retrieving logical interface information. | |
typedef int(* | kcom_iff_handler_ptr )(kcom_iff_t *, void *) |
kcom_iff_handler_ptr is a user-supplied function called when retrieving interface family information. | |
typedef int(* | kcom_ifa_handler_ptr )(kcom_ifa_t *, void *) |
kcom_ifa_handler_ptr is a user-supplied function called when retrieving interface address information. | |
typedef int(* | kcom_rtb_handler_ptr )(kcom_rtb_t *, void *) |
kcom_route_table_handler_ptr is a user-supplied function called when retrieving route table information. | |
Enumerations | |
enum | junos_kcom_gencfg_opcode_e { JUNOS_KCOM_GENCFG_OPCODE_MIN, JUNOS_KCOM_GENCFG_OPCODE_INIT, JUNOS_KCOM_GENCFG_OPCODE_BLOB_ADD, JUNOS_KCOM_GENCFG_OPCODE_BLOB_DEL, JUNOS_KCOM_GENCFG_OPCODE_BLOB_GET, JUNOS_KCOM_GENCFG_OPCODE_BLOB_GETNEXT, JUNOS_KCOM_GENCFG_OPCODE_FILTER_ADD, JUNOS_KCOM_GENCFG_OPCODE_FILTER_DEL, JUNOS_KCOM_GENCFG_OPCODE_GET_FREE, JUNOS_KCOM_GENCFG_OPCODE_MAX, JUNOS_KCOM_GENCFG_OPCODE_BLOB_CHG, JUNOS_KCOM_GENCFG_OPCODE_ALL } |
Operation codes convey all requests in the single-interface approach and for asynchronous messages in both cases. More... | |
enum | junos_kcom_gencfg_dest_e { JUNOS_KCOM_GENCFG_DEST_RE_LOCAL_ONLY, JUNOS_KCOM_GENCFG_DEST_RE_AND_PFE } |
Gencfg blob destination flag. More... | |
Functions | |
int | junos_kcom_init (u_int8_t sender_id, evContext context) |
Initializes the JUNOS Kernel Communication Subsystem. | |
int | junos_kcom_shutdown (void) |
Closes the JUNOS Kernel Communication Library. | |
void | junos_kcom_msg_free (void *msg) |
Deallocates the message buffer msg. | |
int | junos_kcom_ifd_get_all (kcom_ifd_handler_ptr func, const char *prefix, void *user_info) |
Extracts the IFDs present in the system with the given prefix. | |
int | junos_kcom_ifd_get_by_index (u_int16_t idx, kcom_ifdev_t *ifd) |
Retrieves device information based on the interface index. | |
int | junos_kcom_ifd_get_by_snmp_index (ifl_idx_t snmp_index, kcom_ifdev_t *ifd) |
Retrieves device information based on the SNMP index. | |
int | junos_kcom_ifd_get_by_name (const char *name, kcom_ifdev_t *ifd) |
Retrieves device information based on the name. | |
int | junos_kcom_register_ifd_handler (void *user_info, kcom_ifd_handler_ptr user_handler) |
Registers a callback handler for device information. | |
int | junos_kcom_ifd_down (kcom_ifdev_t *ifdev) |
Checks for the down status of the interface. | |
int | junos_kcom_ifd_set_detail_info_flags (uint32_t ifd_detail_info_flags) |
Sets the detail information flag associated with ifd. | |
int | junos_kcom_ifd_clear_detail_info_flags (uint32_t ifd_detail_info_flags) |
Clears the detail information flags associated with ifd. | |
bool | junos_kcom_ifd_is_detail_info_flag_set (uint32_t ifd_detail_info_flags) |
Checks if the detail information flag associated with ifd is set. | |
const void * | junos_kcom_ifd_retrieve_detail_info (kcom_ifdev_detail_info_list_t *ifd_detail_list, uint32_t ifd_detail_flags) |
Retrieves the detail info associated with ifd. | |
const kcom_ifdev_redundancy_info_t * | junos_kcom_ifd_retrieve_redundancy_info (kcom_ifdev_detail_info_list_t *ifd_detail_list) |
Retrieves redundancy info associated with ifd. | |
int | junos_kcom_ifd_detail_info_free (kcom_ifdev_detail_info_list_t *ifd_detail, uint32_t ifd_detail_flags) |
Free the ifd detail info entries. | |
int | junos_kcom_ifl_get_all (kcom_ifl_handler_ptr func, char *prefix, void *user_info) |
Extracts all IFLs having a given prefix. | |
int | junos_kcom_ifl_get_by_index (ifl_idx_t idx, kcom_ifl_t *ifl) |
Retrieves logical interface information based on index. | |
int | junos_kcom_ifl_get_by_snmp_index (ifl_idx_t snmp_index, kcom_ifl_t *ifl) |
Retrieves logical interface information based on the SNMP index. | |
int | junos_kcom_ifl_get_by_name (char *name, if_subunit_t subunit, kcom_ifl_t *ifl) |
Retrieves logical interface information based on the name. | |
int | junos_kcom_register_ifl_handler (void *user_info, kcom_ifl_handler_ptr user_handler) |
Registers a handler for interface information. | |
int | junos_kcom_ifl_down (kcom_ifl_t *ifl) |
Checks for the down status of the interface. | |
int | junos_kcom_iff_get_all (kcom_iff_handler_ptr func, ifl_idx_t idx, void *user_info) |
Retrieves all address families for the given interface. | |
int | junos_kcom_iff_get_by_index (ifl_idx_t idx, u_int8_t af, kcom_iff_t *iff) |
Retrieve address family information based on IFL index. | |
int | junos_kcom_iff_get_by_dev_name (const char *ifd_name, if_subunit_t subunit, u_int8_t af, kcom_iff_t *iff) |
Retrieves address family information based on IFD name, family, and sub-unit. | |
int | junos_kcom_register_iff_handler (void *user_info, kcom_iff_handler_ptr user_handler) |
Registers a user-supplied handler for address family information. | |
int | junos_kcom_iff_down (kcom_iff_t *iff) |
Checks for the down status of the family. | |
int | junos_kcom_iff_isprimary (kcom_iff_t *iff) |
Checks if the IFF is currently primary for protocol. | |
int | junos_kcom_iff_primary (kcom_iff_t *iff) |
Checks if the IFF can be primary for protocol. | |
int | junos_kcom_ifa_get_all (kcom_ifa_handler_ptr func, ifl_idx_t idx, u_int8_t af, void *user_info) |
Retrieves all IFAs for the given interface. | |
int | junos_kcom_ifa_get_first (ifl_idx_t idx, u_int8_t af, kcom_ifa_t *ifa) |
Retrieves first IFA for the given IFL index and family. | |
int | junos_kcom_ifa_get_next (ifl_idx_t idx, u_int8_t af, u_int8_t *local, u_int16_t localplen, kcom_ifa_t *ifa) |
Retrieves next IFA for the given IFL index, local address and family. | |
int | junos_kcom_ifa_get_by_dest (ifl_idx_t idx, u_int8_t af, u_int8_t *dest, u_int16_t destplen, kcom_ifa_t *ifa) |
Retrieves information about address based on destination prefix. | |
int | junos_kcom_ifa_get_by_local (ifl_idx_t idx, u_int8_t af, u_int8_t *local, u_int16_t localplen, kcom_ifa_t *ifa) |
Retrieves address information based on local prefix. | |
int | junos_kcom_register_ifa_handler (void *user_info, kcom_ifa_handler_ptr user_handler) |
Registers a user-supplied handler for address information. | |
int | junos_kcom_ifa_down (kcom_ifa_t *ifa) |
Checks for the down status of the address. | |
int | junos_kcom_ifa_isprimary (kcom_ifa_t *ifa) |
Checks if the IFA is the current primary address. | |
int | junos_kcom_ifa_ispreferred (kcom_ifa_t *ifa) |
Checks if the IFA is the current preferred address to destination. | |
int | junos_kcom_ifa_isdefault (kcom_ifa_t *ifa) |
Checks if the IFA is the current default address. | |
int | junos_kcom_ifa_primary (kcom_ifa_t *ifa) |
Checks if the IFA can be primary address. | |
int | junos_kcom_ifa_preferred (kcom_ifa_t *ifa) |
Checks if the IFA is the preferred address for destination. | |
int | junos_kcom_gencfg (junos_kcom_gencfg_t *user_p) |
Main entry routine for all SDK gencfg-related user calls. | |
int | junos_kcom_rtb_get_all (kcom_rtb_handler_ptr func, u_int8_t af, void *user_info) |
Retrieves all RTBs for the given family. | |
int | junos_kcom_register_rtb_handler (void *user_info, kcom_rtb_handler_ptr user_handler) |
Registers a handler for route table information. | |
int | junos_kcom_rtb_deleting (kcom_rtb_t *rtb) |
Checks if the route table is being deleted. | |
Variables | |
typedef | kcom_ifdev_detail_info_list_t |
|
Value: do { \ memset((_data), 0, sizeof(junos_kcom_gencfg_t)); \ (_data)->ver = JUNOS_KCOM_GENCFG_VERSION; \ (_data)->size = sizeof(junos_kcom_gencfg_t); \ } while(0) This one should be called to initialize the data structure before it is used. It first set all fields to zero then setup some internal used fields. |
|
Version of the junos_kcom_gencfg_t data structure. If the data structure is changed in the future, please bump up the version number. |
|
Used to inform that call back handler. It is used internally in KCOM |
|
Dependency component structure.
The
KCOM-GENCFG will only handle dependency type of Dependencies convey, for example, the order of creation: The physical interface must be operational before logical links can be activated on it. |
|
Gencfg blob destination flag. This flag indicates the destination of the blob. |
|
Peer information used in the junos_kcom_gencfg_t data structure. For JUNOS_KCOM_GENCFG_OPCODE_BLOB_ADD and JUNOS_KCOM_GENCFG_OPCODE_BLOB_DEL, peer_name needs to be filled in. For JUNOS_KCOM_GENCFG_OPCODE_BLOB_GET and JUNOS_KCOM_GENCFG_OPCODE_BLOB_GETNEXT, peer_index and peer_class_mask will be passed out. |
|
This is the main structure for the KCOM-GENCFG and SDK interface. All required parameters are conveyed through this structure, and specific fields are mandatory for each request or notification. Non-zero length in length-pointer fields indicates field presence. The memory pointed by peer_info for JUNOS_KCOM_GENCFG_OPCODE_BLOB_GET and JUNOS_KCOM_GENCFG_OPCODE_BLOB_GETNEXT will be dynamically allocated inside of junos_kcom_gencfg () api, caller is supposed to free this memory by using opcode JUNOS_KCOM_GENCFG_OPCODE_GET_FREE. |
|
|
|
kcom_ifd_handler is a user-supplied function called when retrieving device information.
|
|
kcom_iff_handler_ptr is a user-supplied function called when retrieving interface family information.
|
|
|
|
|
|
Gencfg blob destination flag. This flag indicates the destination of the blob. |
|
|
Main entry routine for all SDK gencfg-related user calls. This routine dispatches to other specific handlers based on the request. The routine performs some basic checks and actual actions in all cases. It does translations in most. Error codes are returned in all.
Note: For
|
|
Checks for the down status of the address.
|
|
Retrieves all IFAs for the given interface. The user-supplied function should free the message passed to it, by calling junos_kcom_msg_free() before it returns.
|
|
Retrieves information about address based on destination prefix.
The caller has to provide memory for the
|
|
Retrieves address information based on local prefix.
The caller has to provide memory for the
|
|
Retrieves first IFA for the given IFL index and family.
The caller has to provide memory for the
|
|
Retrieves next IFA for the given IFL index, local address and family.
The caller has to provide memory for the
|
|
Checks if the IFA is the current default address.
|
|
Checks if the IFA is the current preferred address to destination.
|
|
Checks if the IFA is the current primary address.
|
|
Checks if the IFA is the preferred address for destination.
|
|
Checks if the IFA can be primary address.
|
|
Clears the detail information flags associated with ifd.
This function is used to clear the ifd detail info flags. The flags supported are defined in this file, should use combination of one or more of these flags. Currently
|
|
Free the ifd detail info entries. This function is used to free the memory allocated to detail info structures in library.
|
|
Checks for the down status of the interface.
|
|
Extracts the IFDs present in the system with the given prefix. A user-supplied function is called for each device retrieved. The user-supplied function should free the message passed to it, by calling junos_kcom_msg_free() before it returns.
|
|
Retrieves device information based on the interface index.
The caller has to provide memory for the
|
|
Retrieves device information based on the name.
The caller has to provide memory for the
|
|
Retrieves device information based on the SNMP index.
The caller has to provide memory for the
|
|
Checks if the detail information flag associated with ifd is set. This function is used to check if any of the ifd detail info flag is set.
|
|
Retrieves the detail info associated with ifd. This function is used to retrieve the detail info associated with an ifd. Pointer to ifd detail info list and the detail info flag should be passed to get the appropriate detail info structure. Only one flag needs to be set. If more detail info is needed, this function needs to be called multiple times with needed detail info flag set. NULL is returned incase there is no associated detail info with the ifd.
|
|
Retrieves redundancy info associated with ifd. Given the ifd detail info list, this function returns a pointer to ifd redudancy info. NULL is returned incase there is no redundancy info associated with the ifd.
|
|
Sets the detail information flag associated with ifd.
This function is used to set flags to show interest in getting the detailed info associated with ifd. The flags supported are defined in this file, should use combination of one or more of these flags. Currently
|
|
Checks for the down status of the family.
|
|
Retrieves all address families for the given interface. Retrieves all address families for all interfaces if idx is 0. The user-supplied function should free the message passed to it, by calling junos_kcom_msg_free() before it returns.
|
|
Retrieves address family information based on IFD name, family, and sub-unit.
The caller has to provide memory for the
|
|
Retrieve address family information based on IFL index.
The caller has to provide memory for the
|
|
Checks if the IFF is currently primary for protocol.
|
|
Checks if the IFF can be primary for protocol.
|
|
Checks for the down status of the interface.
|
|
Extracts all IFLs having a given prefix. The user-supplied function should free the message passed to it, by calling junos_kcom_msg_free() before it returns.
|
|
Retrieves logical interface information based on index.
The caller has to provide memory for the
|
|
Retrieves logical interface information based on the name.
The caller has to provide memory for the
|
|
Retrieves logical interface information based on the SNMP index.
The caller has to provide memory for the
|
|
Initializes the JUNOS Kernel Communication Subsystem. This function opens and initializes a synchronous and asynchronous connection between the daemon and the kernel. It should be called once from the daemon.
|
|
Deallocates the message buffer msg. Use this function to free data that was allocated in the library.
|
|
Registers a user-supplied handler for address information. The user-supplied function will be called when address information is added, changed, or deleted by the JUNOS kernel. This user-supplied function should free the message passed to it, by calling junos_kcom_msg_free() before it returns.
|
|
Registers a callback handler for device information. The user-supplied function provided will be called when a device is added, changed, or deleted by the JUNOS kernel. This user-supplied function should free the message passed to it, by calling junos_kcom_msg_free() before it returns.
|
|
Registers a user-supplied handler for address family information. The user-supplied function will be called when the address family information is added, changed, or deleted by the JUNOS kernel. This user-supplied function should free the message passed to it, by calling junos_kcom_msg_free() before it returns.
|
|
Registers a handler for interface information. The user-supplied function will be called when an interface is added, changed, or deleted by the JUNOS kernel This user-supplied function should free the message passed to it, by calling junos_kcom_msg_free() before it returns.
|
|
Registers a handler for route table information. The user-supplied function will be called when a route table is added, changed, or deleted by the JUNOS kernel. This user-supplied function should free the message passed to it, by calling junos_kcom_msg_free() before it returns.
|
|
Checks if the route table is being deleted. A route table is marked as deleting before being removed. This gives an opportunity to the user daemons to remove any routes that are added to this route table.
|
|
Retrieves all RTBs for the given family. The user-supplied function should free the message passed to it, by calling junos_kcom_msg_free() before it returns.
|
|
Closes the JUNOS Kernel Communication Library. This function closes the synchronous and asynchronous connection between the daemon and the kernel.
|