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_cIPv4Config.c
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 #include "NyLPC_cIPv4Config.h" 00028 00029 00030 00031 /** 00032 * See header file. 00033 */ 00034 void NyLPC_cIPv4Config_initialzeForEthernet(NyLPC_TcIPv4Config_t* i_inst,const struct NyLPC_TEthAddr* i_ether_addr,NyLPC_TUInt16 i_ether_frame_len) 00035 { 00036 i_inst->ip_addr=i_inst->netmask=i_inst->dr_addr=NyLPC_TIPv4Addr_ZERO; 00037 i_inst->eth_mac=*i_ether_addr; 00038 //mssの計算 00039 i_inst->default_mss=i_ether_frame_len-(UIP_ETHERHEADER_LEN+UIP_TCPH_LEN + UIP_IPH_LEN); 00040 return; 00041 } 00042 void NyLPC_cIPv4Config_initialzeCopy(NyLPC_TcIPv4Config_t* i_inst,const NyLPC_TcIPv4Config_t* i_src) 00043 { 00044 memcpy(i_inst,i_src,sizeof(NyLPC_TcIPv4Config_t)); 00045 } 00046 /** 00047 * See header file. 00048 */ 00049 void NyLPC_cIPv4Config_setDefaultRoute(NyLPC_TcIPv4Config_t* i_inst,const struct NyLPC_TIPv4Addr* i_dr_addr) 00050 { 00051 i_inst->dr_addr=*i_dr_addr; 00052 return; 00053 } 00054 00055 /** 00056 * See header file. 00057 */ 00058 void NyLPC_cIPv4Config_setIp(NyLPC_TcIPv4Config_t* i_inst,const struct NyLPC_TIPv4Addr* i_ipaddr,const struct NyLPC_TIPv4Addr* i_netmask) 00059 { 00060 i_inst->ip_addr=*i_ipaddr; 00061 i_inst->netmask=*i_netmask; 00062 return; 00063 } 00064 00065 /** 00066 * See header file. 00067 */ 00068 NyLPC_TBool NyLPC_cIPv4Config_isLocalIP(const NyLPC_TcIPv4Config_t* i_inst,const struct NyLPC_TIPv4Addr* i_target_ip) 00069 { 00070 return NyLPC_TIPv4Addr_isEqualWithMask(&(i_inst->ip_addr),i_target_ip,&(i_inst->netmask)); 00071 } 00072
Generated on Tue Jul 12 2022 16:22:57 by
