--- /dev/null
+/*
+ * Copyright (c) 2011-2013 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TIZEN_NETWORK_CONNECTION_EXTENSION_H__
+#define __TIZEN_NETWORK_CONNECTION_EXTENSION_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file connection_extension.h
+ */
+
+/**
+ * @brief Start TCP Dump.
+ *
+ * @param[in] connection The connection handle
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #CONNECTION_ERROR_NONE Successful
+ * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
+ * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
+*/
+int connection_profile_start_tcpdump(connection_h connection);
+
+/**
+ * @brief Stop TCP Dump.
+ *
+ * @param[in] connection The connection handle
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #CONNECTION_ERROR_NONE Successful
+ * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
+ * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
+*/
+int connection_profile_stop_tcpdump(connection_h connection);
+
+/**
+ * @brief Get TCP Dump Running Status.
+ *
+ * @param[in] connection The connection handle
+ * @param[out] tcpdump_state The state of tcpdump, tcpdump is in progress or not
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #CONNECTION_ERROR_NONE Successful
+ * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
+ * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
+*/
+int connection_profile_get_tcpdump_state(connection_h connection, gboolean *tcpdump_state);
+
+/**
+* @}
+*/
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+#endif /* __TIZEN_NETWORK_CONNECTION_EXTENSION_H__ */
int _connection_libnet_set_cellular_subscriber_id(connection_profile_h profile, connection_cellular_subscriber_id_e sim_id);
+int _connection_libnet_start_tcpdump(void);
+int _connection_libnet_stop_tcpdump(void);
+int _connection_libnet_get_tcpdump_state(gboolean *tcpdump_state);
+
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
Name: capi-network-connection
Summary: Network Connection library in TIZEN C API
-Version: 1.0.105
+Version: 1.0.106
Release: 1
Group: System/Network
License: Apache-2.0
return CONNECTION_ERROR_NONE;
}
+EXPORT_API int connection_profile_start_tcpdump(connection_h connection)
+{
+ int ret = 0;
+
+ if (!(__connection_check_handle_validity(connection))) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
+ return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = _connection_libnet_start_tcpdump();
+ if (ret != CONNECTION_ERROR_NONE) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Failed to start tcpdump (%d)", ret);
+ return ret;
+ }
+
+ return CONNECTION_ERROR_NONE;
+}
+
+EXPORT_API int connection_profile_stop_tcpdump(connection_h connection)
+{
+ int ret = 0;
+
+ if (!(__connection_check_handle_validity(connection))) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
+ return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = _connection_libnet_stop_tcpdump();
+ if (ret != CONNECTION_ERROR_NONE) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Failed to stop tcpdump (%d)", ret);
+ return ret;
+ }
+
+ return CONNECTION_ERROR_NONE;
+}
+
+EXPORT_API int connection_profile_get_tcpdump_state(connection_h connection, gboolean *tcpdump_state)
+{
+ int ret = 0;
+
+ if (!(__connection_check_handle_validity(connection)) || !tcpdump_state) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
+ return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = _connection_libnet_get_tcpdump_state(tcpdump_state);
+ if (ret != CONNECTION_ERROR_NONE) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Failed to get the tcpdump state (%d)", ret);
+ return ret;
+ }
+
+ return CONNECTION_ERROR_NONE;
+}
set_last_result(CONNECTION_ERROR_NONE);
return CONNECTION_ERROR_NONE;
}
+
+int _connection_libnet_start_tcpdump(void)
+{
+ connection_error_e result = CONNECTION_ERROR_NONE;
+ net_err_t ret = NET_ERR_NONE;
+
+ ret = net_start_tcpdump();
+ result = __libnet_convert_to_cp_error_type(ret);
+
+ return result;
+}
+
+int _connection_libnet_stop_tcpdump(void)
+{
+ connection_error_e result = CONNECTION_ERROR_NONE;
+ net_err_t ret = NET_ERR_NONE;
+
+ ret = net_stop_tcpdump();
+ result = __libnet_convert_to_cp_error_type(ret);
+
+ return result;
+}
+
+int _connection_libnet_get_tcpdump_state(gboolean *tcpdump_state)
+{
+ connection_error_e result = CONNECTION_ERROR_NONE;
+ net_err_t ret = NET_ERR_NONE;
+
+ ret = net_get_tcpdump_state(tcpdump_state);
+ result = __libnet_convert_to_cp_error_type(ret);
+
+ return result;
+}
#include <glib.h>
#include "net_connection.h"
+#include "connection_extension.h"
#include <tizen_error.h>
return 1;
}
+int test_start_tcpdump(void)
+{
+ if (connection_profile_start_tcpdump(connection) != CONNECTION_ERROR_NONE) {
+ return -1;
+ }
+
+ printf("Successfully started tcpdump\n");
+
+ return 1;
+}
+
+int test_stop_tcpdump(void)
+{
+ if (connection_profile_stop_tcpdump(connection) != CONNECTION_ERROR_NONE) {
+ return -1;
+ }
+
+ printf("Successfully stopped tcpdump\n");
+
+ return 1;
+}
+
+int test_get_tcpdump_state(void)
+{
+ gboolean tcpdump_state = FALSE;
+
+ if (connection_profile_get_tcpdump_state(connection, &tcpdump_state) != CONNECTION_ERROR_NONE) {
+ return -1;
+ }
+
+ printf("tcpdump %s running\n", tcpdump_state ? "is" : "is not");
+
+ return 1;
+}
+
int main(int argc, char **argv)
{
GMainLoop *mainloop;
}
if (*a == '\n' || *a == '\r') {
+/* Public API */
printf("\n\n Network Connection API Test App\n\n");
printf("Options..\n");
+ printf(LOG_BLUE "[Public APIs]\n" LOG_END);
printf(LOG_GREEN "1 - Create Handle and set callbacks\n" LOG_END);
printf("2 - Destroy Handle(unset callbacks automatically)\n");
printf(LOG_GREEN "3 - Get network state\n" LOG_END);
printf("E - Remove route entry\n");
printf("F - Get all IPv6 address\n");
printf("G - Get metered state\n");
+/* Extension API */
+ printf(LOG_BLUE "[Extension API]\n" LOG_END);
+ printf("H - Start TCP Dump\n");
+ printf("I - Stop TCP Dump\n");
+ printf("J - Get TCP Dump State\n");
printf(LOG_RED "0 - Exit \n" LOG_END);
printf("ENTER - Show options menu.......\n");
}
switch (a[0]) {
+/* Public API */
case '1':
rv = test_register_client();
break;
case 'G':
rv = test_is_metered_network();
break;
+/* Extension API */
+ case 'H':
+ rv = test_start_tcpdump();
+ break;
+ case 'I':
+ rv = test_stop_tcpdump();
+ break;
+ case 'J':
+ rv = test_get_tcpdump_state();
+ break;
+
}
if (rv == 1)