Daiki Kato / DhcpServer_mbed-os

Fork of DhcpServer by Daiki Kato

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers DhcpServer.h Source File

DhcpServer.h

Go to the documentation of this file.
00001 /**************************************************************************//**
00002 * @file          DhcpServer.h
00003 * @brief         DhcpServer API
00004 ******************************************************************************/
00005 #ifndef DHCP_SERVER_H_
00006 #define DHCP_SERVER_H_
00007 
00008 /** This class is intended for use the mbed board as a DHCP server.
00009  *  This class can be allocated five IP addresses.
00010  *  Top 3byte of IP address is the same as the server address, the lower 1byte is 10-14 is allocated.
00011  *  For example, if the server address is "192.168.0.1", IP address will be allocated "192.168.0.10" ~ "192.168.0.14".
00012  */
00013 class DhcpServer {
00014 public:
00015     /** Constructor: Initializes DhcpServer.
00016      *
00017      * @param net Common interface that is shared between network devices
00018      * @param name a pointer to a string containing the server name. (e.g."ServerName")
00019      */
00020     DhcpServer(NetworkInterface *net, const char * name);
00021 
00022     /** Destructor
00023      *
00024      */
00025     virtual ~DhcpServer();
00026 
00027 private:
00028     #define CONNECT_NUM    (5)
00029 
00030     UDPSocket dhcp_server;
00031     Thread dhcpThread;
00032     char * receivebuff;
00033     char * sendbuff;
00034     char chaddr_tbl[CONNECT_NUM][6];
00035 
00036     void dhcp_process(void);
00037 };
00038 #endif /* DHCP_SERVER_H_ */