int rmnet_get_network_device_associated(rmnetctl_hndl_t *hndl, const char *dev_name, int *register_status, uint16_t *error_code) { struct rmnet_nl_msg_s request, response; int str_len = -1, return_code = RMNETCTL_LIB_ERR; do { if ((!hndl) || (!register_status) || (!error_code) || _rmnetctl_check_dev_name(dev_name)) { return_code = RMNETCTL_INVALID_ARG; break; } request.message_type = RMNET_NETLINK_GET_NETWORK_DEVICE_ASSOCIATED; request.arg_length = RMNET_MAX_STR_LEN; str_len = strlcpy((char *)(request.data), dev_name, RMNET_MAX_STR_LEN); if (_rmnetctl_check_len(str_len, error_code) != RMNETCTL_SUCCESS) break; if ((*error_code = rmnetctl_transact(hndl, &request, &response)) != RMNETCTL_SUCCESS) break; if (_rmnetctl_check_data(response.crd, error_code) != RMNETCTL_SUCCESS) break; *register_status = response.return_code; return_code = RMNETCTL_SUCCESS; } while(0); return return_code; }
int rmnet_get_logical_ep_config(rmnetctl_hndl_t *hndl, int32_t ep_id, const char *dev_name, uint8_t *operating_mode, char **next_dev, uint32_t next_dev_len, uint16_t *error_code) { struct rmnet_nl_msg_s request, response; size_t str_len = 0; int return_code = RMNETCTL_LIB_ERR; do { if ((!hndl) || (!operating_mode) || (!error_code) || ((ep_id < -1) || (ep_id > 31)) || _rmnetctl_check_dev_name(dev_name) || (!next_dev) || (0 == next_dev_len)) { return_code = RMNETCTL_INVALID_ARG; break; } request.message_type = RMNET_NETLINK_GET_LOGICAL_EP_CONFIG; request.arg_length = RMNET_MAX_STR_LEN + sizeof(int32_t); str_len = strlcpy((char *)(request.local_ep_config.dev), dev_name, RMNET_MAX_STR_LEN); if (_rmnetctl_check_len(str_len, error_code) != RMNETCTL_SUCCESS) break; request.local_ep_config.ep_id = ep_id; if ((*error_code = rmnetctl_transact(hndl, &request, &response)) != RMNETCTL_SUCCESS) break; if (_rmnetctl_check_data(response.crd, error_code) != RMNETCTL_SUCCESS) break; str_len = strlcpy(*next_dev, (char *)(response.local_ep_config.next_dev), min(RMNET_MAX_STR_LEN, next_dev_len)); if (_rmnetctl_check_len(str_len, error_code) != RMNETCTL_SUCCESS) break; *operating_mode = response.local_ep_config.operating_mode; return_code = RMNETCTL_SUCCESS; } while(0); return return_code; }
int rmnet_get_link_ingress_data_format_tailspace(rmnetctl_hndl_t *hndl, const char *dev_name, uint32_t *ingress_flags, uint8_t *tail_spacing, uint16_t *error_code) { struct rmnet_nl_msg_s request, response; size_t str_len = 0; int return_code = RMNETCTL_LIB_ERR; do { if ((!hndl) || (!error_code) || _rmnetctl_check_dev_name(dev_name)) { return_code = RMNETCTL_INVALID_ARG; break; } request.message_type = RMNET_NETLINK_GET_LINK_INGRESS_DATA_FORMAT; request.arg_length = RMNET_MAX_STR_LEN; str_len = strlcpy((char *)(request.data_format.dev), dev_name, RMNET_MAX_STR_LEN); if (_rmnetctl_check_len(str_len, error_code) != RMNETCTL_SUCCESS) break; if ((*error_code = rmnetctl_transact(hndl, &request, &response)) != RMNETCTL_SUCCESS) break; if (_rmnetctl_check_data(response.crd, error_code) != RMNETCTL_SUCCESS) break; if (ingress_flags) *ingress_flags = response.data_format.flags; if (tail_spacing) *tail_spacing = response.data_format.tail_spacing; return_code = RMNETCTL_SUCCESS; } while(0); return return_code; }
int rmnet_get_vnd_name(rmnetctl_hndl_t *hndl, uint32_t id, uint16_t *error_code, char *buf, uint32_t buflen) { struct rmnet_nl_msg_s request, response; uint32_t str_len; int return_code = RMNETCTL_LIB_ERR; do { if ((!hndl) || (!error_code)) { return_code = RMNETCTL_INVALID_ARG; break; } request.message_type = RMNET_NETLINK_GET_VND_NAME; request.arg_length = sizeof(uint32_t); request.vnd.id = id; if ((*error_code = rmnetctl_transact(hndl, &request, &response)) != RMNETCTL_SUCCESS) break; if (_rmnetctl_check_data(response.crd, error_code) != RMNETCTL_SUCCESS) break; str_len = strlcpy(buf, (char *)(response.vnd.vnd_name), buflen); if (str_len >= buflen) { *error_code = RMNETCTL_API_ERR_STRING_TRUNCATION; break; } return_code = RMNETCTL_SUCCESS; } while (0); return return_code; }
int rmnet_get_link_egress_data_format(rmnetctl_hndl_t *hndl, const char *dev_name, uint32_t *egress_flags, uint16_t *agg_size, uint16_t *agg_count, uint16_t *error_code) { struct rmnet_nl_msg_s request, response; int str_len = -1, return_code = RMNETCTL_LIB_ERR; do { if ((!hndl) || (!egress_flags) || (!agg_size) || (!agg_count) || (!error_code) || _rmnetctl_check_dev_name(dev_name)) { return_code = RMNETCTL_INVALID_ARG; break; } request.message_type = RMNET_NETLINK_GET_LINK_EGRESS_DATA_FORMAT; request.arg_length = RMNET_MAX_STR_LEN; str_len = strlcpy((char *)(request.data_format.dev), dev_name, RMNET_MAX_STR_LEN); if (_rmnetctl_check_len(str_len, error_code) != RMNETCTL_SUCCESS) break; if ((*error_code = rmnetctl_transact(hndl, &request, &response)) != RMNETCTL_SUCCESS) break; if (_rmnetctl_check_data(response.crd, error_code) != RMNETCTL_SUCCESS) break; *egress_flags = response.data_format.flags; *agg_size = response.data_format.agg_size; *agg_count = response.data_format.agg_count; return_code = RMNETCTL_SUCCESS; } while(0); return return_code; }