OSDN Git Service

APIPAの為のAPI追加
[mimic/MiMicSDK.git] / lib / src / net / NyLPC_cNetConfig.h
1 /*********************************************************************************\r
2  * PROJECT: MiMic\r
3  * --------------------------------------------------------------------------------\r
4  *\r
5  * This file is part of MiMic\r
6  * Copyright (C)2011 Ryo Iizuka\r
7  *\r
8  * MiMic is free software: you can redistribute it and/or modify\r
9  * it under the terms of the GNU Lesser General Public License as published\r
10  * by the Free Software Foundation, either version 3 of the License, or\r
11  * (at your option) any later version.\r
12  *\r
13  * This program is distributed in the hope that it will be useful,\r
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
16  * GNU General Public License for more details.\r
17  *\r
18  * You should have received a copy of the GNU Lesser General Public License\r
19  * along with this program.  If not, see <http://www.gnu.org/licenses/>.\r
20  *\r
21  * For further information please contact.\r
22  *      http://nyatla.jp/\r
23  *      <airmail(at)ebony.plala.or.jp> or <nyatla(at)nyatla.jp>\r
24  *\r
25  *********************************************************************************/\r
26 #ifndef NYLPC_CNETCONFIG_H_\r
27 #define NYLPC_CNETCONFIG_H_\r
28 \r
29 #include "NyLPC_stdlib.h"\r
30 #include "NyLPC_uipService.h"\r
31 #ifdef __cplusplus\r
32 extern "C" {\r
33 #endif /* __cplusplus */\r
34 #define NyLPC_cNetConfig_INTERFACE_TYPE_ETHERNET 1\r
35 \r
36 /**\r
37  * クラス型を定義します。\r
38  * NyLPC_cNetConfigクラスは、NyLPC_NetConfigの初期化データを保持します。\r
39  * 初期化データのロード・セーブ機能を提供します。\r
40  */\r
41 typedef struct NyLPC_TcNetConfig NyLPC_TcNetConfig_t;\r
42 \r
43 \r
44 /**\r
45  * NyLPC_TcFifoBufferクラスの構造体です。\r
46  */\r
47 struct NyLPC_TcNetConfig\r
48 {\r
49         /** Must be 1*/\r
50         NyLPC_TUInt16 version;\r
51         /** インタフェイスタイプ*/\r
52         NyLPC_TUInt16 interface_type;\r
53         /** インタフェイス層の設定*/\r
54         union{\r
55                 /** Ethernet mac address */\r
56                 NyLPC_TcIPv4Config_t ethernet;\r
57 //\r
58 //              struct{\r
59 //                      struct NyLPC_TEthAddr mac_addr;\r
60 //              }ethernet2;\r
61         }interface_setting;\r
62 };\r
63 \r
64 /**\r
65  * フラッシュメモリから設定値を読み出して、インスタンスを初期化します。\r
66  * @param i_is_factory_default\r
67  * 出荷時設定を読み出すかを設定します。\r
68  */\r
69 void NyLPC_cNetConfig_initialize(NyLPC_TcNetConfig_t* i_inst,NyLPC_TBool i_is_factory_default);\r
70 \r
71 \r
72 /**\r
73  * インスタンスを終期化します。\r
74  */\r
75 #define NyLPC_cNetConfig_finalize(i_inst);\r
76 \r
77 #define NyLPC_cNetConfig_setIpAddr(i_inst,ip1,ip2,ip3,ip4) NyLPC_TIPv4Addr_set(&((i_inst)->interface_setting.ethernet.ip_addr),(ip1),(ip2),(ip3),(ip4));\r
78 \r
79 /**\r
80  * Set IPv4 network mask value to instance.\r
81  */\r
82 #define NyLPC_cNetConfig_setNetMask(i_inst,ip1,ip2,ip3,ip4) NyLPC_TIPv4Addr_set(&((i_inst)->interface_setting.ethernet.netmask),(ip1),(ip2),(ip3),(ip4));\r
83 \r
84 /**\r
85  * Set IPv4 default gateway address to instance.\r
86  */\r
87 #define NyLPC_cNetConfig_setGateway(i_inst,ip1,ip2,ip3,ip4) NyLPC_TIPv4Addr_set(&((i_inst)->interface_setting.ethernet.dr_addr),(ip1),(ip2),(ip3),(ip4));\r
88 \r
89 /**\r
90  * Set ethernet mac address to instance.\r
91  */\r
92 #define NyLPC_cNetConfig_setEmac(i_inst,a1,a2,a3,a4,a5,a6) NyLPC_TEthAddr_set(&((i_inst)->interface_setting.ethernet.eth_mac),(a1),(a2),(a3),(a4),(a5),(a6));\r
93 \r
94 \r
95 \r
96 #ifdef __cplusplus\r
97 }\r
98 #endif /* __cplusplus */\r
99 #endif /* NYLPC_CNETCONFIG_H_ */\r