Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Modify Socket, Make V3_SOCK long
[palacios.git] / palacios / include / palacios / vmm_socket.h
index bd88682..eb87f71 100644 (file)
@@ -23,7 +23,7 @@
 
 #include <palacios/vmm.h>
 
-#define V3_SOCK void *
+#define V3_SOCK long
 
 #ifdef __V3VEE__
 
 #define V3_Bind_Socket(sock, port) ({                          \
       extern struct v3_socket_hooks * sock_hooks;              \
       int ret = -1;                                            \
-      if ((sock_hooks) && (sock_hooks)->bind) {                        \
-       ret = (sock_hooks)->bind(sock, port);                   \
+      if ((sock_hooks) && (sock_hooks)->bind_socket) {                 \
+       ret = (sock_hooks)->bind_socket(sock, port);                    \
       }                                                                \
       ret;                                                     \
     })
 
 
-#define V3_Accept_Socket(sock, ip_ptr) ({                      \
+#define V3_Listen_Socket(sock, backlog) ({                             \
       extern struct v3_socket_hooks * sock_hooks;              \
       int ret = -1;                                            \
-      if ((sock_hooks) && (sock_hooks)->accept) {              \
-       ret = (sock_hooks)->accept(sock, ip_ptr);               \
+      if ((sock_hooks) && (sock_hooks)->listen) {                      \
+       ret = (sock_hooks)->listen(sock, backlog);                      \
       }                                                                \
       ret;                                                     \
     })
 
 
+#define V3_Accept_Socket(sock, ip_ptr, port_ptr) ({                    \
+      extern struct v3_socket_hooks * sock_hooks;              \
+      V3_SOCK client_sock = 0;                                         \
+      if ((sock_hooks) && (sock_hooks)->accept) {              \
+       client_sock = (sock_hooks)->accept(sock, ip_ptr, port_ptr);             \
+      }                                                                \
+      client_sock;                                                     \
+    })
+
+
 #define V3_Select_Socket(rset,wset,eset,tv) ({                 \
       extern struct v3_socket_hooks * sock_hooks;              \
       int ret = -1;                                            \
@@ -211,8 +221,10 @@ struct v3_socket_hooks {
 
   // Network Server Calls
   int (*bind_socket)(const V3_SOCK sock, const int port);
+
+  int (*listen)(const V3_SOCK sock, int backlog);
   
-  int (*accept)(const V3_SOCK const sock, unsigned int * remote_ip);
+  V3_SOCK (*accept)(const V3_SOCK sock, unsigned int * remote_ip, unsigned int * port);
   // This going to suck
   int (*select)(struct v3_sock_set * rset, \
                struct v3_sock_set * wset, \
@@ -240,7 +252,6 @@ struct v3_socket_hooks {
 };
 
 
-void V3_Init_Socket(struct v3_socket_hooks * hooks);
-
+extern void V3_Init_Sockets(struct v3_socket_hooks * hooks);
 
 #endif