This is Webservice SDK for mbed. LPCXpresso1769/LPC1768/FRDM-K64F/LPC4088
Dependents: MbedFileServer_1768MiniDK2 RedWireBridge IssueDebug_gcc MiMicRemoteMCU-for-Mbed ... more
NyLPC_cIPv4Config.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 * @file 00028 * このファイルは、NyLPC_cIPv4Configクラスを定義します。 00029 */ 00030 #ifndef NYLPC_CIPV4CONFIG_H_ 00031 #define NYLPC_CIPV4CONFIG_H_ 00032 00033 00034 #include "NyLPC_NetIf_ip_types.h" 00035 00036 /** 00037 * クラス型を定義します。 00038 * NyLPC_cIPv4Configクラスは、IPと、下位のネットワーク層の設定を保持します。 00039 * 関連するオブジェクトが、ネットワーク設定を問い合わせる為に使います。 00040 */ 00041 typedef struct NyLPC_TcIPv4Config NyLPC_TcIPv4Config_t; 00042 00043 #ifdef __cplusplus 00044 extern "C" { 00045 #endif /* __cplusplus */ 00046 /********************************************************************** 00047 * 00048 * class NyLPC_TcIPv4Config 00049 * 00050 **********************************************************************/ 00051 00052 00053 00054 00055 /** 00056 * NyLPC_TcIPv4Configクラスの構造体です。 00057 */ 00058 struct NyLPC_TcIPv4Config 00059 { 00060 /** イーサネットアドレスを格納します。 */ 00061 struct NyLPC_TEthAddr eth_mac; 00062 /** IPアドレスを格納します。Network orderです。 */ 00063 struct NyLPC_TIPv4Addr ip_addr; 00064 /** ネットマスクを格納します。Network orderです。 */ 00065 struct NyLPC_TIPv4Addr netmask; 00066 /** デフォルトゲートウェイアドレスを格納します。Network orderです。 */ 00067 struct NyLPC_TIPv4Addr dr_addr; 00068 /** デフォルトMMSサイズです。送信パケットのMSS値、受信パケットのデフォルトMSS値として使います。 */ 00069 NyLPC_TUInt16 default_mss; 00070 }; 00071 00072 #define NyLPC_TcIPv4Config_getEtherMac000120203(v)(((v)->eth_mac.addr[0]<<24)|((v)->eth_mac.addr[1]<<16)|((v)->eth_mac.addr[2]<<8)|((v)->eth_mac.addr[3]<<0)) 00073 #define NyLPC_TcIPv4Config_getEtherMac0405xxxx(v) (((v)->eth_mac.addr[4]<<24)|((v)->eth_mac.addr[5]<<16)) 00074 00075 /** 00076 * コンストラクタです。 00077 * イーサネット用にコンフィギュレーションを初期化します。 00078 * @param i_inst 00079 * 初期化するインスタンスです。 00080 * @param i_ether_frame_len 00081 * イーサネットフレームのサイズ。この数値から、MSSのデフォルト値を計算します。 00082 */ 00083 void NyLPC_cIPv4Config_initialzeForEthernet(NyLPC_TcIPv4Config_t* i_inst,const struct NyLPC_TEthAddr* i_ether_addr,NyLPC_TUInt16 i_ether_frame_len); 00084 00085 /** 00086 * コピーコンストラクタ 00087 */ 00088 void NyLPC_cIPv4Config_initialzeCopy(NyLPC_TcIPv4Config_t* i_inst,const NyLPC_TcIPv4Config_t* i_src); 00089 00090 00091 /** 00092 * デストラクタです。インスタンスを破棄して、確保している動的リソースを元に戻します。 00093 * @param i_inst 00094 * 破棄するインスタンスです。 00095 * initializeに成功したインスタンスだけが指定できます。 00096 */ 00097 #define NyLPC_cIPv4Config_finalize(i_inst) 00098 00099 /** 00100 * この関数は、IPのデフォルトゲートウェイを設定します。dr_addrの値を更新します。 00101 * @param i_inst 00102 * 操作するインスタンスです。 00103 * @param i_dr_addr 00104 * 設定するIPアドレスを格納したアドレスです。 00105 */ 00106 void NyLPC_cIPv4Config_setDefaultRoute(NyLPC_TcIPv4Config_t* i_inst,const struct NyLPC_TIPv4Addr* i_dr_addr); 00107 00108 /** 00109 * この関数は、ローカルIPアドレスとネットマスクを設定します。 00110 * @param i_inst 00111 * 操作するインスタンスです。 00112 * @param i_ipaddr 00113 * 設定するIPアドレスを格納したアドレスです。 00114 * @param i_netmask 00115 * 設定するネットマスクを格納したアドレスです。 00116 */ 00117 void NyLPC_cIPv4Config_setIp(NyLPC_TcIPv4Config_t* i_inst,const struct NyLPC_TIPv4Addr* i_ipaddr,const struct NyLPC_TIPv4Addr* i_netmask); 00118 00119 /** 00120 * この関数は、i_target_ipが、現在のIPアドレスに対するローカルアドレスであるかを返します。 00121 * @param i_inst 00122 * 操作するインスタンスです。 00123 * @param i_target_ip 00124 * 確認するIPアドレスです。 00125 * @return 00126 * i_target_ipがローカルIPアドレスなら、TRUEを返します。 00127 */ 00128 NyLPC_TBool NyLPC_cIPv4Config_isLocalIP(const NyLPC_TcIPv4Config_t* i_inst,const struct NyLPC_TIPv4Addr* i_target_ip); 00129 00130 #ifdef __cplusplus 00131 } 00132 #endif /* __cplusplus */ 00133 00134 #endif 00135
Generated on Tue Jul 12 2022 15:46:15 by 1.7.2