OSDN Git Service

update libMiMic
[mimic/MiMicSDK.git] / lib / src / net / mdns / NyLPC_cMDnsServer.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_CMDNSSERVER_H_\r
27 #define NYLPC_CMDNSSERVER_H_\r
28 #include "NyLPC_netif.h"\r
29 \r
30 #ifdef __cplusplus\r
31 extern "C" {\r
32 #endif /* __cplusplus */\r
33 \r
34 \r
35 /**\r
36  * NyLPC_TDnsRecordで使用するサービスレコード\r
37  */\r
38 struct NyLPC_TMDnsServiceRecord\r
39 {\r
40     const char* protocol;\r
41     NyLPC_TUInt16 port;\r
42 };\r
43 /**\r
44  * DNSレコード\r
45  */\r
46 struct NyLPC_TDnsRecord\r
47 {\r
48     /** Service name*/\r
49     const NyLPC_TChar* name;\r
50     /** Host name recommended name[:emac:]*/\r
51     const NyLPC_TChar* a;\r
52     /**\r
53      * 配列の数\r
54      */\r
55     NyLPC_TUInt16 num_of_srv;\r
56     const struct NyLPC_TMDnsServiceRecord* srv;\r
57 };\r
58 \r
59 \r
60 \r
61 /**\r
62  * MDNSサーバクラス\r
63  */\r
64 typedef struct NyLPC_TcMDnsServer NyLPC_TcMDnsServer_t;\r
65 \r
66 \r
67 \r
68 struct NyLPC_TcMDnsServer\r
69 {\r
70     /** マルチキャストのUDPソケット*/\r
71     NyLPC_TiUdpSocket_t* _socket;\r
72     /**周期実行タイマ*/\r
73     NyLPC_TcStopwatch_t _periodic_sw;\r
74     /** 動作モード(private)*/\r
75     NyLPC_TUInt8 _state;\r
76     NyLPC_TUInt8 _state_val;\r
77     NyLPC_TUInt8 _padding[2];\r
78     /** DNSレコードの参照情報*/\r
79     const struct NyLPC_TDnsRecord* _ref_record;\r
80 };\r
81 \r
82 /**\r
83  * スケッチシステムの場合、この関数はsetup時に実行してください。\r
84  * @param i_ref_record\r
85  * DNSレコードの参照値。インスタンス\r
86  */\r
87 NyLPC_TBool NyLPC_cMDnsServer_initialize(\r
88     NyLPC_TcMDnsServer_t* i_inst,const struct NyLPC_TDnsRecord* i_ref_record);\r
89 \r
90 void NyLPC_cMDnsServer_finalize(\r
91     NyLPC_TcMDnsServer_t* i_inst);\r
92 \r
93 void NyLPC_cMDnsServer_periodicRecvProc(NyLPC_TcMDnsServer_t* i_inst);\r
94 /**\r
95  * mDNSサービスを開始します。\r
96  * 関数はstop関数をコールするまでの間ブロックします。\r
97  */\r
98 void NyLPC_cMDnsServer_start(NyLPC_TcMDnsServer_t* i_inst);\r
99 /**\r
100  * mDNSサービスを停止します。\r
101  * 関数はサービスが停止するまでブロックします。\r
102  */\r
103 void NyLPC_cMDnsServer_stop(NyLPC_TcMDnsServer_t* i_inst);\r
104 \r
105 \r
106 #ifdef __cplusplus\r
107 }\r
108 #endif /* __cplusplus */\r
109 \r
110 #endif\r