Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of libMiMic by
NyLPC_cMiMicIpTcpSocket_protected.h
00001 /********************************************************************************* 00002 * PROJECT: MiMic 00003 * -------------------------------------------------------------------------------- 00004 * 00005 * This file is part of MiMic 00006 * Copyright (C)2011 Ryo Iizuka 00007 * 00008 * MiMic is free software: you can redistribute it and/or modify 00009 * it under the terms of the GNU Lesser General Public License as published 00010 * by the Free Software Foundation, either version 3 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * This program is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public License 00019 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00020 * 00021 * For further information please contact. 00022 * http://nyatla.jp/ 00023 * <airmail(at)ebony.plala.or.jp> or <nyatla(at)nyatla.jp> 00024 * 00025 *********************************************************************************/ 00026 00027 #ifndef NYLPC_CMIMICIPTCPSOCKET_PROTECTED_H_ 00028 #define NYLPC_CMIMICIPTCPSOCKET_PROTECTED_H_ 00029 #include "NyLPC_cMiMicIpTcpSocket.h" 00030 #include "../NyLPC_cIPv4Config.h" 00031 #include "NyLPC_cIPv4Payload_protected.h" 00032 #ifdef __cplusplus 00033 extern "C" { 00034 #endif /* __cplusplus */ 00035 00036 /********************************************************************** 00037 * ステータス値の定義 00038 **********************************************************************/ 00039 #define UIP_CLOSED 0 00040 #define UIP_SYN_RCVD 1 00041 #define UIP_SYN_SENT 2 00042 #define UIP_ESTABLISHED 3 00043 #define UIP_FIN_WAIT_1 4 00044 #define UIP_FIN_WAIT_2 5 00045 #define UIP_CLOSING 6 00046 #define UIP_TIME_WAIT 7 00047 #define UIP_CLOSE_WAIT 8 00048 #define UIP_LAST_ACK 9 00049 00050 00051 00052 00053 00054 00055 00056 00057 /** 00058 * パース結果をもとに、ソケットのuipconnectionを初期化します。 00059 * この関数は、cUipServiceからのみコールできます。 00060 */ 00061 void NyLPC_cMiMicIpTcpSocket_initConnection(NyLPC_TcMiMicIpTcpSocket_t* i_inst,const NyLPC_TcIPv4Config_t* i_config,const NyLPC_TcIPv4Payload_t* i_ipp); 00062 00063 /** 00064 * TCPペイロードを処理して、応答パケットをペイロードに返します。 00065 * uipサービスタスクが実行する関数です。 00066 * @return 00067 * 応答パケットを格納したメモリブロックを返します。 00068 * このメモリは、NyLPC_cUipService_allocSysTxBuf関数で確保されたメモリです。 00069 */ 00070 void* NyLPC_cMiMicIpTcpSocket_parseRx( 00071 NyLPC_TcMiMicIpTcpSocket_t* i_inst, 00072 const NyLPC_TcIPv4Payload_t* i_ipp); 00073 00074 /** 00075 * 定期的に実行する関数。最低でも1s単位で実行してください。 00076 * uipサービスタスクが実行する関数です。 00077 */ 00078 void NyLPC_cMiMicIpTcpSocket_periodic( 00079 NyLPC_TcMiMicIpTcpSocket_t* i_inst); 00080 00081 /** 00082 * CLOSEステータスのソケットを、SYN情報の内容でSYNRECV状態にします。 00083 * この関数は、NyLPC_TcTcpListenerクラスからコールされます。 00084 * @return 00085 * 遷移に成功すると、TRUEを返します。 00086 */ 00087 NyLPC_TBool NyLPC_cMiMicIpTcpSocket_listenSyn(NyLPC_TcMiMicIpTcpSocket_t* i_inst,const struct NyLPC_TTcpSocketSynParam* i_lq,NyLPC_TUInt16 i_lport); 00088 00089 00090 /** 00091 * uipサービスタスクが実行する関数です。 00092 * サービスの開始を通知します。 00093 * この関数は他のAPIが非同期に実行されないことが保証される状況で使用する必要があります。 00094 */ 00095 void NyLPC_cMiMicIpTcpSocket_startService(NyLPC_TcMiMicIpTcpSocket_t* i_inst,const NyLPC_TcIPv4Config_t* i_config); 00096 00097 /** 00098 * uipサービスタスクが実行する関数です。 00099 * サービスの停止を通知します。 00100 * この関数は他のAPIが非同期に実行されないことが保証される状況で使用する必要があります。 00101 */ 00102 void NyLPC_cMiMicIpTcpSocket_stopService(NyLPC_TcMiMicIpTcpSocket_t* i_inst); 00103 00104 00105 void* NyLPC_cMiMicIpTcpSocket_allocTcpReverseRstAck( 00106 const NyLPC_TcIPv4Payload_t* i_src); 00107 00108 /** 00109 * ローカルポートを返します。 00110 */ 00111 #define NyLPC_cMiMicIpTcpSocket_getLocalPort(i) ((i)->uip_connr.lport) 00112 #define NyLPC_cMiMicIpTcpSocket_isClosed(i) ((i)->tcpstateflags==UIP_CLOSED) 00113 #ifdef __cplusplus 00114 } 00115 #endif /* __cplusplus */ 00116 00117 #endif /* NYLPC_CTCPSOCKET_PROTECTED_H_ */
Generated on Tue Jul 12 2022 16:22:58 by
