OSDN Git Service

add mbed.html
[mimic/MiMicSDK.git] / lib / src / uip / NyLPC_cUipService.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  * Parts of this file were leveraged from uIP:\r
27  *\r
28  * Copyright (c) 2001-2003, Adam Dunkels.\r
29  * All rights reserved.\r
30  *\r
31  * Redistribution and use in source and binary forms, with or without\r
32  * modification, are permitted provided that the following conditions\r
33  * are met:\r
34  * 1. Redistributions of source code must retain the above copyright\r
35  *    notice, this list of conditions and the following disclaimer.\r
36  * 2. Redistributions in binary form must reproduce the above copyright\r
37  *    notice, this list of conditions and the following disclaimer in the\r
38  *    documentation and/or other materials provided with the distribution.\r
39  * 3. The name of the author may not be used to endorse or promote\r
40  *    products derived from this software without specific prior\r
41  *    written permission.\r
42  *\r
43  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS\r
44  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r
45  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
46  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY\r
47  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
48  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE\r
49  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r
50  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\r
51  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r
52  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r
53  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
54  */\r
55 #ifndef NyLPC_TcUipService_H_\r
56 #define NyLPC_TcUipService_H_\r
57 \r
58 \r
59 /**********************************************************************\r
60  * Heder files
61  **********************************************************************/\r
62 \r
63 #include "NyLPC_cTcpSocket.h"\r
64 #include "NyLPC_cTcpListener.h"\r
65 #include "NyLPC_cIPv4IComp.h"\r
66 #include "NyLPC_cIPv4Arp.h"\r
67 #include "NyLPC_cIPv4.h"\r
68 \r
69 #ifdef __cplusplus\r
70 extern "C" {\r
71 #endif /* __cplusplus */\r
72 \r
73 /**********************************************************************\r
74  *\r
75  * NyLPC_TcUipService class\r
76  *\r
77  **********************************************************************/\r
78 /**\r
79  * uipタスクを管理する、サービスクラスです。\r
80  */\r
81 typedef struct NyLPC_TcUipService NyLPC_TcUipService_t;\r
82 \r
83 \r
84 /** サービスタスクスタックサイズ\r
85  *  mdns 256+96(MIN)\r
86  *  upnp 256+160(MIN)\r
87  *  mbedのExportしたのをLPCXpressoでコンパイルするときは+192しないと落ちる。\r
88  */\r
89 #ifndef NyLPC_cUipService_config_STACK_SIZE\r
90 #define NyLPC_cUipService_config_STACK_SIZE (256+192+192)\r
91 #endif\r
92 \r
93 \r
94 \r
95 \r
96 /**\r
97  * \param i_mac_addr\r
98  * システムで唯一のUIPサービスを初期化します。1度だけ実行できます。\r
99  */\r
100 NyLPC_TBool NyLPC_cUipService_initialize(void);\r
101 \r
102 /**\r
103  * 処理を開始します。\r
104  * この関数はリエントラントではありません。複数のタスクから共有するときには、排他ロックを掛けてください。\r
105  * @param i_ref_config\r
106  * このコンフィギュレーションは、stopを実行するまでの間、インスタンスから参照します。外部で保持してください。\r
107  */\r
108 void NyLPC_cUipService_start(const NyLPC_TcIPv4Config_t* i_ref_config);\r
109 \r
110 /**\r
111  * UIP処理を停止します。\r
112  * この関数はリエントラントではありません。複数のタスクから共有するときには、排他ロックを掛けてください。\r
113  * 関数を使用する前に、全ての非同期ソケット操作を停止してください。\r
114  */\r
115 void NyLPC_cUipService_stop(void);\r
116 \r
117 /**\r
118  * イーサネットデバイスの名前を返します。\r
119  * この関数は、サービスが開始されているときのみ、動作します。\r
120  */\r
121 const char* NyLPC_cUipService_refDeviceName(void);\r
122 const NyLPC_TcIPv4Config_t* NyLPC_cUipService_refCurrentConfig(void);\r
123 \r
124 #ifdef __cplusplus\r
125 }\r
126 #endif /* __cplusplus */\r
127 \r
128 #endif\r