X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=blobdiff_plain;f=geekos%2Finclude%2Fgeekos%2Fsocket.h;fp=geekos%2Finclude%2Fgeekos%2Fsocket.h;h=3d31d0d99380a8870b7d240894bdb8ca723488d3;hp=0000000000000000000000000000000000000000;hb=ddc16b0737cf58f7aa90a69c6652cdf4090aec51;hpb=626595465a2c6987606a6bc697df65130ad8c2d3 diff --git a/geekos/include/geekos/socket.h b/geekos/include/geekos/socket.h new file mode 100644 index 0000000..3d31d0d --- /dev/null +++ b/geekos/include/geekos/socket.h @@ -0,0 +1,55 @@ +/* + * This file is part of the Palacios Virtual Machine Monitor developed + * by the V3VEE Project with funding from the United States National + * Science Foundation and the Department of Energy. + * + * The V3VEE Project is a joint project between Northwestern University + * and the University of New Mexico. You can find out more at + * http://www.v3vee.org + * + * Copyright (c) 2008, Jack Lange + * Copyright (c) 2008, The V3VEE Project + * All rights reserved. + * + * Author: Jack Lange + * + * This is free software. You are permitted to use, + * redistribute, and modify it as specified in the file "V3VEE_LICENSE". + */ + +#ifndef GEEKOS_SOCKET_H +#define GEEKOS_SOCKET_H + +#include +#include + +#ifdef UIP +#include + + +typedef enum {WAITING, CLOSED, LISTEN, ESTABLISHED} sock_state_t; + +struct socket { + int in_use; + struct Thread_Queue recv_wait_queue; + struct ring_buffer *send_buf; + struct ring_buffer *recv_buf; + struct uip_conn *con; + + sock_state_t state; + +}; + + +void init_socket_layer(); + +int connect(const uchar_t ip_addr[4], ushort_t port); +int close(const int sockfd); +int recv(int sockfd, void * buf, uint_t len); +int send(int sockfd, void * buf, uint_t len); + +void set_ip_addr(uchar_t addr[4]); + +#endif // UIP + +#endif