Dhcp server sample.
Dependents: GR-PEACH_WebCamera_AP
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", eth.getIPAddress());
Library in Beta!
This library is in Beta.
このライブラリはβ版です。
DhcpServer.h@1:14ee6da645a9, 2016-04-06 (annotated)
- Committer:
- dkato
- Date:
- Wed Apr 06 03:11:10 2016 +0000
- Revision:
- 1:14ee6da645a9
- Parent:
- 0:1c2747611cab
Add documents
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dkato | 1:14ee6da645a9 | 1 | /**************************************************************************//** |
dkato | 1:14ee6da645a9 | 2 | * @file DhcpServer.h |
dkato | 1:14ee6da645a9 | 3 | * @brief DhcpServer API |
dkato | 1:14ee6da645a9 | 4 | ******************************************************************************/ |
dkato | 0:1c2747611cab | 5 | #ifndef DHCP_SERVER_H_ |
dkato | 0:1c2747611cab | 6 | #define DHCP_SERVER_H_ |
dkato | 0:1c2747611cab | 7 | |
dkato | 1:14ee6da645a9 | 8 | /** This class is intended for use the mbed board as a DHCP server. |
dkato | 1:14ee6da645a9 | 9 | * This class can be allocated five IP addresses. |
dkato | 1:14ee6da645a9 | 10 | * Top 3byte of IP address is the same as the server address, the lower 1byte is 10-14 is allocated. |
dkato | 1:14ee6da645a9 | 11 | * For example, if the server address is "192.168.0.1", IP address will be allocated "192.168.0.10" ~ "192.168.0.14". |
dkato | 1:14ee6da645a9 | 12 | */ |
dkato | 0:1c2747611cab | 13 | class DhcpServer { |
dkato | 0:1c2747611cab | 14 | public: |
dkato | 1:14ee6da645a9 | 15 | /** Constructor: Initializes DhcpServer. |
dkato | 1:14ee6da645a9 | 16 | * |
dkato | 1:14ee6da645a9 | 17 | * @param name a pointer to a string containing the server name. (e.g."ServerName") |
dkato | 1:14ee6da645a9 | 18 | * @param ipadder a pointer to a string containing the server IP address. (e.g."192.168.0.1") |
dkato | 1:14ee6da645a9 | 19 | */ |
dkato | 0:1c2747611cab | 20 | DhcpServer(char * name, char * ipadder); |
dkato | 1:14ee6da645a9 | 21 | |
dkato | 1:14ee6da645a9 | 22 | /** Destructor |
dkato | 1:14ee6da645a9 | 23 | * |
dkato | 1:14ee6da645a9 | 24 | */ |
dkato | 0:1c2747611cab | 25 | virtual ~DhcpServer(); |
dkato | 0:1c2747611cab | 26 | }; |
dkato | 1:14ee6da645a9 | 27 | #endif /* DHCP_SERVER_H_ */ |