1 /*********************************************************************************
3 * --------------------------------------------------------------------------------
5 * This file is part of MiMic
6 * Copyright (C)2011 Ryo Iizuka
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.
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.
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/>.
21 * For further information please contact.
23 * <airmail(at)ebony.plala.or.jp> or <nyatla(at)nyatla.jp>
25 *********************************************************************************/
26 #ifndef NYLPC_CTCPLISTENER_H_
27 #define NYLPC_CTCPLISTENER_H_
30 #include "NyLPC_stdlib.h"
32 #include "../NyLPC_iTcpListener.h"
33 #include "NyLPC_cMiMicIpTcpSocket.h"
36 #endif /* __cplusplus */
38 typedef struct NyLPC_TcMiMicIpTcpListener NyLPC_TcMiMicIpTcpListener_t;
40 /**********************************************************************
42 * NyLPC_TTcpListenerListenQ struct
44 **********************************************************************/
46 #define NyLPC_TcMiMicIpTcpListener_NUMBER_OF_Q 10
48 struct NyLPC_TTcpListenerListenQ
50 struct NyLPC_TTcpSocketSynParam item[NyLPC_TcMiMicIpTcpListener_NUMBER_OF_Q];
55 /**********************************************************************
57 * NyLPC_TcTcpListener class
59 **********************************************************************/
64 struct NyLPC_TcMiMicIpTcpListener
66 struct NyLPC_TiTcpListener _super;
67 NyLPC_TcIPv4_t* _parent_ipv4;
68 NyLPC_TUInt16 _port; /**<ネットワークオーダーのポート番号*/
71 // * Listener用の共通Mutexポインタ
73 // NyLPC_TcMutex_t* _mutex;
77 struct NyLPC_TTcpListenerListenQ _listen_q;
80 * この関数は、TCPのリスナーを初期化します。
81 * 初期化したリスナーをサービスに登録することにより、listen関数を使用できるようになります。
82 * サービスへの登録は、NyLPC_cUipService_addListenerを使います。
86 NyLPC_TBool NyLPC_cMiMicIpTcpListener_initialize(NyLPC_TcMiMicIpTcpListener_t* i_inst,NyLPC_TUInt16 i_port);
89 * この関数は、一定時間i_sockに接続を受け付けます。
91 NyLPC_TBool NyLPC_cMiMicIpTcpListener_listen(NyLPC_TcMiMicIpTcpListener_t* i_inst,NyLPC_TcMiMicIpTcpSocket_t* i_sock,NyLPC_TUInt32 i_wait_msec);
96 #endif /* __cplusplus */
98 #endif /* NYLPC_CTCPLISTENER_H_ */