Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

# ip.h

Go to the documentation of this file.

    00001 /*! \file ip.h \brief IP (Internet Protocol) Library. */
    00002 //*****************************************************************************
    00003 //
    00004 // File Name    : 'ip.h'
    00005 // Title        : IP (Internet Protocol) Library
    00006 // Author       : Pascal Stang
    00007 // Created      : 8/30/2004
    00008 // Revised      : 7/3/2005
    00009 // Version      : 0.1
    00010 // Target MCU   : Atmel AVR series
    00011 // Editor Tabs  : 4
    00012 //
    00013 /// \ingroup network
    00014 /// \defgroup ip IP (Internet Protocol) Library (ip.c)
    00015 /// \code #include "net/ip.h" \endcode
    00016 /// \par Description
    00017 ///     The IP (Internet Protocol) library provide support for sending IP and
    00018 ///     IP-related packets.  It's not clear if additional features are needed
    00019 ///     or will be added, or even if this is the proper way to facilitate IP
    00020 ///     packet operations.
    00021 //
    00022 //  This code is distributed under the GNU Public License
    00023 //      which can be found at http://www.gnu.org/licenses/gpl.txt
    00024 //*****************************************************************************
    00025 //@{
    00026
    00027 #ifndef IP_H
    00028 #define IP_H
    00029
    00030 #include "net.h"
    00031 #include "arp.h"
    00032
    00033 #include <stdint.h>
    00034
    00035 struct ipConfig             ///< IP addressing/configuration structure
    00036 {
    00037     uint32_t ip;            ///< IP address
    00038     uint32_t netmask;       ///< netmask
    00039     uint32_t gateway;       ///< gateway IP address
    00040 };
    00041
    00042 #define IP_TIME_TO_LIVE     128     ///< default Time-To-Live (TTL) value to use in IP headers
    00043
    00044 //! Set our IP address and routing information.
    00045 /// The myIp value will be used in the source field of IP packets.
    00046 /// Use this function to set and reset the system IP address.
    00047 void ipSetConfig(uint32_t myIp, uint32_t netmask, uint32_t gatewayIp);
    00048
    00049 //! Get our local IP address.
    00050 /// Returns current IP address value.
    00051 //uint32_t ipGetMyAddress(void);
    00052
    00053 //! Get our local IP configuration.
    00054 /// Returns pointer to current IP address/configuration.
    00055 struct ipConfig* ipGetConfig(void);
    00056
    00057 //! Print IP configuration
    00058 ///
    00059 void ipPrintConfig(struct ipConfig* config);
    00060
    00061
    00062 //! Send an IP packet.
    00063 void ipSend(uint32_t dstIp, uint8_t protocol, uint16_t len, uint8_t* data);
    00064
    00065 //! Send a UDP/IP packet.
    00066 void udpSend(uint32_t dstIp, uint16_t dstPort, uint16_t len, uint8_t* data);
    00067
    00068 #endif
    00069 //@}
    00070