hal: Implement network interface setup
authorwootak.jung <wootak.jung@samsung.com>
Mon, 14 Jan 2013 04:58:13 +0000 (13:58 +0900)
committerwootak.jung <wootak.jung@samsung.com>
Sun, 24 Mar 2013 09:03:09 +0000 (18:03 +0900)
include/hal.h
src/hal.c
src/mux.c

index d93795a..2db1d13 100644 (file)
@@ -25,6 +25,7 @@ __BEGIN_DECLS
 
 typedef void (*TcoreHalReceiveCallback)(TcoreHal *hal, unsigned int data_len, const void *data, void *user_data);
 typedef enum tcore_hook_return (*TcoreHalSendHook)(TcoreHal *hal, unsigned int data_len, void *data, void *user_data);
+typedef void (*TcoreHalSetupNetifCallback)(CoreObject *co, const char* devname, void *user_data);
 
 enum tcore_hal_recv_data_type {
        TCORE_HAL_RECV_INDICATION,
@@ -43,6 +44,10 @@ enum tcore_hal_mode {
 struct tcore_hal_operations {
        TReturn (*power)(TcoreHal *hal, gboolean flag);
        TReturn (*send)(TcoreHal *hal, unsigned int data_len, void *data);
+       TReturn (*setup_netif)(CoreObject *co,
+                               TcoreHalSetupNetifCallback func,
+                               void *user_data, unsigned int cid,
+                               gboolean enable);
 };
 
 TcoreHal*    tcore_hal_new(TcorePlugin *plugin, const char *name,
@@ -86,6 +91,12 @@ gboolean     tcore_hal_get_power_state(TcoreHal *hal);
 TcoreQueue*  tcore_hal_ref_queue(TcoreHal *hal);
 TcorePlugin* tcore_hal_ref_plugin(TcoreHal *hal);
 
+TReturn      tcore_hal_setup_netif(TcoreHal *hal, CoreObject *co,
+                                       TcoreHalSetupNetifCallback func,
+                                       void *user_data, unsigned int cid,
+                                       gboolean enable);
+
+
 __END_DECLS
 
 #endif
index 5453b83..c5d901b 100644 (file)
--- a/src/hal.c
+++ b/src/hal.c
@@ -508,3 +508,14 @@ TReturn tcore_hal_set_power(TcoreHal *hal, gboolean flag)
 
        return hal->ops->power(hal, flag);
 }
+
+TReturn tcore_hal_setup_netif(TcoreHal *hal, CoreObject *co,
+                               TcoreHalSetupNetifCallback func,
+                               void *user_data, unsigned int cid,
+                               gboolean enable)
+{
+       if (!hal || !hal->ops || !hal->ops->setup_netif)
+               return TCORE_RETURN_EINVAL;
+
+       return hal->ops->setup_netif(co, func, user_data, cid, enable);
+}
index a1b1bca..5124ec9 100755 (executable)
--- a/src/mux.c
+++ b/src/mux.c
@@ -283,10 +283,24 @@ static TReturn tcore_cmux_hal_send(TcoreHal *h, unsigned int data_len, void *dat
        return TCORE_RETURN_SUCCESS;
 }
 
+static TReturn tcore_cmux_hal_setup_netif(CoreObject *co,
+                                       TcoreHalSetupNetifCallback func,
+                                       void *user_data, unsigned int cid,
+                                       gboolean enable)
+{
+       TcoreHal *hal = g_mux_obj_ptr->phy_hal;
+
+       if (hal == NULL)
+               return TCORE_RETURN_EINVAL;
+
+       return tcore_hal_setup_netif(hal, co, func, user_data, cid, enable);
+}
+
 /* CMUX supported HAL (Logical HAL) operations */
 static struct tcore_hal_operations mux_hops = {
        .power = tcore_cmux_hal_power,
        .send = tcore_cmux_hal_send,
+       .setup_netif = tcore_cmux_hal_setup_netif,
 };
 
 static TReturn tcore_cmux_send_data(int data_len, unsigned char *data)