Add skeletons for IP operation callbacks
authorMarcel Holtmann <marcel@holtmann.org>
Mon, 10 Aug 2009 01:49:52 +0000 (18:49 -0700)
committerMarcel Holtmann <marcel@holtmann.org>
Mon, 10 Aug 2009 01:49:52 +0000 (18:49 -0700)
include/ipconfig.h
src/ipconfig.c

index e347063..ad7cbc6 100644 (file)
@@ -47,10 +47,23 @@ enum connman_ipconfig_method {
 
 struct connman_ipconfig;
 
+struct connman_ipconfig_ops {
+       void (*up) (struct connman_ipconfig *ipconfig);
+       void (*down) (struct connman_ipconfig *ipconfig);
+       void (*lower_up) (struct connman_ipconfig *ipconfig);
+       void (*lower_down) (struct connman_ipconfig *ipconfig);
+};
+
 struct connman_ipconfig *connman_ipconfig_create(int index);
 struct connman_ipconfig *connman_ipconfig_ref(struct connman_ipconfig *ipconfig);
 void connman_ipconfig_unref(struct connman_ipconfig *ipconfig);
 
+void *connman_ipconfig_get_data(struct connman_ipconfig *ipconfig);
+void connman_ipconfig_set_data(struct connman_ipconfig *ipconfig, void *data);
+
+void connman_ipconfig_set_ops(struct connman_ipconfig *ipconfig,
+                                       struct connman_ipconfig_ops *ops);
+
 int connman_ipconfig_set_method(struct connman_ipconfig *ipconfig,
                                        enum connman_ipconfig_method method);
 
index 013a14f..2fd3559 100644 (file)
@@ -44,6 +44,10 @@ struct connman_ipconfig {
        char *interface;
        unsigned short type;
        unsigned int flags;
+
+       struct connman_ipconfig_ops *ops;
+       void *ops_data;
+
        enum connman_ipconfig_method method;
        GSList *address_list;
        char *gateway;
@@ -146,6 +150,42 @@ void connman_ipconfig_unref(struct connman_ipconfig *ipconfig)
 }
 
 /**
+ * connman_ipconfig_get_data:
+ * @ipconfig: ipconfig structure
+ *
+ * Get private data pointer
+ */
+void *connman_ipconfig_get_data(struct connman_ipconfig *ipconfig)
+{
+       return ipconfig->ops_data;
+}
+
+/**
+ * connman_ipconfig_set_data:
+ * @ipconfig: ipconfig structure
+ * @data: data pointer
+ *
+ * Set private data pointer
+ */
+void connman_ipconfig_set_data(struct connman_ipconfig *ipconfig, void *data)
+{
+       ipconfig->ops_data = data;
+}
+
+/**
+ * connman_ipconfig_set_ops:
+ * @ipconfig: ipconfig structure
+ * @ops: operation callbacks
+ *
+ * Set the operation callbacks
+ */
+void connman_ipconfig_set_ops(struct connman_ipconfig *ipconfig,
+                                       struct connman_ipconfig_ops *ops)
+{
+       ipconfig->ops = ops;
+}
+
+/**
  * connman_ipconfig_set_method:
  * @ipconfig: ipconfig structure
  * @method: configuration method