OSDN Git Service

update libMiMic
[mimic/MiMicSDK.git] / lib / src / netif / mimicip / NyLPC_cMiMicIpTcpSocket_protected.h
-/*********************************************************************************\r
- * PROJECT: MiMic\r
- * --------------------------------------------------------------------------------\r
- *\r
- * This file is part of MiMic\r
- * Copyright (C)2011 Ryo Iizuka\r
- *\r
- * MiMic is free software: you can redistribute it and/or modify\r
- * it under the terms of the GNU Lesser General Public License as published\r
- * by the Free Software Foundation, either version 3 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU Lesser General Public License\r
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.\r
- *\r
- * For further information please contact.\r
- *     http://nyatla.jp/\r
- *     <airmail(at)ebony.plala.or.jp> or <nyatla(at)nyatla.jp>\r
- *\r
- *********************************************************************************/\r
-\r
-#ifndef NYLPC_CTCPSOCKET_PROTECTED_H_\r
-#define NYLPC_CTCPSOCKET_PROTECTED_H_\r
-#include "NyLPC_cIPv4.h"\r
-#include "NyLPC_cTcpSocket.h"\r
-#include "NyLPC_cIPv4Config.h"\r
-#include "NyLPC_cIPv4Payload_protected.h"\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif /* __cplusplus */\r
-\r
-/**********************************************************************\r
- * ステータス値の定義\r
- **********************************************************************/\r
-#define UIP_CLOSED       0\r
-#define UIP_SYN_RCVD     1\r
-#define UIP_SYN_SENT     2\r
-#define UIP_ESTABLISHED  3\r
-#define UIP_FIN_WAIT_1   4\r
-#define UIP_FIN_WAIT_2   5\r
-#define UIP_CLOSING      6\r
-#define UIP_TIME_WAIT    7\r
-#define UIP_CLOSE_WAIT   8\r
-#define UIP_LAST_ACK     9\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-/**\r
- * パース結果をもとに、ソケットのuipconnectionを初期化します。\r
+/*********************************************************************************
+ * PROJECT: MiMic
+ * --------------------------------------------------------------------------------
+ *
+ * This file is part of MiMic
+ * Copyright (C)2011 Ryo Iizuka
+ *
+ * MiMic is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * For further information please contact.
+ *  http://nyatla.jp/
+ *  <airmail(at)ebony.plala.or.jp> or <nyatla(at)nyatla.jp>
+ *
+ *********************************************************************************/
+
+#ifndef NYLPC_CMIMICIPTCPSOCKET_PROTECTED_H_
+#define NYLPC_CMIMICIPTCPSOCKET_PROTECTED_H_
+#include "NyLPC_cMiMicIpTcpSocket.h"
+#include "../NyLPC_cIPv4Config.h"
+#include "NyLPC_cIPv4Payload_protected.h"
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**********************************************************************
+ * ステータス値の定義
+ **********************************************************************/
+#define UIP_CLOSED       0
+#define UIP_SYN_RCVD     1
+#define UIP_SYN_SENT     2
+#define UIP_ESTABLISHED  3
+#define UIP_FIN_WAIT_1   4
+#define UIP_FIN_WAIT_2   5
+#define UIP_CLOSING      6
+#define UIP_TIME_WAIT    7
+#define UIP_CLOSE_WAIT   8
+#define UIP_LAST_ACK     9
+
+
+
+
+
+
+
+
+/**
+ * パース結果をもとに、ソケットのuipconnectionを初期化します。
  * この関数は、cUipServiceからのみコールできます。
- */\r
-void NyLPC_cTcpSocket_initConnection(NyLPC_TcTcpSocket_t* i_inst,const NyLPC_TcIPv4Config_t* i_config,const NyLPC_TcIPv4Payload_t* i_ipp);\r
-\r
-/**\r
- * TCPペイロードを処理して、応答パケットをペイロードに返します。\r
- * uipサービスタスクが実行する関数です。\r
- * @return\r
- * 応答パケットを格納したメモリブロックを返します。\r
- * このメモリは、NyLPC_cUipService_allocSysTxBuf関数で確保されたメモリです。\r
- */\r
-void* NyLPC_cTcpSocket_parseRx(\r
-       NyLPC_TcTcpSocket_t* i_inst,\r
-       const NyLPC_TcIPv4Payload_t* i_ipp);\r
-\r
-/**\r
- * 定期的に実行する関数。最低でも1s単位で実行してください。\r
- * uipサービスタスクが実行する関数です。\r
- */\r
-void NyLPC_cTcpSocket_periodic(\r
-       NyLPC_TcTcpSocket_t* i_inst);\r
-\r
-/**\r
- * CLOSEステータスのソケットを、SYN情報の内容でSYNRECV状態にします。\r
- * この関数は、NyLPC_TcTcpListenerクラスからコールされます。\r
- * @return\r
- * 遷移に成功すると、TRUEを返します。\r
- */\r
-NyLPC_TBool NyLPC_cTcpSocket_listenSyn(NyLPC_TcTcpSocket_t* i_inst,const struct NyLPC_TTcpSocketSynParam* i_lq,NyLPC_TUInt16 i_lport);\r
-\r
-\r
-/**\r
- * uipサービスタスクが実行する関数です。\r
- * サービスの開始を通知します。\r
- * この関数は他のAPIが非同期に実行されないことが保証される状況で使用する必要があります。\r
- */\r
-void NyLPC_cTcpSocket_startService(NyLPC_TcTcpSocket_t* i_inst,const NyLPC_TcIPv4Config_t* i_config);\r
-\r
-/**\r
- * uipサービスタスクが実行する関数です。\r
- * サービスの停止を通知します。\r
- * この関数は他のAPIが非同期に実行されないことが保証される状況で使用する必要があります。\r
- */\r
-void NyLPC_cTcpSocket_stopService(NyLPC_TcTcpSocket_t* i_inst);\r
-\r
-\r
-void* NyLPC_cTcpSocket_allocTcpReverseRstAck(\r
-       const NyLPC_TcIPv4Payload_t* i_src);\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif /* __cplusplus */\r
-\r
-#endif /* NYLPC_CTCPSOCKET_PROTECTED_H_ */\r
+ */
+void NyLPC_cMiMicIpTcpSocket_initConnection(NyLPC_TcMiMicIpTcpSocket_t* i_inst,const NyLPC_TcIPv4Config_t* i_config,const NyLPC_TcIPv4Payload_t* i_ipp);
+
+/**
+ * TCPペイロードを処理して、応答パケットをペイロードに返します。
+ * uipサービスタスクが実行する関数です。
+ * @return
+ * 応答パケットを格納したメモリブロックを返します。
+ * このメモリは、NyLPC_cUipService_allocSysTxBuf関数で確保されたメモリです。
+ */
+void* NyLPC_cMiMicIpTcpSocket_parseRx(
+    NyLPC_TcMiMicIpTcpSocket_t* i_inst,
+    const NyLPC_TcIPv4Payload_t* i_ipp);
+
+/**
+ * 定期的に実行する関数。最低でも1s単位で実行してください。
+ * uipサービスタスクが実行する関数です。
+ */
+void NyLPC_cMiMicIpTcpSocket_periodic(
+    NyLPC_TcMiMicIpTcpSocket_t* i_inst);
+
+/**
+ * CLOSEステータスのソケットを、SYN情報の内容でSYNRECV状態にします。
+ * この関数は、NyLPC_TcTcpListenerクラスからコールされます。
+ * @return
+ * 遷移に成功すると、TRUEを返します。
+ */
+NyLPC_TBool NyLPC_cMiMicIpTcpSocket_listenSyn(NyLPC_TcMiMicIpTcpSocket_t* i_inst,const struct NyLPC_TTcpSocketSynParam* i_lq,NyLPC_TUInt16 i_lport);
+
+
+/**
+ * uipサービスタスクが実行する関数です。
+ * サービスの開始を通知します。
+ * この関数は他のAPIが非同期に実行されないことが保証される状況で使用する必要があります。
+ */
+void NyLPC_cMiMicIpTcpSocket_startService(NyLPC_TcMiMicIpTcpSocket_t* i_inst,const NyLPC_TcIPv4Config_t* i_config);
+
+/**
+ * uipサービスタスクが実行する関数です。
+ * サービスの停止を通知します。
+ * この関数は他のAPIが非同期に実行されないことが保証される状況で使用する必要があります。
+ */
+void NyLPC_cMiMicIpTcpSocket_stopService(NyLPC_TcMiMicIpTcpSocket_t* i_inst);
+
+
+void* NyLPC_cMiMicIpTcpSocket_allocTcpReverseRstAck(
+    const NyLPC_TcIPv4Payload_t* i_src);
+
+/**
+ * ローカルポートを返します。
+ */
+#define NyLPC_cMiMicIpTcpSocket_getLocalPort(i) ((i)->uip_connr.lport)
+#define NyLPC_cMiMicIpTcpSocket_isClosed(i) ((i)->tcpstateflags==UIP_CLOSED)
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* NYLPC_CTCPSOCKET_PROTECTED_H_ */