summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2014-01-20 05:39:54 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2014-01-20 05:39:54 -0800
commit2bd1a268393a2bdb6fe6b872b485c3aeacd5c18d (patch)
treeed0e7bf4aaf1138b72cea79812cf9613495c5a05
parent5ed721209059acb4277e6aed862f415dd2d5f623 (diff)
parenta97316553487c023209979e3bdc4a77af4367f2b (diff)
downloadandroid_vendor_qcom_opensource_dataservices-2bd1a268393a2bdb6fe6b872b485c3aeacd5c18d.tar.gz
android_vendor_qcom_opensource_dataservices-2bd1a268393a2bdb6fe6b872b485c3aeacd5c18d.tar.bz2
android_vendor_qcom_opensource_dataservices-2bd1a268393a2bdb6fe6b872b485c3aeacd5c18d.zip
Merge "rmnetctl: Support of unset logical EP"
-rw-r--r--rmnetctl/cli/rmnetcli.c15
-rw-r--r--rmnetctl/inc/librmnetctl.h21
-rw-r--r--rmnetctl/src/librmnetctl.c40
3 files changed, 72 insertions, 4 deletions
diff --git a/rmnetctl/cli/rmnetcli.c b/rmnetctl/cli/rmnetcli.c
index 01b5444..8f4d582 100644
--- a/rmnetctl/cli/rmnetcli.c
+++ b/rmnetctl/cli/rmnetcli.c
@@ -2,7 +2,7 @@
R M N E T C L I . C
-Copyright (c) 2013, The Linux Foundation. All rights reserved.
+Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -151,6 +151,13 @@ static void rmnet_api_usage(void)
printf(_5TABS" cannot be larger");
printf(_5TABS" than 15 tcharacters");
printf(_5TABS" Returns the status code\n\n");
+ printf("rmnetcli unsetlepc <logical_ep_id> Un-sets the logical");
+ printf(_2TABS" <dev_name> endpoint configuration for");
+ printf(_5TABS" a particular link.");
+ printf(_5TABS" integers from -1 to 31.");
+ printf(_5TABS" dev_name cannot be larger");
+ printf(_5TABS" than 15 tcharacters");
+ printf(_5TABS" Returns the status code\n\n");
printf("rmnetcli getlepc <logical_ep_id> Sets the logical");
printf(_2TABS" <dev_name> enpoint configuration for a");
printf(_5TABS" particular link.");
@@ -179,7 +186,7 @@ static void rmnet_api_usage(void)
printf(_5TABS" 15 chars. Returns");
printf(_5TABS" the status code\n\n");
printf("rmnetcli getvndname <dev_id> Get name of");
- printf(_5TABS" network device node from id");
+ printf(_5TABS" network device node from id\n\n");
printf("rmnetcli freevnd <dev_id> Removes virtual");
printf(_5TABS" network device node. dev_name");
printf(_5TABS" cannot be larger than 15.");
@@ -369,6 +376,10 @@ static int rmnet_api_call(int argc, char *argv[])
return_code = rmnet_set_logical_ep_config(handle,
_STRTOI32(argv[1]), _STRTOUI8(argv[2]), argv[3], argv[4],
&error_number);
+ } else if (!strcmp(*argv, "unsetlepc")) {
+ _RMNETCLI_CHECKNULL(argv[1]);
+ return_code = rmnet_unset_logical_ep_config(handle,
+ _STRTOI32(argv[1]), argv[2], &error_number);
}
print_rmnet_api_status(return_code, error_number);
rmnetctl_cleanup(handle);
diff --git a/rmnetctl/inc/librmnetctl.h b/rmnetctl/inc/librmnetctl.h
index 45a5e02..25a1477 100644
--- a/rmnetctl/inc/librmnetctl.h
+++ b/rmnetctl/inc/librmnetctl.h
@@ -2,7 +2,7 @@
L I B R M N E T C T L . H
-Copyright (c) 2013, The Linux Foundation. All rights reserved.
+Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -294,6 +294,25 @@ int rmnet_set_logical_ep_config(rmnetctl_hndl_t *hndl,
uint16_t *error_code);
/*!
+* @brief Public API to un-set the logical endpoint configuration for a
+* particular link.
+* @details Message type is RMNET_NETLINK_UNSET_LOGICAL_EP_CONFIG.
+* @param *rmnetctl_hndl_t_val RmNet handle for the Netlink message
+* @param logical_ep_id Logical end point id on which the configuration is to be
+* un-set
+* @param dev_name Device on which to un-set the logical end point configuration
+* @param error_code Status code of this operation returned from the kernel
+* @return RMNETCTL_SUCCESS if successful
+* @return RMNETCTL_LIB_ERR if there was a library error. Check error_code
+* @return RMNETCTL_KERNEL_ERR if there was an error in the kernel.
+* Check error_code
+* @return RMNETCTL_INVALID_ARG if invalid arguments were passed to the API
+*/
+int rmnet_unset_logical_ep_config(rmnetctl_hndl_t *hndl,
+ int32_t ep_id,
+ const char *dev_name,
+ uint16_t *error_code);
+/*!
* @brief Public API to get the logical endpoint configuration for a
* particular link.
* @details Message type is RMNET_NETLINK_GET_LOGICAL_EP_CONFIG.
diff --git a/rmnetctl/src/librmnetctl.c b/rmnetctl/src/librmnetctl.c
index 31fa417..7cd3dcd 100644
--- a/rmnetctl/src/librmnetctl.c
+++ b/rmnetctl/src/librmnetctl.c
@@ -2,7 +2,7 @@
L I B R M N E T C T L . C
-Copyright (c) 2013, The Linux Foundation. All rights reserved.
+Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -616,6 +616,44 @@ int rmnet_set_logical_ep_config(rmnetctl_hndl_t *hndl,
return return_code;
}
+int rmnet_unset_logical_ep_config(rmnetctl_hndl_t *hndl,
+ int32_t ep_id,
+ const char *dev_name,
+ uint16_t *error_code) {
+ struct rmnet_nl_msg_s request, response;
+ int str_len = -1, return_code = RMNETCTL_LIB_ERR;
+ do {
+
+ if ((!hndl) || ((ep_id < -1) || (ep_id > 31)) || (!error_code) ||
+ _rmnetctl_check_dev_name(dev_name)) {
+ return_code = RMNETCTL_INVALID_ARG;
+ break;
+ }
+
+ request.message_type = RMNET_NETLINK_UNSET_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_code(response.crd, error_code) != RMNETCTL_SUCCESS)
+ break;
+
+ return_code = _rmnetctl_set_codes(response.return_code, error_code);
+ } while(0);
+
+ return return_code;
+}
+
int rmnet_get_logical_ep_config(rmnetctl_hndl_t *hndl,
int32_t ep_id,
const char *dev_name,