#include <string.h>
#include "tethering_private.h"
-int tethering_client_clone(tethering_client_h *dest, tethering_client_h origin)
+API int tethering_client_clone(tethering_client_h *dest, tethering_client_h origin)
{
+ CHECK_FEATURE_SUPPORTED(TETHERING_FEATURE);
+
_retvm_if(dest == NULL, TETHERING_ERROR_INVALID_PARAMETER,
"Parameter(dest) is NULL\n");
__tethering_client_h *si = NULL;
+ __tethering_client_h *source = NULL;
+
+ source = (__tethering_client_h *)origin;
si = malloc(sizeof(__tethering_client_h));
if (si == NULL) {
return TETHERING_ERROR_OUT_OF_MEMORY;
}
- memcpy(si, (__tethering_client_h *)origin,
- sizeof(__tethering_client_h));
+ memcpy(si, source, sizeof(__tethering_client_h));
+ si->hostname = g_strdup(source->hostname);
+ if (si->hostname == NULL) {
+ ERR("malloc is failed\n");
+ free(si);
+ return TETHERING_ERROR_OUT_OF_MEMORY;
+ }
*dest = (tethering_client_h)si;
return TETHERING_ERROR_NONE;
}
-int tethering_client_destroy(tethering_client_h client)
+API int tethering_client_destroy(tethering_client_h client)
{
+ CHECK_FEATURE_SUPPORTED(TETHERING_FEATURE);
+
_retvm_if(client == NULL, TETHERING_ERROR_INVALID_PARAMETER,
"Parameter(client) is NULL\n");
+ __tethering_client_h *si = NULL;
+
+ si = (__tethering_client_h *)client;
+
+ g_free(si->hostname);
+
free(client);
return TETHERING_ERROR_NONE;
}
-int tethering_client_get_tethering_type(tethering_client_h client, tethering_type_e *type)
+API int tethering_client_get_tethering_type(tethering_client_h client, tethering_type_e *type)
{
+ CHECK_FEATURE_SUPPORTED(TETHERING_FEATURE);
+
_retvm_if(client == NULL, TETHERING_ERROR_INVALID_PARAMETER,
"Parameter(client) is NULL\n");
_retvm_if(type == NULL, TETHERING_ERROR_INVALID_PARAMETER,
return TETHERING_ERROR_NONE;
}
-int tethering_client_get_name(tethering_client_h client, char **name)
+API int tethering_client_get_name(tethering_client_h client, char **name)
{
+ CHECK_FEATURE_SUPPORTED(TETHERING_FEATURE);
+
_retvm_if(client == NULL, TETHERING_ERROR_INVALID_PARAMETER,
"Parameter(client) is NULL\n");
_retvm_if(name == NULL, TETHERING_ERROR_INVALID_PARAMETER,
return TETHERING_ERROR_NONE;
}
-int tethering_client_get_ip_address(tethering_client_h client, tethering_address_family_e address_family, char **ip_address)
+API int tethering_client_get_ip_address(tethering_client_h client, tethering_address_family_e address_family, char **ip_address)
{
+ CHECK_FEATURE_SUPPORTED(TETHERING_FEATURE);
+
_retvm_if(client == NULL, TETHERING_ERROR_INVALID_PARAMETER,
"Parameter(client) is NULL\n");
_retvm_if(ip_address == NULL, TETHERING_ERROR_INVALID_PARAMETER,
return TETHERING_ERROR_NONE;
}
-int tethering_client_get_mac_address(tethering_client_h client, char **mac_address)
+API int tethering_client_get_mac_address(tethering_client_h client, char **mac_address)
{
+ CHECK_FEATURE_SUPPORTED(TETHERING_FEATURE);
+
_retvm_if(client == NULL, TETHERING_ERROR_INVALID_PARAMETER,
"Parameter(client) is NULL\n");
_retvm_if(mac_address == NULL, TETHERING_ERROR_INVALID_PARAMETER,
return TETHERING_ERROR_NONE;
}
+API int tethering_client_get_time(tethering_client_h client, time_t *timestamp)
+{
+ CHECK_FEATURE_SUPPORTED(TETHERING_FEATURE);
+
+ _retvm_if(client == NULL, TETHERING_ERROR_INVALID_PARAMETER,
+ "Parameter(client) is NULL\n");
+
+ __tethering_client_h *si = (__tethering_client_h *)client;
+
+ *timestamp = si->tm;
+
+ return TETHERING_ERROR_NONE;
+}
+