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.


Merge branch 'lwip_dev' into devel
[palacios.git] / geekos / src / geekos / socket.c
index f042064..e67040b 100644 (file)
 #include <geekos/socket.h>
 #include <geekos/malloc.h>
 #include <geekos/ne2k.h>
+
+#ifdef UIP
+
 #include <uip/uip.h>
 #include <uip/uip_arp.h>
+
 #include <geekos/vmm_stubs.h>
 #include <geekos/debug.h>
 #include <geekos/timer.h>
 
-
 #define BUF ((struct uip_eth_hdr *)&uip_buf[0])
 
 #define MAX_SOCKS 1024
@@ -42,12 +45,11 @@ void socket_appcall(void);
 #endif /* UIP_APPCALL */
 
 
-
-
 static int Packet_Received(struct NE2K_Packet_Info* info, uchar_t *pkt);
 static void periodic_caller(int timer_id, void * arg);
 
 void init_socket_layer() {
+       
    int i = 0;
    bool iflag;
 
@@ -59,31 +61,24 @@ void init_socket_layer() {
       sockets[i].state = CLOSED;
    }
 
-
-
     //initiate uIP
     uip_init();
     uip_arp_init();
        
-    //setup device driver
-    Init_Ne2k(&Packet_Received);
+    //setup device driver 
+    Init_Ne2k(&Packet_Received); 
 
     iflag = Begin_Int_Atomic();
     Start_Timer(2, periodic_caller, NULL);
     End_Int_Atomic(iflag);
-
 }
 
-
-
-
 void set_ip_addr(uchar_t addr[4]) {
   uip_ipaddr_t ipaddr;
   uip_ipaddr(ipaddr, addr[0], addr[1], addr[2], addr[3]);  /* Local IP address */
   uip_sethostaddr(ipaddr);
 }
 
-
 static int allocate_socket_fd() {
   int i = 0;
   
@@ -124,7 +119,6 @@ struct socket * get_socket_from_fd(int fd) {
 }
 
 
-
 static void periodic_caller(int timer_id, void * arg) {
   int i;
   //handle the periodic calls of uIP
@@ -379,3 +373,6 @@ static int Packet_Received(struct NE2K_Packet_Info * info, uchar_t * pkt) {
 
   return 0;
 }
+
+
+#endif  /* UIP */