/*
******************************************************************************
* SOURCE FILE
*
* Document no: @(#) $Name: ipnet2-any-r6_5_0 $ $RCSfile: ipnet_ip4.c,v $ $Revision: 1.532.2.2 $
* $Source: /home/interpeak/CVSRoot/ipnet2/src/ipnet_ip4.c,v $
* $Author: kenneth $
* $State: Exp $ $Locker: $
*
* Copyright 2000-2007 Interpeak AB (http://www.interpeak.se). All rights reserved.
* Design and implementation by Kenneth Jonsson <kenneth@interpeak.se>
******************************************************************************
*/
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
#ifndef IPCOM_KERNEL
#define IPCOM_KERNEL
#endif
#include "ipnet_config.h"
/*
*===========================================================================
* misc
*===========================================================================
#define IPCOM_USE_PROFILING_ENABLE
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#ifdef IPCOM_USE_INET
#define IPCOM_USE_CLIB_PROTO
#include <ipcom_clib.h>
#include <ipcom_cstyle.h>
#include <ipcom_err.h>
#include <ipcom_inet.h>
#include <ipcom_prof.h>
#include <ipcom_syslog.h>
#include <ipcom_sysvar.h>
#include <ipcom_type.h>
#include "ipnet.h"
#include "ipnet_h.h"
#include "ipnet_ip4.h"
#include "ipnet_loopback.h"
#include "ipnet_eth.h"
#ifdef IPTCP
#include <iptcp.h>
#endif
#ifdef IPIPSEC2
#include <ipipsec.h>
#endif
#ifdef IPNET_USE_ROUTESOCK
#include "ipnet_routesock.h"
#endif
#ifdef IPNET_USE_NETLINKSOCK
#include "ipnet_netlink.h"
#endif
#ifdef IPNET_USE_TUNNEL
#include "ipnet_tunnel.h"
#endif
#ifdef IPMPLS
#include "ipnet_mpls.h"
#endif
#ifdef IPNET_USE_VRRP
#include "ipnet_vrrp.h"
#endif
#ifdef IPFIREWALL
#include <ipfirewall.h>
#include <ipfirewall_h.h>
#endif
#ifdef IPCOM_WV_INSTRUMENTATION
#include <ipcom_windview.h>
IP_STATIC Ip_u8 wvNetDModuleId = IPCOM_WV_IPNET_IP4_MODULE; /* ipnet_ip4.c */
IP_STATIC Ip_u8 wvNetDLocalFilter = WV_NETD_NONE; /* Available event filter */
IP_STATIC Ip_u8 wvNetDEntityId = WV_NETD_IP4; /* Entity ID */
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/* Maximum number of bytes of original IP datagram to send in ICMP error reply. */
#define IPNET_ICMP_MAX_SIZE 256 /* enough to handle tunnels better. */
#define IPNET_GET_PKT_TIMESTAMP_OPT_PTR(pkt) ((Ipnet_pkt_ip_opt_timestamp *) (pkt)->link_cookie)
#define IPNET_SET_PKT_TIMESTAMP_OPT_PTR(pkt, ts) ((pkt)->link_cookie = (Ip_ptrdiff_t) (ts))
/*
*===========================================================================
* misc
*===========================================================================
*/
#define IPNET_ICMP_HDR_SIZE (8)
/*
*===========================================================================
* ICMP for IPv4
*===========================================================================
*/
#define IPNET_ICMP4_TYPE_ECHO_REPLY 0
#define IPNET_ICMP4_TYPE_DST_UNREACHABLE 3
#define IPNET_ICMP4_TYPE_SOURCEQUENCH 4
#define IPNET_ICMP4_TYPE_REDIRECT 5
#define IPNET_ICMP4_TYPE_ECHO_REQUEST 8
#define IPNET_ICMP4_TYPE_ROUTER_ADVERT 9
#define IPNET_ICMP4_TYPE_ROUTER_SOLICIT 10
#define IPNET_ICMP4_TYPE_TIME_EXCEEDED 11
#define IPNET_ICMP4_TYPE_PARAMPROB 12
#define IPNET_ICMP4_TYPE_TSTAMP_REQUEST 13
#define IPNET_ICMP4_TYPE_TSTAMP_REPLY 14
#define IPNET_ICMP4_TYPE_MASK_REQUEST 17
#define IPNET_ICMP4_TYPE_MASK_REPLY 18
/* [3] Destination unreachable codes */
#define IPNET_ICMP4_CODE_DST_UNREACH_NET 0 /* Network Unreachable */
#define IPNET_ICMP4_CODE_DST_UNREACH_HOST 1 /* Host Unreachable */
#define IPNET_ICMP4_CODE_DST_UNREACH_PROTO 2 /* Protocol Unreachable */
#define IPNET_ICMP4_CODE_DST_UNREACH_PORT 3 /* Port Unreachable */
#define IPNET_ICMP4_CODE_DST_NEEDFRAG 4 /* Fragmentation needed but no frag. bit set */
#define IPNET_ICMP4_CODE_DST_SRCFAIL 5 /* Source routing failed */
#define IPNET_ICMP4_CODE_DST_PROHIBITED_NET 9 /* Destination network administratively prohibited */
#define IPNET_ICMP4_CODE_DST_PROHIBITED_HOST 10 /* Destination host administratively prohibited */
/* [5] Redirect codes */
#define IPNET_ICMP4_CODE_RED_NETWORK 0
#define IPNET_ICMP4_CODE_RED_HOST 1
#define IPNET_ICMP4_CODE_RED_TOS_AND_NETWORK 2
#define IPNET_ICMP4_CODE_DST_TOS_AND_HOST 3
/* [11] Time exceeded codes */
#define IPNET_ICMP4_CODE_TIM_TTL 0
#define IPNET_ICMP4_CODE_TIM_REASSEMBLY 1
/* TOS to use for Destination Unreachable,
Redirect, Time Exceeded, and Parameter Problem */
#define IPNET_ICMP4_TOS_INTERNETWORK_CONTROL 6
/*
*===========================================================================
* IGMP for IPv4
*===========================================================================
*/
/* IGMP version 1 is defined in RFC 1112 */
/* IGMP version 2 is defined in RFC 2236 */
/* IGMP version 3 is defined in RFC 3376 */
#define IPNET_IGMP4_TYPE_MEMBERSHIP_QUERY 0x11
#define IPNET_IGMP4_TYPE_V1_MEMBERSHIP_REPORT 0x12
#define IPNET_IGMP4_TYPE_V2_MEMBERSHIP_REPORT 0x16
#define IPNET_IGMP4_TYPE_V2_LEAVE_GROUP 0x17
#define IPNET_IGMP4_TYPE_V3_MEMBERSHIP_REPORT 0x22
/* The interface is running on a link with at least one IGMPv1 host/router */
#define IPNET_IGMPV1_MODE 1
/* The interface is running on a link with at least one IGMPv2 host/router */
#define IPNET_IGMPV2_MODE 2
/* The interface is running in IGMPv3 mode */
#define IPNET_IGMPV3_MODE 3
/* Gets the forward cache entry that can match the IP header */
#define IPNET_IP4_GET_FORWARD_CACHE_ENTRY(cache, ip_hdr) \
do { \
unsigned i; \
i = ipcom_hash_update((ip_hdr)->src, \
sizeof(Ip_u32) * 2, \
(*(Ip_u16*) &(ip_hdr)->v_hl ^ (ip_hdr)->p) + ipnet->route_cache_id); \
i &= ((1 << IPNET_IPV4_FORWARD_CACHE_ORDER) - 1); \
(cache) = &ipnet->ip4.forward_cache[i]; \
} while ((0))
#ifdef IPNET_USE_RFC3927
/*
<- defended -
| ^
| |
DISABLED -> INIT -> PROBE -> ANNOUNCE -> ACTIVE -> DEFEND
^ | | | |
| | | | |
\ / / / /
- duplicate <----- <---------- <-------
*/
#define IPNET_IP4_LLADDR_STATE_DISABLED 0 /* Link local IPv4 address not used */
#define IPNET_IP4_LLADDR_STATE_INIT 1 /* Generate link local IPv4 address */
#define IPNET_IP4_LLADDR_STATE_PROBE 2 /* Check if another host has the address */
#define IPNET_IP4_LLADDR_STATE_DEFEND 3 /* Detected another host using the same address
try to make this host the sole owner of it */
#define IPNET_IP4_LLADDR_STATE_ANNOUNCE 4 /* Update the ARP cache of all hosts,
address assigned to interface */
#define IPNET_IP4_LLADDR_STATE_ACTIVE 5 /* Addr
没有合适的资源?快使用搜索试试~ 我知道了~
ipnet2.rar_IPTCP_ipnet_ipnet nat rule_ipnet_eth_input_vxworks组件代
共112个文件
c:76个
h:31个
mk:4个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
5星 · 超过95%的资源 3 下载量 79 浏览量
2022-07-15
16:36:45
上传
评论
收藏 633KB RAR 举报
温馨提示
vxworks6.5的ipnet组件的源代码。
资源详情
资源评论
资源推荐
收起资源包目录
ipnet2.rar_IPTCP_ipnet_ipnet nat rule_ipnet_eth_input_vxworks组件代 (112个子文件)
ipnet_ip4.c 277KB
ipnet_ip6.c 207KB
ipnet_route.c 154KB
ipnet_nat.c 141KB
ipnet_sock.c 140KB
ipnet_icmp6.c 129KB
ipnet_ipv6_mib.c 106KB
ipnet_sockopt.c 82KB
ipnet_eth.c 80KB
ipnet_cmd_ifconfig.c 70KB
ipnet_cmd_nat.c 66KB
ipnet.c 64KB
ipnet_ip_mib.c 58KB
ipnet_cmd_route.c 57KB
ipnet_netif.c 57KB
ipnet_netlink_route.c 56KB
ipnet_mip6_kern.c 56KB
ipnet_ioctl.c 55KB
ipnet_routesock.c 49KB
ipnet_cmd_qc.c 47KB
ipnet_vrrpd.c 46KB
ipnet_if_mib.c 44KB
ipnet_radvd.c 43KB
ipnet_ip6_mcast.c 43KB
ipnet_nat_pt.c 43KB
ipnet_nat_ipsecproxy.c 41KB
ipnet_sysctl.c 41KB
ipnet_nat_dnsproxy.c 39KB
ipnet_nat_pptpproxy.c 39KB
ipnet_ipv6_icmp_mib.c 37KB
ipnet_mpls.c 34KB
ipnet_ip_forward_mib.c 34KB
ipnet_netlink_address.c 32KB
ipnet_pkt_pool.c 30KB
ipnet_netlink_neighbor.c 27KB
ipnet_nat_h323proxy.c 27KB
ipnet_cmd_ctrl.c 26KB
ipnet_cmd_ping.c 26KB
ipnet_sock_ip6.c 26KB
ipnet_nat_ftpproxy.c 26KB
ipnet_udp.c 25KB
ipnet_cmd_sysctl.c 25KB
ipnet_raw.c 24KB
ipnet_configd.c 23KB
ipnet_cmd_ping6.c 23KB
ipnet_sock_ip4.c 23KB
ipnet_netlink_rule.c 22KB
ipnet_ctrl.c 21KB
ipnet_cmd_qos.c 21KB
ipnet_netlink.c 20KB
ipnet_ppp.c 19KB
ipnet_cmd_ndp.c 18KB
ipnet_loopback.c 18KB
ipnet_cmd_scaletest.c 18KB
ipnet_cmd_netstat.c 17KB
ipnet_udp_mib.c 17KB
ipnet_classifier.c 17KB
ipnet_frag.c 17KB
ipnet_mcast.c 17KB
ipnet_ipv6_udp_mib.c 15KB
ipnet_cmd.c 14KB
ipnet_cmd_arp.c 14KB
ipnet_diffserv.c 14KB
ipnet_sockdev.c 14KB
ipnet_cmd_radvd.c 13KB
ipnet_pkt_queue.c 13KB
ipnet_ipsec.c 12KB
ipnet_sock_tcp.c 12KB
ipnet_debug.c 11KB
ipnet_ds_srtcm.c 11KB
ipnet_netlink_link.c 9KB
ipnet_neigh.c 8KB
ipnet_gre.c 8KB
ipnet_nat_triggerproxy.c 7KB
ipnet_ds_sm.c 6KB
ipnet_wlan.c 6KB
ipnet_h.h 69KB
ipnet_ip6.h 45KB
ipnet_config.h 32KB
ipnet_ip4.h 30KB
ipnet_netlink.h 22KB
ipnet_netif.h 21KB
ipnet_nat_h.h 19KB
ipnet_nat.h 18KB
ipnet_route.h 17KB
ipnet_qos.h 16KB
ipnet_pkt_queue.h 12KB
ipnet_eth.h 12KB
ipnet_ctrl.h 10KB
ipnet.h 10KB
ipnet_routesock.h 9KB
ipnet_mip6_kern.h 8KB
ipnet_diffserv.h 7KB
ipnet_mcast.h 6KB
ipnet_timeout.h 6KB
ipnet_icmp6.h 6KB
ipnet_cmd.h 6KB
ipnet_policy_routing.h 5KB
ipnet_neigh.h 5KB
ipnet_wlan.h 4KB
共 112 条
- 1
- 2
JonSco
- 粉丝: 67
- 资源: 1万+
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论3