X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Finclude%2Fpalacios%2Fvmm_socket.h;h=2108d57af67d72a0ba82ef0a7dd1e726063ea830;hb=de6084de2145f3889a16d8498e5e7d44e96e0162;hp=deeb1a45f779c5ac24e0a1082020e764ec987f8b;hpb=9b4bfeefac09294a6f0ae12dbadf102eb547f5ec;p=palacios.git diff --git a/palacios/include/palacios/vmm_socket.h b/palacios/include/palacios/vmm_socket.h index deeb1a4..2108d57 100644 --- a/palacios/include/palacios/vmm_socket.h +++ b/palacios/include/palacios/vmm_socket.h @@ -41,7 +41,7 @@ extern struct v3_socket_hooks * sock_hooks; \ int sock = 0; \ if ((sock_hooks) && (sock_hooks)->tcp_socket) { \ - sock = (sock_hooks)->tcp_socket(0,0,0); \ + sock = (sock_hooks)->tcp_socket(0,1,0); \ } \ sock; \ }) @@ -183,6 +183,15 @@ #define V3_SOCK_ZERO(p) memset((void*)(p), 0, sizeof(*(p))) +uint32_t v3_inet_addr(const char * ip_str); +char * v3_inet_ntoa(uint32_t addr); +uint16_t v3_htons(uint16_t s); +uint16_t v3_ntohs(uint16_t s); +uint32_t v3_htonl(uint32_t s); +uint32_t v3_ntohl(uint32_t s); + + + #endif @@ -195,41 +204,41 @@ struct v3_timeval { #define V3_SOCK_SETSIZE 1000 typedef struct v3_sock_set { - // This format needs to match the standard posix FD_SET format, so it can be cast + /* This format needs to match the standard posix FD_SET format, so it can be cast */ unsigned char fd_bits [(V3_SOCK_SETSIZE + 7) / 8]; } v3_sock_set; struct v3_socket_hooks { - // Socket creation routines + /* Socket creation routines */ int (*tcp_socket)(const int bufsize, const int nodelay, const int nonblocking); int (*udp_socket)(const int bufsize, const int nonblocking); - // Socket Destruction + /* Socket Destruction */ void (*close)(int sock); - // Network Server Calls + /* Network Server Calls */ int (*bind_socket)(const int sock, const int port); int (*listen)(const int sock, int backlog); int (*accept)(const int sock, unsigned int * remote_ip, unsigned int * port); - // This going to suck + /* This going to suck */ int (*select)(struct v3_sock_set * rset, \ struct v3_sock_set * wset, \ struct v3_sock_set * eset, \ struct v3_timeval tv); - // Connect calls + /* Connect calls */ int (*connect_to_ip)(const int sock, const int hostip, const int port); int (*connect_to_host)(const int sock, const char * hostname, const int port); - // TCP Data Transfer + /* TCP Data Transfer */ int (*send)(const int sock, const char * buf, const int len); int (*recv)(const int sock, char * buf, const int len); - // UDP Data Transfer + /* UDP Data Transfer */ int (*sendto_host)(const int sock, const char * hostname, const int port, const char * buf, const int len); int (*sendto_ip)(const int sock, const int ip_addr, const int port,