X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Finclude%2Fpalacios%2Fvmm_socket.h;h=eb87f7193a6fc9f17b5533c24221a97d2068592c;hb=50b2cfeb17c210c307b380fd90ae7e82c7d144ca;hp=92a916dd1b532f55c3bc3876b070e28bff4c1e3c;hpb=3e574cb7846755c126d1734737b4efad99dad091;p=palacios.git diff --git a/palacios/include/palacios/vmm_socket.h b/palacios/include/palacios/vmm_socket.h index 92a916d..eb87f71 100644 --- a/palacios/include/palacios/vmm_socket.h +++ b/palacios/include/palacios/vmm_socket.h @@ -23,7 +23,7 @@ #include -#define V3_SOCK void * +#define V3_SOCK long #ifdef __V3VEE__ @@ -61,23 +61,33 @@ #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; \ @@ -203,7 +213,7 @@ void v3_zero_sockset(struct v3_sock_set * sock_set); // clears all is_set var struct v3_socket_hooks { // Socket creation routines -xsxsxsxsxs V3_SOCK (*tcp_socket)(const int bufsize, const int nodelay, const int nonblocking); + V3_SOCK (*tcp_socket)(const int bufsize, const int nodelay, const int nonblocking); V3_SOCK (*udp_socket)(const int bufsize, const int nonblocking); // Socket Destruction @@ -214,7 +224,7 @@ xsxsxsxsxs V3_SOCK (*tcp_socket)(const int bufsize, const int nodelay, const in int (*listen)(const V3_SOCK sock, int backlog); - V3_SOCK (*accept)(const V3_SOCK const sock, unsigned int * remote_ip, unsigned int * port); + 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, \ @@ -244,5 +254,4 @@ xsxsxsxsxs V3_SOCK (*tcp_socket)(const int bufsize, const int nodelay, const in extern void V3_Init_Sockets(struct v3_socket_hooks * hooks); - #endif