DhcpServer library for mbed-os.
Fork of DhcpServer by
mbedボードをDHCPサーバとして使用するためのライブラリです。mbedボードとPCを直結する際などに使用してください。
このクラスは5つのIPアドレスを割り当てられることができます。
IPアドレスの上位3バイトはサーバーアドレスと同じで、下の1バイトは、10-14が割り当てられます。
例えば、サーバーアドレスが"192.168.0.1"の場合、IPアドレスは"192.168.0.10"~"192.168.0.14"が割り当てられます。
EthernetInterfaceでconnectを実行した後に、DhcpServerを使用してください。
EthernetInterface eth; eth.init("192.168.0.1", "255.255.255.0", "192.168.0.1"); eth.connect(); DhcpServer dhcp_server(ð, "HostName");
Library in Beta!
This library is in Beta.
このライブラリはβ版です。
Diff: DhcpServer.h
- Revision:
- 2:4a34731d231e
- Parent:
- 1:14ee6da645a9
- Child:
- 3:bdea854c0ec8
--- a/DhcpServer.h Wed Apr 06 03:11:10 2016 +0000 +++ b/DhcpServer.h Tue Jun 20 10:32:37 2017 +0000 @@ -14,14 +14,25 @@ public: /** Constructor: Initializes DhcpServer. * + * @param net Common interface that is shared between network devices * @param name a pointer to a string containing the server name. (e.g."ServerName") - * @param ipadder a pointer to a string containing the server IP address. (e.g."192.168.0.1") */ - DhcpServer(char * name, char * ipadder); + DhcpServer(NetworkInterface *net, char * name); /** Destructor * */ virtual ~DhcpServer(); + +private: + #define CONNECT_NUM (5) + + UDPSocket dhcp_server; + Thread dhcpThread; + char * receivebuff; + char * sendbuff; + char chaddr_tbl[CONNECT_NUM][6]; + + void dhcp_process(void); }; #endif /* DHCP_SERVER_H_ */