OSDN Git Service

add mbed.html
[mimic/MiMicSDK.git] / lib / src / netif / dhcp / NyLPC_cDhcpClient.h
1 /*********************************************************************************
2  * PROJECT: MiMic
3  * --------------------------------------------------------------------------------
4  *
5  * This file is part of MiMic
6  * Copyright (C)2011-2013 Ryo Iizuka
7  *
8  * MiMic is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License as published
10  * by the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20  *
21  * For further information please contact.
22  *  http://nyatla.jp/
23  *  <airmail(at)ebony.plala.or.jp> or <nyatla(at)nyatla.jp>
24  *
25  *********************************************************************************/
26 #ifndef NYLPC_CDHCPCLIENT_H_
27 #define NYLPC_CDHCPCLIENT_H_
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif /* __cplusplus */
32 #include "NyLPC_stdlib.h"
33 #include "../NyLPC_iUdpSocket.h"
34 #include "../NyLPC_cIPv4Config.h"
35
36 typedef struct NyLPC_TcDhcpClient NyLPC_TcDhcpClient_t;
37
38 struct NyLPC_TcDhcpClient{
39     NyLPC_TiUdpSocket_t* _socket;
40     NyLPC_TcIPv4Config_t* _result;
41     NyLPC_TUInt32 txid;
42     volatile NyLPC_TUInt16 _status;
43     //offer情報
44     struct NyLPC_TIPv4Addr _offerserver;
45 };
46
47
48 /**
49  * DHCPソケットを作成します。
50  */
51 NyLPC_TBool NyLPC_cDhcpClient_initialize(NyLPC_TcDhcpClient_t* i_inst);
52
53 void NyLPC_cDhcpClient_finalize(NyLPC_TcDhcpClient_t* i_inst);
54
55 /**
56  * NyLPC_TcIPv4Config_tをDHCPで更新します。
57  * この関数をコールする時は、サービスは停止中でなければなりません。
58  * @param i_cfg
59  * 更新するi_cfg構造体。
60  * emac,default_mssは設定済である必要があります。他のフィールド値は不定で構いません。
61  * 更新されるフィールドは、ip,netmast,default_rootの3つです。
62  * @return
63  * 更新に成功した場合TRUE
64  */
65 NyLPC_TBool NyLPC_cDhcpClient_requestAddr(NyLPC_TcDhcpClient_t* i_inst,NyLPC_TcIPv4Config_t* i_cfg,NyLPC_TInt16 i_repeat);
66
67
68
69
70 #ifdef __cplusplus
71 }
72 #endif /* __cplusplus */
73
74 #endif