Fork of NetServicesMin with some warnings removed

Dependencies:   lwip-sys lwip

Fork of NetServicesMin by Hendrik Lipka

Files at this revision

API Documentation at this revision

Comitter:
uci1
Date:
Tue Oct 30 05:20:56 2012 +0000
Parent:
1:9d93f4dc2f46
Child:
3:c3f738396920
Commit message:
Fix some code that gives warnings when compiling with gcc (forward declared enums and addresses of temporary objects).

Changed in this revision

api/DNSRequest.h Show annotated file Show diff for this revision Revisions of this file
api/TCPSocket.h Show annotated file Show diff for this revision Revisions of this file
api/UDPSocket.h Show annotated file Show diff for this revision Revisions of this file
core/host.h Show annotated file Show diff for this revision Revisions of this file
if/eth/EthernetNetIf.cpp Show annotated file Show diff for this revision Revisions of this file
if/lwip/lwipNetUdpSocket.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/api/DNSRequest.h	Wed Jul 18 20:28:43 2012 +0000
+++ b/api/DNSRequest.h	Tue Oct 30 05:20:56 2012 +0000
@@ -32,6 +32,7 @@
 #include "core/ipaddr.h"
 #include "core/host.h"
 //Essentially it is a safe interface to NetDnsRequest
+#include "if/net/netdnsrequest.h"
 
 ///DNS Request error codes
 enum DNSRequestErr
@@ -56,8 +57,8 @@
   DNS_FOUND,
 };
 
-class NetDnsRequest;
-enum NetDnsReply;
+//class NetDnsRequest;
+//enum NetDnsReply;
 
 ///This is a simple DNS Request class
 /**
--- a/api/TCPSocket.h	Wed Jul 18 20:28:43 2012 +0000
+++ b/api/TCPSocket.h	Tue Oct 30 05:20:56 2012 +0000
@@ -32,6 +32,8 @@
 #include "core/host.h"
 //Essentially it is a safe interface to NetTcpSocket
 
+#include "if/net/nettcpsocket.h"
+
 ///TCP Socket error codes
 enum TCPSocketErr
 {
@@ -61,8 +63,8 @@
   TCPSOCKET_DISCONNECTED ///<Disconnected
 };
 
-class NetTcpSocket;
-enum NetTcpSocketEvent;
+//class NetTcpSocket;
+//enum NetTcpSocketEvent;
 
 ///This is a simple TCP Socket class
 /**
--- a/api/UDPSocket.h	Wed Jul 18 20:28:43 2012 +0000
+++ b/api/UDPSocket.h	Tue Oct 30 05:20:56 2012 +0000
@@ -31,6 +31,7 @@
 #include "core/net.h"
 #include "core/host.h"
 //Essentially it is a safe interface to NetUdpSocket
+#include "if/net/netudpsocket.h"
 
 ///UDP Socket error codes
 enum UDPSocketErr
@@ -50,8 +51,8 @@
   UDPSOCKET_READABLE, ///<Data in buf
 };
 
-class NetUdpSocket;
-enum NetUdpSocketEvent;
+//class NetUdpSocket;
+//enum NetUdpSocketEvent;
 
 ///This is a simple UDP Socket class
 /**
--- a/core/host.h	Wed Jul 18 20:28:43 2012 +0000
+++ b/core/host.h	Tue Oct 30 05:20:56 2012 +0000
@@ -38,13 +38,13 @@
 {
 public:
   ///Initiliazes host with null values
-  Host() : m_ip(0,0,0,0), m_port(0), m_name(NULL)
+  Host() : m_ip(0,0,0,0), m_port(0), m_name(0)
   {
     
   }
   
   ///Initializes host
-  Host(const IpAddr& ip, const int& port, const char* name="" ) : m_ip(ip), m_port(port), m_name(NULL)
+  Host(const IpAddr& ip, const int& port, const char* name="" ) : m_ip(ip), m_port(port), m_name(0)
   {
     setName(name); 
   }
--- a/if/eth/EthernetNetIf.cpp	Wed Jul 18 20:28:43 2012 +0000
+++ b/if/eth/EthernetNetIf.cpp	Tue Oct 30 05:20:56 2012 +0000
@@ -54,7 +54,8 @@
   m_gateway = gateway;
   m_ip = ip;
   m_pNetIf = new netif;
-  dns_setserver(0, &dns.getStruct());
+  ip_addr_t dip(dns.getStruct());
+  dns_setserver(0, &dip);
   m_useDhcp = false;
   m_setup = false;
 }
@@ -107,7 +108,10 @@
   m_pNetIf->hwaddr[0], m_pNetIf->hwaddr[1], m_pNetIf->hwaddr[2],
   m_pNetIf->hwaddr[3], m_pNetIf->hwaddr[4], m_pNetIf->hwaddr[5]);
 
-  m_pNetIf = netif_add(m_pNetIf, &(m_ip.getStruct()), &(m_netmask.getStruct()), &(m_gateway.getStruct()), NULL, eth_init, ip_input);//ethernet_input);// ip_input);
+  ip_addr_t mip(m_ip.getStruct()),
+            mnm(m_netmask.getStruct()),
+            mgt((m_gateway.getStruct()));
+  m_pNetIf = netif_add(m_pNetIf, &mip, &mnm, &mgt, NULL, eth_init, ip_input);//ethernet_input);// ip_input);
   m_pNetIf->hostname = (char *)m_hostname;
   netif_set_default(m_pNetIf);
   
--- a/if/lwip/lwipNetUdpSocket.cpp	Wed Jul 18 20:28:43 2012 +0000
+++ b/if/lwip/lwipNetUdpSocket.cpp	Tue Oct 30 05:20:56 2012 +0000
@@ -97,7 +97,8 @@
     q = q->next;
   } while(q != NULL);
 
-  err_t err = udp_sendto( (udp_pcb*) m_pPcb, p, &(pHost->getIp().getStruct()), pHost->getPort() );
+  ip_addr_t hip(pHost->getIp().getStruct());
+  err_t err = udp_sendto( (udp_pcb*) m_pPcb, p, &hip, pHost->getPort() );
   pbuf_free( p );
   if(err)
     return NETUDPSOCKET_SETUP; //Connection problem