NetServices Stack source

Dependents:   HelloWorld ServoInterfaceBoardExample1 4180_Lab4

Files at this revision

API Documentation at this revision

Comitter:
donatien
Date:
Wed Jul 28 12:45:32 2010 +0000
Parent:
7:534fa46ad8c5
Child:
9:c79fa4034f5b
Commit message:

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
if/net/host.h Show annotated file Show diff for this revision Revisions of this file
if/net/ipaddr.h Show annotated file Show diff for this revision Revisions of this file
--- a/api/DNSRequest.h	Wed Jul 28 11:55:27 2010 +0000
+++ b/api/DNSRequest.h	Wed Jul 28 12:45:32 2010 +0000
@@ -21,23 +21,27 @@
 THE SOFTWARE.
 */
 
+/** \file
+DNS Request header file
+*/
+
 #ifndef DNSREQUEST_H
 #define DNSREQUEST_H
 
 #include "if/net/net.h"
 //Essentially it is a safe interface to NetDnsRequest
 
-///DNS Request Errors
+///DNS Request error codes
 enum DNSRequestErr
 {
   __DNS_MIN = -0xFFFF,
-  DNS_SETUP, ///DNSRequest not properly configured
-  DNS_IF, ///Interface has problems, does not exist or is not initialized
-  DNS_MEM, ///Not enough mem
-  DNS_INUSE, ///Interface / Port is in use
-  DNS_PROCESSING, ///Request has not completed
+  DNS_SETUP, ///<DNSRequest not properly configured
+  DNS_IF, ///<Interface has problems, does not exist or is not initialized
+  DNS_MEM, ///<Not enough mem
+  DNS_INUSE, ///<Interface / Port is in use
+  DNS_PROCESSING, ///<Request has not completed
 //...
-  DNS_OK = 0
+  DNS_OK = 0 ///<Success
 };
 
 ///DNS Request Result Events
--- a/api/TCPSocket.h	Wed Jul 28 11:55:27 2010 +0000
+++ b/api/TCPSocket.h	Wed Jul 28 12:45:32 2010 +0000
@@ -21,39 +21,43 @@
 THE SOFTWARE.
 */
 
+/** \file
+TCP Socket header file
+*/
+
 #ifndef TCPSOCKET_H
 #define TCPSOCKET_H
 
 #include "if/net/net.h"
 //Essentially it is a safe interface to NetTcpSocket
 
-///TCP Socket Errors
+///TCP Socket error codes
 enum TCPSocketErr
 {
   __TCPSOCKET_MIN = -0xFFFF,
-  TCPSOCKET_SETUP, ///TCPSocket not properly configured
-  TCPSOCKET_TIMEOUT,
-  TCPSOCKET_IF, ///Interface has problems, does not exist or is not initialized
-  TCPSOCKET_MEM, ///Not enough mem
-  TCPSOCKET_INUSE, ///Interface / Port is in use
-  TCPSOCKET_EMPTY, ///Connections queue is empty
-  TCPSOCKET_RST, ///Connection was reset by remote host
+  TCPSOCKET_SETUP, ///<TCPSocket not properly configured
+  TCPSOCKET_TIMEOUT, ///<Connection timed out
+  TCPSOCKET_IF, ///<Interface has problems, does not exist or is not initialized
+  TCPSOCKET_MEM, ///<Not enough mem
+  TCPSOCKET_INUSE, ///<Interface / Port is in use
+  TCPSOCKET_EMPTY, ///<Connections queue is empty
+  TCPSOCKET_RST, ///<Connection was reset by remote host
 //...
-  TCPSOCKET_OK = 0
+  TCPSOCKET_OK = 0 ///<Success
 };
 
 ///TCP Socket Events
 enum TCPSocketEvent
 {
-  TCPSOCKET_CONNECTED, ///Connected to host
-  TCPSOCKET_ACCEPT,  ///Client is connected, must call accept() to get a new Socket
-  TCPSOCKET_READABLE, ///Data in buf
-  TCPSOCKET_WRITEABLE, ///Can write data to buf
-  TCPSOCKET_CONTIMEOUT, ///Connection timed out
-  TCPSOCKET_CONRST, ///Connection was reset by remote host
-  TCPSOCKET_CONABRT, ///Connection was aborted
-  TCPSOCKET_ERROR, ///Unknown error
-  TCPSOCKET_DISCONNECTED ///Disconnected
+  TCPSOCKET_CONNECTED, ///<Connected to host
+  TCPSOCKET_ACCEPT,  ///<Client is connected, must call accept() to get a new Socket
+  TCPSOCKET_READABLE, ///<Data in buf
+  TCPSOCKET_WRITEABLE, ///<Can write data to buf
+  TCPSOCKET_CONTIMEOUT, ///<Connection timed out
+  TCPSOCKET_CONRST, ///<Connection was reset by remote host
+  TCPSOCKET_CONABRT, ///<Connection was aborted
+  TCPSOCKET_ERROR, ///<Unknown error
+  TCPSOCKET_DISCONNECTED ///<Disconnected
 };
 
 ///This is a simple TCP Socket class
--- a/api/UDPSocket.h	Wed Jul 28 11:55:27 2010 +0000
+++ b/api/UDPSocket.h	Wed Jul 28 12:45:32 2010 +0000
@@ -21,28 +21,32 @@
 THE SOFTWARE.
 */
 
+/** \file
+UDP Socket header file
+*/
+
 #ifndef UDPSOCKET_H
 #define UDPSOCKET_H
 
 #include "if/net/net.h"
 //Essentially it is a safe interface to NetUdpSocket
 
-///UDP Socket Errors
+///UDP Socket error codes
 enum UDPSocketErr
 {
   __UDPSOCKET_MIN = -0xFFFF,
-  UDPSOCKET_SETUP, ///UDPSocket not properly configured
-  UDPSOCKET_IF, ///Interface has problems, does not exist or is not initialized
-  UDPSOCKET_MEM, ///Not enough mem
-  UDPSOCKET_INUSE, ///Interface / Port is in use
+  UDPSOCKET_SETUP, ///<UDPSocket not properly configured
+  UDPSOCKET_IF, ///<Interface has problems, does not exist or is not initialized
+  UDPSOCKET_MEM, ///<Not enough mem
+  UDPSOCKET_INUSE, ///<Interface / Port is in use
 //...
-  UDPSOCKET_OK = 0
+  UDPSOCKET_OK = 0 ///<Success
 };
 
 ///UDP Socket Event(s)
-enum UDPSocketEvent //Only one lonely event here... but who knows, maybe some day there'll be another one!
+enum UDPSocketEvent //Only one event here for now, but keeps that model in case we need to implement some others
 {
-  UDPSOCKET_READABLE, ///Data in buf
+  UDPSOCKET_READABLE, ///<Data in buf
 };
 
 ///This is a simple UDP Socket class
--- a/if/net/host.h	Wed Jul 28 11:55:27 2010 +0000
+++ b/if/net/host.h	Wed Jul 28 12:45:32 2010 +0000
@@ -30,13 +30,23 @@
 #include "netdnsrequest.h"
 #include <string.h>
 
+///Host information container
+/**
+This class is a container for data relative to a connection:
+- IP Address
+- Port number
+- Host Name
+*/
 class Host 
 {
 public:
+  ///Initiliazes host with null values
   Host() : m_ip(0,0,0,0), m_port(0), m_name(NULL)
   {
     
   }
+  
+  ///Initializes host
   Host(const IpAddr& ip, const int& port, const char* name="" ) : m_ip(ip), m_port(port), m_name(NULL)
   {
     setName(name); 
@@ -50,31 +60,37 @@
     }
   }
   
+  ///Returns IP address
   const IpAddr& getIp() const
   {
     return m_ip;
   }
   
+  ///Returns port number
   const int& getPort() const
   {
     return m_port;
   }
   
+  ///Returns host name
   const char* getName() const
   {
     return m_name;
   }
   
+  ///Sets IP address
   void setIp(const IpAddr& ip)
   {
     m_ip = ip;
   }
   
+  ///Sets port number
   void setPort(int port)
   {
     m_port = port;
   }
   
+  ///Sets host name
   void setName(const char* name)
   {
     if(m_name)
--- a/if/net/ipaddr.h	Wed Jul 28 11:55:27 2010 +0000
+++ b/if/net/ipaddr.h	Wed Jul 28 12:45:32 2010 +0000
@@ -37,6 +37,10 @@
 
 class IpAddr;
 
+///IP Address container
+/**
+This class is a container for an IPv4 address.
+*/
 class IpAddr //Basically a C++ frontend to ip_addr_t
 {
 public:
@@ -47,6 +51,7 @@
   }
   #endif
   
+  ///Initializes IP address with provided values
   IpAddr(uint8_t ip0, uint8_t ip1, uint8_t ip2, uint8_t ip3)
   {
     //We are in LE
@@ -56,6 +61,7 @@
     m_ip[3] = ip3;
   }
   
+  ///Initializes IP address with null values 
   IpAddr()
   {
     m_ip[0] = 0;
@@ -74,6 +80,7 @@
   }
   #endif
   
+  ///Returns IP address byte #
   uint8_t operator[](unsigned int i) const
   {
     uint8_t null = 0;
@@ -82,31 +89,55 @@
     return m_ip[i];
   }
   
+  ///Compares too addresses
+  /*
+  @return true if the two addresses are equal
+  */
   bool isEq(const IpAddr& b) const
   {
     return (*((uint32_t*)m_ip) == *((uint32_t*)(b.m_ip)));
   }
   
+  ///Compares too addresses
+  /*
+  @return true if the two addresses are equal
+  */
   bool operator==(const IpAddr& b) const
   {
     return isEq(b);
   }
-  
+ 
+  ///Compares too addresses
+  /*
+  @return true if the two addresses are different
+  */ 
   bool operator!=(const IpAddr& b) const
   {
     return !(operator==(b));
   }
   
+  ///Checks whether the address is null
+  /*
+  @return true if the address is null
+  */
   bool isNull() const
   {
     return (*((uint32_t*)m_ip) == 0);
   }
   
+  ///Checks whether the address is a broadcast address
+  /*
+  @return true if the address is a broadcast address
+  */
   bool isBroadcast() const
   {
     return (*((uint32_t*)m_ip) == 0xFFFFFFFF);
   }
-  
+
+  ///Checks whether the address is a multicast address
+  /*
+  @return true if the address is a multicast address
+  */
   bool isMulticast() const
   {
     return ((m_ip[0] & 0xF0) == 0xE0);