OSDN Git Service

update libMiMic
[mimic/MiMicSDK.git] / lib / src / netif / mimicip / NyLPC_cMiMicIpTcpListener.h
1 /*********************************************************************************
2  * PROJECT: MiMic
3  * --------------------------------------------------------------------------------
4  *
5  * This file is part of MiMic
6  * Copyright (C)2011 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_CTCPLISTENER_H_
27 #define NYLPC_CTCPLISTENER_H_
28
29
30 #include "NyLPC_stdlib.h"
31 #include "NyLPC_os.h"
32 #include "../NyLPC_iTcpListener.h"
33 #include "NyLPC_cMiMicIpTcpSocket.h"
34 #ifdef __cplusplus
35 extern "C" {
36 #endif /* __cplusplus */
37
38 typedef struct NyLPC_TcMiMicIpTcpListener NyLPC_TcMiMicIpTcpListener_t;
39
40 /**********************************************************************
41  *
42  * NyLPC_TTcpListenerListenQ struct
43  *
44  **********************************************************************/
45
46 #define NyLPC_TcMiMicIpTcpListener_NUMBER_OF_Q 10
47
48 struct NyLPC_TTcpListenerListenQ
49 {
50     struct NyLPC_TTcpSocketSynParam item[NyLPC_TcMiMicIpTcpListener_NUMBER_OF_Q];
51     NyLPC_TUInt16 wp;
52 };
53
54
55 /**********************************************************************
56  *
57  * NyLPC_TcTcpListener class
58  *
59  **********************************************************************/
60
61 /**
62  * TCP listenerクラス型です。
63  */
64 struct NyLPC_TcMiMicIpTcpListener
65 {
66     struct NyLPC_TiTcpListener _super;
67     NyLPC_TcIPv4_t* _parent_ipv4;
68     NyLPC_TUInt16 _port;                /**<ネットワークオーダーのポート番号*/
69 //  /**
70 //   * タスク間の調停用Mutex
71 //   * Listener用の共通Mutexポインタ
72 //   */
73 //  NyLPC_TcMutex_t* _mutex;
74     /**
75      * SYNパケットのキュー
76      */
77     struct NyLPC_TTcpListenerListenQ _listen_q;
78 };
79 /**
80  * この関数は、TCPのリスナーを初期化します。
81  * 初期化したリスナーをサービスに登録することにより、listen関数を使用できるようになります。
82  * サービスへの登録は、NyLPC_cUipService_addListenerを使います。
83  * @param i_port
84  * ポート番号。host orderです。
85  */
86 NyLPC_TBool NyLPC_cMiMicIpTcpListener_initialize(NyLPC_TcMiMicIpTcpListener_t* i_inst,NyLPC_TUInt16 i_port);
87
88 /**
89  * この関数は、一定時間i_sockに接続を受け付けます。
90  */
91 NyLPC_TBool NyLPC_cMiMicIpTcpListener_listen(NyLPC_TcMiMicIpTcpListener_t* i_inst,NyLPC_TcMiMicIpTcpSocket_t* i_sock,NyLPC_TUInt32 i_wait_msec);
92
93
94 #ifdef __cplusplus
95 }
96 #endif /* __cplusplus */
97
98 #endif /* NYLPC_CTCPLISTENER_H_ */