kernel-netlink: Support extended table IDs for custom routes
[strongswan.git] / src / libcharon / network / socket_manager.h
index b33d5c7..38baaea 100644 (file)
@@ -1,4 +1,6 @@
 /*
+ * Copyright (C) 2010-2013 Tobias Brunner
+ * HSR Hochschule fuer Technik Rapperswil
  * Copyright (C) 2010 Martin Willi
  * Copyright (C) 2010 revosec AG
  *
@@ -38,7 +40,7 @@ struct socket_manager_t {
         *                                              - SUCCESS when packet successfully received
         *                                              - FAILED when unable to receive
         */
-       status_t (*receive) (socket_manager_t *this, packet_t **packet);
+       status_t (*receive)(socket_manager_t *this, packet_t **packet);
 
        /**
         * Send a packet using the registered socket.
@@ -48,17 +50,36 @@ struct socket_manager_t {
         *                                              - SUCCESS when packet successfully sent
         *                                              - FAILED when unable to send
         */
-       status_t (*send) (socket_manager_t *this, packet_t *packet);
+       status_t (*send)(socket_manager_t *this, packet_t *packet);
 
        /**
-        * Register a socket implementation.
+        * Get the port the registered socket is listening on.
+        *
+        * @param nat_t                 TRUE to get the port used to float in case of NAT-T
+        * @return                              the port, or 0, if no socket is registered
+        */
+       uint16_t (*get_port)(socket_manager_t *this, bool nat_t);
+
+       /**
+        * Get the address families the registered socket is listening on.
+        *
+        * @return                              address families
         */
-       void (*add_socket)(socket_manager_t *this, socket_t *socket);
+       socket_family_t (*supported_families)(socket_manager_t *this);
 
        /**
-        * Unregister a registered socket implementation.
+        * Register a socket constructor.
+        *
+        * @param create                constructor for the socket
+        */
+       void (*add_socket)(socket_manager_t *this, socket_constructor_t create);
+
+       /**
+        * Unregister a registered socket constructor.
+        *
+        * @param create                constructor for the socket
         */
-       void (*remove_socket)(socket_manager_t *this, socket_t *socket);
+       void (*remove_socket)(socket_manager_t *this, socket_constructor_t create);
 
        /**
         * Destroy a socket_manager_t.