diff options
author | Thomas Bushnell <thomas@gnu.org> | 1997-02-25 21:28:37 +0000 |
---|---|---|
committer | Thomas Bushnell <thomas@gnu.org> | 1997-02-25 21:28:37 +0000 |
commit | f07a4c844da9f0ecae5bbee1ab94be56505f26f7 (patch) | |
tree | 12b07c7e578fc1a5f53dbfde2632408491ff2a70 /i386/i386at/gpl/linux/include/net |
Initial source
Diffstat (limited to 'i386/i386at/gpl/linux/include/net')
30 files changed, 2166 insertions, 0 deletions
diff --git a/i386/i386at/gpl/linux/include/net/af_unix.h b/i386/i386at/gpl/linux/include/net/af_unix.h new file mode 100644 index 0000000..dc4a48d --- /dev/null +++ b/i386/i386at/gpl/linux/include/net/af_unix.h @@ -0,0 +1,4 @@ +extern void unix_proto_init(struct net_proto *pro); + +typedef struct sock unix_socket; + diff --git a/i386/i386at/gpl/linux/include/net/arp.h b/i386/i386at/gpl/linux/include/net/arp.h new file mode 100644 index 0000000..db7a29c --- /dev/null +++ b/i386/i386at/gpl/linux/include/net/arp.h @@ -0,0 +1,17 @@ +/* linux/net/inet/arp.h */ +#ifndef _ARP_H +#define _ARP_H + +extern void arp_init(void); +extern int arp_rcv(struct sk_buff *skb, struct device *dev, + struct packet_type *pt); +extern int arp_query(unsigned char *haddr, u32 paddr, struct device *dev); +extern int arp_find(unsigned char *haddr, u32 paddr, + struct device *dev, u32 saddr, struct sk_buff *skb); +extern int arp_ioctl(unsigned int cmd, void *arg); +extern void arp_send(int type, int ptype, u32 dest_ip, + struct device *dev, u32 src_ip, + unsigned char *dest_hw, unsigned char *src_hw, unsigned char *th); +extern int arp_bind_cache(struct hh_cache ** hhp, struct device *dev, unsigned short type, __u32 daddr); +extern int arp_update_cache(struct hh_cache * hh); +#endif /* _ARP_H */ diff --git a/i386/i386at/gpl/linux/include/net/atalkcall.h b/i386/i386at/gpl/linux/include/net/atalkcall.h new file mode 100644 index 0000000..726e33c --- /dev/null +++ b/i386/i386at/gpl/linux/include/net/atalkcall.h @@ -0,0 +1,2 @@ +/* Separate to keep compilation of protocols.c simpler */ +extern void atalk_proto_init(struct net_proto *pro); diff --git a/i386/i386at/gpl/linux/include/net/ax25.h b/i386/i386at/gpl/linux/include/net/ax25.h new file mode 100644 index 0000000..45967cb --- /dev/null +++ b/i386/i386at/gpl/linux/include/net/ax25.h @@ -0,0 +1,246 @@ +/* + * Declarations of AX.25 type objects. + * + * Alan Cox (GW4PTS) 10/11/93 + */ + +#ifndef _AX25_H +#define _AX25_H +#include <linux/ax25.h> + +#define PR_SLOWHZ 10 /* Run timing at 1/10 second - gives us better resolution for 56kbit links */ + +#define AX25_T1CLAMPLO (1 * PR_SLOWHZ) /* If defined, clamp at 1 second **/ +#define AX25_T1CLAMPHI (30 * PR_SLOWHZ) /* If defined, clamp at 30 seconds **/ + +#define AX25_BROKEN_NETMAC + +#define AX25_BPQ_HEADER_LEN 16 +#define AX25_KISS_HEADER_LEN 1 + +#define AX25_HEADER_LEN 17 +#define AX25_ADDR_LEN 7 +#define AX25_DIGI_HEADER_LEN (AX25_MAX_DIGIS * AX25_ADDR_LEN) +#define AX25_MAX_HEADER_LEN (AX25_HEADER_LEN + AX25_DIGI_HEADER_LEN) + +#define AX25_P_IP 0xCC +#define AX25_P_ARP 0xCD +#define AX25_P_TEXT 0xF0 +#define AX25_P_NETROM 0xCF +#define AX25_P_SEGMENT 0x08 + +#define SEG_REM 0x7F +#define SEG_FIRST 0x80 + +#define LAPB_UI 0x03 +#define LAPB_C 0x80 +#define LAPB_E 0x01 + +#define SSSID_SPARE 0x60 /* Unused bits in SSID for standard AX.25 */ +#define ESSID_SPARE 0x20 /* Unused bits in SSID for extended AX.25 */ +#define DAMA_FLAG 0x40 /* Well, it is *NOT* unused! (dl1bke 951121 */ + +#define AX25_REPEATED 0x80 + +#define ACK_PENDING_CONDITION 0x01 +#define REJECT_CONDITION 0x02 +#define PEER_RX_BUSY_CONDITION 0x04 +#define OWN_RX_BUSY_CONDITION 0x08 + +#ifndef _LINUX_NETDEVICE_H +#include <linux/netdevice.h> +#endif + +/* + * These headers are taken from the KA9Q package by Phil Karn. These specific + * files have been placed under the GPL (not the whole package) by Phil. + * + * + * Copyright 1991 Phil Karn, KA9Q + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 dated June, 1991. + * + * 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 General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave., Cambridge, MA 02139, USA. + */ + +/* Upper sub-layer (LAPB) definitions */ + +/* Control field templates */ +#define I 0x00 /* Information frames */ +#define S 0x01 /* Supervisory frames */ +#define RR 0x01 /* Receiver ready */ +#define RNR 0x05 /* Receiver not ready */ +#define REJ 0x09 /* Reject */ +#define U 0x03 /* Unnumbered frames */ +#define SABM 0x2f /* Set Asynchronous Balanced Mode */ +#define SABME 0x6f /* Set Asynchronous Balanced Mode Extended */ +#define DISC 0x43 /* Disconnect */ +#define DM 0x0f /* Disconnected mode */ +#define UA 0x63 /* Unnumbered acknowledge */ +#define FRMR 0x87 /* Frame reject */ +#define UI 0x03 /* Unnumbered information */ +#define PF 0x10 /* Poll/final bit for standard AX.25 */ +#define EPF 0x01 /* Poll/final bit for extended AX.25 */ + +#define ILLEGAL 0x100 /* Impossible to be a real frame type */ + +#define POLLOFF 0 +#define POLLON 1 + +/* AX25 L2 C-bit */ + +#define C_COMMAND 1 /* C_ otherwise it clashes with the de600 defines (sigh)) */ +#define C_RESPONSE 2 + +/* Define Link State constants. */ + +#define AX25_STATE_0 0 +#define AX25_STATE_1 1 +#define AX25_STATE_2 2 +#define AX25_STATE_3 3 +#define AX25_STATE_4 4 + +#define MODULUS 8 /* Standard AX.25 modulus */ +#define EMODULUS 128 /* Extended AX.25 modulus */ + +#define AX25_DEF_IPDEFMODE 'D' +#define AX25_DEF_AXDEFMODE 8 +#define AX25_DEF_NETROM 1 +#define AX25_DEF_TEXT 1 +#define AX25_DEF_BACKOFF 'E' +#define AX25_DEF_CONMODE 1 +#define AX25_DEF_WINDOW 2 +#define AX25_DEF_EWINDOW 32 +#define AX25_DEF_T1 10 +#define AX25_DEF_T2 3 +#define AX25_DEF_T3 300 +#define AX25_DEF_N2 10 +#define AX25_DEF_DIGI (AX25_DIGI_INBAND|AX25_DIGI_XBAND) + +typedef struct ax25_uid_assoc { + struct ax25_uid_assoc *next; + uid_t uid; + ax25_address call; +} ax25_uid_assoc; + +typedef struct { + ax25_address calls[AX25_MAX_DIGIS]; + unsigned char repeated[AX25_MAX_DIGIS]; + unsigned char ndigi; + char lastrepeat; +} ax25_digi; + +typedef struct ax25_cb { + struct ax25_cb *next; + ax25_address source_addr, dest_addr; + struct device *device; + unsigned char dama_slave; /* dl1bke 951121 */ + unsigned char state, modulus, hdrincl; + unsigned short vs, vr, va; + unsigned char condition, backoff; + unsigned char n2, n2count; + unsigned short t1, t2, t3, rtt; + unsigned short t1timer, t2timer, t3timer; + unsigned short fragno, fraglen; + ax25_digi *digipeat; + struct sk_buff_head write_queue; + struct sk_buff_head reseq_queue; + struct sk_buff_head ack_queue; + struct sk_buff_head frag_queue; + unsigned char window; + struct timer_list timer; + struct sock *sk; /* Backlink to socket */ +} ax25_cb; + +/* af_ax25.c */ +extern ax25_address null_ax25_address; +extern char *ax2asc(ax25_address *); +extern int ax25cmp(ax25_address *, ax25_address *); +extern int ax25_send_frame(struct sk_buff *, ax25_address *, ax25_address *, ax25_digi *, struct device *); +extern void ax25_destroy_socket(ax25_cb *); +extern struct device *ax25rtr_get_dev(ax25_address *); +extern int ax25_encapsulate(struct sk_buff *, struct device *, unsigned short, + void *, void *, unsigned int); +extern int ax25_rebuild_header(unsigned char *, struct device *, unsigned long, struct sk_buff *); +extern ax25_uid_assoc *ax25_uid_list; +extern int ax25_uid_policy; +extern ax25_address *ax25_findbyuid(uid_t); +extern void ax25_queue_xmit(struct sk_buff *, struct device *, int); +extern int ax25_dev_is_dama_slave(struct device *); /* dl1bke 951121 */ + +#include <net/ax25call.h> + +/* ax25_in.c */ +extern int ax25_process_rx_frame(ax25_cb *, struct sk_buff *, int, int); + +/* ax25_out.c */ +extern void ax25_output(ax25_cb *, struct sk_buff *); +extern void ax25_kick(ax25_cb *); +extern void ax25_transmit_buffer(ax25_cb *, struct sk_buff *, int); +extern void ax25_nr_error_recovery(ax25_cb *); +extern void ax25_establish_data_link(ax25_cb *); +extern void ax25_transmit_enquiry(ax25_cb *); +extern void ax25_enquiry_response(ax25_cb *); +extern void ax25_timeout_response(ax25_cb *); +extern void ax25_check_iframes_acked(ax25_cb *, unsigned short); +extern void ax25_check_need_response(ax25_cb *, int, int); +extern void dama_enquiry_response(ax25_cb *); /* dl1bke 960114 */ +extern void dama_check_need_response(ax25_cb *, int, int); /* dl1bke 960114 */ +extern void dama_establish_data_link(ax25_cb *); + +/* ax25_route.c */ +extern void ax25_rt_rx_frame(ax25_address *, struct device *, ax25_digi *); +extern int ax25_rt_get_info(char *, char **, off_t, int, int); +extern int ax25_cs_get_info(char *, char **, off_t, int, int); +extern int ax25_rt_autobind(ax25_cb *, ax25_address *); +extern void ax25_rt_build_path(ax25_cb *, ax25_address *); +extern void ax25_dg_build_path(struct sk_buff *, ax25_address *, struct device *); +extern void ax25_rt_device_down(struct device *); +extern int ax25_rt_ioctl(unsigned int, void *); +extern void ax25_ip_mode_set(ax25_address *, struct device *, char); +extern char ax25_ip_mode_get(ax25_address *, struct device *); +extern unsigned short ax25_dev_get_value(struct device *, int); +extern void ax25_dev_device_up(struct device *); +extern void ax25_dev_device_down(struct device *); +extern int ax25_dev_ioctl(unsigned int, void *); +extern int ax25_bpq_get_info(char *, char **, off_t, int, int); +extern ax25_address *ax25_bpq_get_addr(struct device *); +extern int ax25_bpq_ioctl(unsigned int, void *); + +/* ax25_subr.c */ +extern void ax25_clear_queues(ax25_cb *); +extern void ax25_frames_acked(ax25_cb *, unsigned short); +extern void ax25_requeue_frames(ax25_cb *); +extern int ax25_validate_nr(ax25_cb *, unsigned short); +extern int ax25_decode(ax25_cb *, struct sk_buff *, int *, int *, int *); +extern void ax25_send_control(ax25_cb *, int, int, int); +extern unsigned short ax25_calculate_t1(ax25_cb *); +extern void ax25_calculate_rtt(ax25_cb *); +extern unsigned char *ax25_parse_addr(unsigned char *, int, ax25_address *, + ax25_address *, ax25_digi *, int *, int *); /* dl1bke 951121 */ +extern int build_ax25_addr(unsigned char *, ax25_address *, ax25_address *, + ax25_digi *, int, int); +extern int size_ax25_addr(ax25_digi *); +extern void ax25_digi_invert(ax25_digi *, ax25_digi *); +extern void ax25_return_dm(struct device *, ax25_address *, ax25_address *, ax25_digi *); +extern void ax25_dama_on(ax25_cb *); /* dl1bke 951121 */ +extern void ax25_dama_off(ax25_cb *); /* dl1bke 951121 */ + +/* ax25_timer */ +extern void ax25_set_timer(ax25_cb *); +extern void ax25_t1_timeout(ax25_cb *); + +/* ... */ + +extern ax25_cb * volatile ax25_list; + +#endif diff --git a/i386/i386at/gpl/linux/include/net/ax25call.h b/i386/i386at/gpl/linux/include/net/ax25call.h new file mode 100644 index 0000000..8956965 --- /dev/null +++ b/i386/i386at/gpl/linux/include/net/ax25call.h @@ -0,0 +1,2 @@ +/* Seperate to keep compilation of protocols.c simpler */ +extern void ax25_proto_init(struct net_proto *pro); diff --git a/i386/i386at/gpl/linux/include/net/checksum.h b/i386/i386at/gpl/linux/include/net/checksum.h new file mode 100644 index 0000000..aee4fd4 --- /dev/null +++ b/i386/i386at/gpl/linux/include/net/checksum.h @@ -0,0 +1,25 @@ +/* + * INET An implementation of the TCP/IP protocol suite for the LINUX + * operating system. INET is implemented using the BSD Socket + * interface as the means of communication with the user level. + * + * Checksumming functions for IP, TCP, UDP and so on + * + * Authors: Jorge Cwik, <jorge@laser.satlink.net> + * Arnt Gulbrandsen, <agulbra@nvg.unit.no> + * Borrows very liberally from tcp.c and ip.c, see those + * files for more names. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ +#ifndef _CHECKSUM_H +#define _CHECKSUM_H + +#include <asm/byteorder.h> +#include <net/ip.h> +#include <asm/checksum.h> + +#endif diff --git a/i386/i386at/gpl/linux/include/net/datalink.h b/i386/i386at/gpl/linux/include/net/datalink.h new file mode 100644 index 0000000..44e5699 --- /dev/null +++ b/i386/i386at/gpl/linux/include/net/datalink.h @@ -0,0 +1,16 @@ +#ifndef _NET_INET_DATALINK_H_ +#define _NET_INET_DATALINK_H_ + +struct datalink_proto { + unsigned short type_len; + unsigned char type[8]; + const char *string_name; + unsigned short header_length; + int (*rcvfunc)(struct sk_buff *, struct device *, + struct packet_type *); + void (*datalink_header)(struct datalink_proto *, struct sk_buff *, + unsigned char *); + struct datalink_proto *next; +}; + +#endif diff --git a/i386/i386at/gpl/linux/include/net/icmp.h b/i386/i386at/gpl/linux/include/net/icmp.h new file mode 100644 index 0000000..e4ae821 --- /dev/null +++ b/i386/i386at/gpl/linux/include/net/icmp.h @@ -0,0 +1,40 @@ +/* + * INET An implementation of the TCP/IP protocol suite for the LINUX + * operating system. INET is implemented using the BSD Socket + * interface as the means of communication with the user level. + * + * Definitions for the ICMP module. + * + * Version: @(#)icmp.h 1.0.4 05/13/93 + * + * Authors: Ross Biro, <bir7@leland.Stanford.Edu> + * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ +#ifndef _ICMP_H +#define _ICMP_H + +#include <linux/icmp.h> +#include <linux/skbuff.h> + +#include <net/sock.h> +#include <net/protocol.h> + +extern struct icmp_err icmp_err_convert[]; +extern struct icmp_mib icmp_statistics; + +extern void icmp_send(struct sk_buff *skb_in, int type, int code, + unsigned long info, struct device *dev); +extern int icmp_rcv(struct sk_buff *skb1, struct device *dev, + struct options *opt, __u32 daddr, + unsigned short len, __u32 saddr, + int redo, struct inet_protocol *protocol); +extern int icmp_ioctl(struct sock *sk, int cmd, + unsigned long arg); +extern void icmp_init(struct proto_ops *ops); + +#endif /* _ICMP_H */ diff --git a/i386/i386at/gpl/linux/include/net/ip.h b/i386/i386at/gpl/linux/include/net/ip.h new file mode 100644 index 0000000..c7bd998 --- /dev/null +++ b/i386/i386at/gpl/linux/include/net/ip.h @@ -0,0 +1,154 @@ +/* + * INET An implementation of the TCP/IP protocol suite for the LINUX + * operating system. INET is implemented using the BSD Socket + * interface as the means of communication with the user level. + * + * Definitions for the IP module. + * + * Version: @(#)ip.h 1.0.2 05/07/93 + * + * Authors: Ross Biro, <bir7@leland.Stanford.Edu> + * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> + * Alan Cox, <gw4pts@gw4pts.ampr.org> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ +#ifndef _IP_H +#define _IP_H + + +#include <linux/config.h> +#include <linux/types.h> +#include <linux/socket.h> +#include <linux/ip.h> +#include <linux/netdevice.h> +#include <net/route.h> + +#ifndef _SNMP_H +#include <net/snmp.h> +#endif + +#include <net/sock.h> /* struct sock */ + +/* IP flags. */ +#define IP_CE 0x8000 /* Flag: "Congestion" */ +#define IP_DF 0x4000 /* Flag: "Don't Fragment" */ +#define IP_MF 0x2000 /* Flag: "More Fragments" */ +#define IP_OFFSET 0x1FFF /* "Fragment Offset" part */ + +#define IP_FRAG_TIME (30 * HZ) /* fragment lifetime */ + +#ifdef CONFIG_IP_MULTICAST +extern void ip_mc_dropsocket(struct sock *); +extern void ip_mc_dropdevice(struct device *dev); +extern int ip_mc_procinfo(char *, char **, off_t, int, int); +#endif + +#include <net/ip_forward.h> + +/* Describe an IP fragment. */ +struct ipfrag +{ + int offset; /* offset of fragment in IP datagram */ + int end; /* last byte of data in datagram */ + int len; /* length of this fragment */ + struct sk_buff *skb; /* complete received fragment */ + unsigned char *ptr; /* pointer into real fragment data */ + struct ipfrag *next; /* linked list pointers */ + struct ipfrag *prev; +}; + +/* + * Describe an entry in the "incomplete datagrams" queue. + */ + +struct ipq +{ + unsigned char *mac; /* pointer to MAC header */ + struct iphdr *iph; /* pointer to IP header */ + int len; /* total length of original datagram */ + short ihlen; /* length of the IP header */ + short maclen; /* length of the MAC header */ + struct timer_list timer; /* when will this queue expire? */ + struct ipfrag *fragments; /* linked list of received fragments */ + struct ipq *next; /* linked list pointers */ + struct ipq *prev; + struct device *dev; /* Device - for icmp replies */ +}; + +/* + * Functions provided by ip.c + */ + +extern void ip_print(const struct iphdr *ip); +extern int ip_ioctl(struct sock *sk, int cmd, unsigned long arg); +extern void ip_route_check(__u32 daddr); +extern int ip_send(struct rtable *rt, struct sk_buff *skb, __u32 daddr, int len, struct device *dev, __u32 saddr); +extern int ip_build_header(struct sk_buff *skb, + __u32 saddr, + __u32 daddr, + struct device **dev, int type, + struct options *opt, int len, + int tos,int ttl,struct rtable **rp); +extern int ip_rcv(struct sk_buff *skb, struct device *dev, + struct packet_type *pt); +extern int ip_options_echo(struct options * dopt, struct options * sopt, + __u32 daddr, __u32 saddr, + struct sk_buff * skb); +extern int ip_options_compile(struct options * opt, struct sk_buff * skb); +extern void ip_send_check(struct iphdr *ip); +extern int ip_id_count; +extern void ip_queue_xmit(struct sock *sk, + struct device *dev, struct sk_buff *skb, + int free); +extern void ip_init(void); +extern int ip_build_xmit(struct sock *sk, + void getfrag (const void *, + __u32, + char *, + unsigned int, + unsigned int), + const void *frag, + unsigned short int length, + __u32 daddr, + __u32 saddr, + struct options * opt, + int flags, + int type, + int noblock); + +extern struct ip_mib ip_statistics; + +/* + * Functions provided by ip_fragment.o + */ + +struct sk_buff *ip_defrag(struct iphdr *iph, struct sk_buff *skb, struct device *dev); +void ip_fragment(struct sock *sk, struct sk_buff *skb, struct device *dev, int is_frag); + +/* + * Functions provided by ip_forward.c + */ + +extern int ip_forward(struct sk_buff *skb, struct device *dev, int is_frag, __u32 target_addr); + +/* + * Functions provided by ip_options.c + */ + +extern void ip_options_build(struct sk_buff *skb, struct options *opt, __u32 daddr, __u32 saddr, int is_frag); +extern int ip_options_echo(struct options *dopt, struct options *sopt, __u32 daddr, __u32 saddr, struct sk_buff *skb); +extern void ip_options_fragment(struct sk_buff *skb); +extern int ip_options_compile(struct options *opt, struct sk_buff *skb); + +/* + * Functions provided by ip_sockglue.c + */ + +extern int ip_setsockopt(struct sock *sk, int level, int optname, char *optval, int optlen); +extern int ip_getsockopt(struct sock *sk, int level, int optname, char *optval, int *optlen); + +#endif /* _IP_H */ diff --git a/i386/i386at/gpl/linux/include/net/ip_alias.h b/i386/i386at/gpl/linux/include/net/ip_alias.h new file mode 100644 index 0000000..683a042 --- /dev/null +++ b/i386/i386at/gpl/linux/include/net/ip_alias.h @@ -0,0 +1,23 @@ +/* + * IP_ALIAS (AF_INET) aliasing definitions. + * + * + * Version: @(#)ip_alias.h 0.43 12/20/95 + * + * Author: Juan Jose Ciarlante, <jjciarla@raiz.uncu.edu.ar> + * + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + */ + +#ifndef _IP_ALIAS_H +#define _IP_ALIAS_H + +extern int ip_alias_init(void); +extern int ip_alias_done(void); + +#endif /* _IP_ALIAS_H */ diff --git a/i386/i386at/gpl/linux/include/net/ip_forward.h b/i386/i386at/gpl/linux/include/net/ip_forward.h new file mode 100644 index 0000000..b859650 --- /dev/null +++ b/i386/i386at/gpl/linux/include/net/ip_forward.h @@ -0,0 +1,10 @@ +#ifndef __NET_IP_FORWARD_H +#define __NET_IP_FORWARD_H + +#define IPFWD_FRAGMENT 1 +#define IPFWD_LASTFRAG 2 +#define IPFWD_MASQUERADED 4 +#define IPFWD_MULTICASTING 8 +#define IPFWD_MULTITUNNEL 16 + +#endif diff --git a/i386/i386at/gpl/linux/include/net/ipip.h b/i386/i386at/gpl/linux/include/net/ipip.h new file mode 100644 index 0000000..bba1492 --- /dev/null +++ b/i386/i386at/gpl/linux/include/net/ipip.h @@ -0,0 +1,4 @@ +extern int ipip_rcv(struct sk_buff *skb, struct device *dev, struct options *opt, + __u32 daddr, unsigned short len, __u32 saddr, + int redo, struct inet_protocol *protocol); + diff --git a/i386/i386at/gpl/linux/include/net/ipx.h b/i386/i386at/gpl/linux/include/net/ipx.h new file mode 100644 index 0000000..96c6240 --- /dev/null +++ b/i386/i386at/gpl/linux/include/net/ipx.h @@ -0,0 +1,85 @@ + +/* + * The following information is in its entirety obtained from: + * + * Novell 'IPX Router Specification' Version 1.10 + * Part No. 107-000029-001 + * + * Which is available from ftp.novell.com + */ + +#ifndef _NET_INET_IPX_H_ +#define _NET_INET_IPX_H_ + +#include <linux/skbuff.h> +#include <net/datalink.h> +#include <linux/ipx.h> + +typedef struct +{ + unsigned long net; + unsigned char node[IPX_NODE_LEN]; + unsigned short sock; +} ipx_address; + +#define ipx_broadcast_node "\377\377\377\377\377\377" +#define ipx_this_node "\0\0\0\0\0\0" + +typedef struct ipx_packet +{ + unsigned short ipx_checksum; +#define IPX_NO_CHECKSUM 0xFFFF + unsigned short ipx_pktsize; + unsigned char ipx_tctrl; + unsigned char ipx_type; +#define IPX_TYPE_UNKNOWN 0x00 +#define IPX_TYPE_RIP 0x01 /* may also be 0 */ +#define IPX_TYPE_SAP 0x04 /* may also be 0 */ +#define IPX_TYPE_SPX 0x05 /* Not yet implemented */ +#define IPX_TYPE_NCP 0x11 /* $lots for docs on this (SPIT) */ +#define IPX_TYPE_PPROP 0x14 /* complicated flood fill brdcast [Not supported] */ + ipx_address ipx_dest __attribute__ ((packed)); + ipx_address ipx_source __attribute__ ((packed)); +} ipx_packet; + + +typedef struct sock ipx_socket; + +#include <net/ipxcall.h> +extern int ipx_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt); +extern void ipxrtr_device_down(struct device *dev); + +typedef struct ipx_interface { + /* IPX address */ + unsigned long if_netnum; + unsigned char if_node[IPX_NODE_LEN]; + + /* physical device info */ + struct device *if_dev; + struct datalink_proto *if_dlink; + unsigned short if_dlink_type; + + /* socket support */ + unsigned short if_sknum; + ipx_socket *if_sklist; + + /* administrative overhead */ + int if_ipx_offset; + unsigned char if_internal; + unsigned char if_primary; + + struct ipx_interface *if_next; +} ipx_interface; + +typedef struct ipx_route { + unsigned long ir_net; + ipx_interface *ir_intrfc; + unsigned char ir_routed; + unsigned char ir_router_node[IPX_NODE_LEN]; + struct ipx_route *ir_next; +} ipx_route; + +#define IPX_MIN_EPHEMERAL_SOCKET 0x4000 +#define IPX_MAX_EPHEMERAL_SOCKET 0x7fff + +#endif diff --git a/i386/i386at/gpl/linux/include/net/ipxcall.h b/i386/i386at/gpl/linux/include/net/ipxcall.h new file mode 100644 index 0000000..eb5bd2b --- /dev/null +++ b/i386/i386at/gpl/linux/include/net/ipxcall.h @@ -0,0 +1,2 @@ +/* Separate to keep compilation of protocols.c simpler */ +extern void ipx_proto_init(struct net_proto *pro); diff --git a/i386/i386at/gpl/linux/include/net/netlink.h b/i386/i386at/gpl/linux/include/net/netlink.h new file mode 100644 index 0000000..e32af15 --- /dev/null +++ b/i386/i386at/gpl/linux/include/net/netlink.h @@ -0,0 +1,26 @@ +#ifndef __NET_NETLINK_H +#define __NET_NETLINK_H + +#define NET_MAJOR 36 /* Major 18 is reserved for networking */ +#define MAX_LINKS 4 /* 18,0 for route updates, 18,1 for SKIP, 18,2 debug tap 18,3 PPP reserved */ +#define MAX_QBYTES 32768 /* Maximum bytes in the queue */ + +#include <linux/config.h> + +extern int netlink_attach(int unit, int (*function)(struct sk_buff *skb)); +extern int netlink_donothing(struct sk_buff *skb); +extern void netlink_detach(int unit); +extern int netlink_post(int unit, struct sk_buff *skb); +extern int init_netlink(void); + +#define NETLINK_ROUTE 0 /* Routing/device hook */ +#define NETLINK_SKIP 1 /* Reserved for ENskip */ +#define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */ +#define NETLINK_FIREWALL 3 /* Firewalling hook */ + +#ifdef CONFIG_RTNETLINK +extern void ip_netlink_msg(unsigned long, __u32, __u32, __u32, short, short, char *); +#else +#define ip_netlink_msg(a,b,c,d,e,f,g) +#endif +#endif diff --git a/i386/i386at/gpl/linux/include/net/netrom.h b/i386/i386at/gpl/linux/include/net/netrom.h new file mode 100644 index 0000000..5e343bb --- /dev/null +++ b/i386/i386at/gpl/linux/include/net/netrom.h @@ -0,0 +1,139 @@ +/* + * Declarations of NET/ROM type objects. + * + * Jonathan Naylor G4KLX 9/4/95 + */ + +#ifndef _NETROM_H +#define _NETROM_H +#include <linux/netrom.h> + +#define NR_T1CLAMPLO (1 * PR_SLOWHZ) /* If defined, clamp at 1 second **/ +#define NR_T1CLAMPHI (300 * PR_SLOWHZ) /* If defined, clamp at 30 seconds **/ + +#define NR_NETWORK_LEN 15 +#define NR_TRANSPORT_LEN 5 + +#define NR_PROTO_IP 0x0C + +#define NR_PROTOEXT 0x00 +#define NR_CONNREQ 0x01 +#define NR_CONNACK 0x02 +#define NR_DISCREQ 0x03 +#define NR_DISCACK 0x04 +#define NR_INFO 0x05 +#define NR_INFOACK 0x06 + +#define NR_CHOKE_FLAG 0x80 +#define NR_NAK_FLAG 0x40 +#define NR_MORE_FLAG 0x20 + +/* Define Link State constants. */ + +#define NR_STATE_0 0 +#define NR_STATE_1 1 +#define NR_STATE_2 2 +#define NR_STATE_3 3 + +#define NR_DEFAULT_T1 (120 * PR_SLOWHZ) /* Outstanding frames - 120 seconds */ +#define NR_DEFAULT_T2 (5 * PR_SLOWHZ) /* Response delay - 5 seconds */ +#define NR_DEFAULT_N2 3 /* Number of Retries */ +#define NR_DEFAULT_T4 (180 * PR_SLOWHZ) /* Transport Busy Delay */ +#define NR_DEFAULT_WINDOW 4 /* Default Window Size */ +#define NR_DEFAULT_OBS 6 /* Default Obscolesence Count */ +#define NR_DEFAULT_QUAL 10 /* Default Neighbour Quality */ +#define NR_DEFAULT_TTL 16 /* Default Time To Live */ +#define NR_MODULUS 256 +#define NR_MAX_WINDOW_SIZE 127 /* Maximum Window Allowable */ + +typedef struct { + ax25_address user_addr, source_addr, dest_addr; + struct device *device; + unsigned char my_index, my_id; + unsigned char your_index, your_id; + unsigned char state, condition, bpqext, hdrincl; + unsigned short vs, vr, va, vl; + unsigned char n2, n2count; + unsigned short t1, t2, rtt; + unsigned short t1timer, t2timer, t4timer; + unsigned short fraglen; + struct sk_buff_head ack_queue; + struct sk_buff_head reseq_queue; + struct sk_buff_head frag_queue; + struct sock *sk; /* Backlink to socket */ +} nr_cb; + +struct nr_route { + unsigned char quality; + unsigned char obs_count; + unsigned short neighbour; +}; + +struct nr_node { + struct nr_node *next; + ax25_address callsign; + char mnemonic[7]; + unsigned char which; + unsigned char count; + struct nr_route routes[3]; +}; + +struct nr_neigh { + struct nr_neigh *next; + ax25_address callsign; + ax25_digi *digipeat; + struct device *dev; + unsigned char quality; + unsigned char locked; + unsigned short count; + unsigned short number; +}; + +/* af_netrom.c */ +extern struct nr_parms_struct nr_default; +extern int nr_rx_frame(struct sk_buff *, struct device *); +extern void nr_destroy_socket(struct sock *); + +/* nr_dev.c */ +extern int nr_rx_ip(struct sk_buff *, struct device *); +extern int nr_init(struct device *); + +#include <net/nrcall.h> + +/* nr_in.c */ +extern int nr_process_rx_frame(struct sock *, struct sk_buff *); + +/* nr_out.c */ +extern void nr_output(struct sock *, struct sk_buff *); +extern void nr_send_nak_frame(struct sock *); +extern void nr_kick(struct sock *); +extern void nr_transmit_buffer(struct sock *, struct sk_buff *); +extern void nr_establish_data_link(struct sock *); +extern void nr_enquiry_response(struct sock *); +extern void nr_check_iframes_acked(struct sock *, unsigned short); + +/* nr_route.c */ +extern void nr_rt_device_down(struct device *); +extern struct device *nr_dev_first(void); +extern struct device *nr_dev_get(ax25_address *); +extern int nr_rt_ioctl(unsigned int, void *); +extern void nr_link_failed(ax25_address *, struct device *); +extern int nr_route_frame(struct sk_buff *, ax25_cb *); +extern int nr_nodes_get_info(char *, char **, off_t, int, int); +extern int nr_neigh_get_info(char *, char **, off_t, int, int); + +/* nr_subr.c */ +extern void nr_clear_queues(struct sock *); +extern void nr_frames_acked(struct sock *, unsigned short); +extern void nr_requeue_frames(struct sock *); +extern int nr_validate_nr(struct sock *, unsigned short); +extern int nr_in_rx_window(struct sock *, unsigned short); +extern void nr_write_internal(struct sock *, int); +extern void nr_transmit_dm(struct sk_buff *); +extern unsigned short nr_calculate_t1(struct sock *); +extern void nr_calculate_rtt(struct sock *); + +/* ax25_timer */ +extern void nr_set_timer(struct sock *); + +#endif diff --git a/i386/i386at/gpl/linux/include/net/nrcall.h b/i386/i386at/gpl/linux/include/net/nrcall.h new file mode 100644 index 0000000..f58c2d4 --- /dev/null +++ b/i386/i386at/gpl/linux/include/net/nrcall.h @@ -0,0 +1,2 @@ +/* Seperate to keep compilation of protocols.c simpler */ +extern void nr_proto_init(struct net_proto *pro); diff --git a/i386/i386at/gpl/linux/include/net/p8022.h b/i386/i386at/gpl/linux/include/net/p8022.h new file mode 100644 index 0000000..52c676b --- /dev/null +++ b/i386/i386at/gpl/linux/include/net/p8022.h @@ -0,0 +1,2 @@ +struct datalink_proto *register_8022_client(unsigned char type, int (*rcvfunc)(struct sk_buff *, struct device *, struct packet_type *)); + diff --git a/i386/i386at/gpl/linux/include/net/p8022call.h b/i386/i386at/gpl/linux/include/net/p8022call.h new file mode 100644 index 0000000..14f0c2c --- /dev/null +++ b/i386/i386at/gpl/linux/include/net/p8022call.h @@ -0,0 +1,2 @@ +/* Separate to keep compilation of Space.c simpler */ +extern void p8022_proto_init(struct net_proto *); diff --git a/i386/i386at/gpl/linux/include/net/protocol.h b/i386/i386at/gpl/linux/include/net/protocol.h new file mode 100644 index 0000000..ae328b6 --- /dev/null +++ b/i386/i386at/gpl/linux/include/net/protocol.h @@ -0,0 +1,55 @@ +/* + * INET An implementation of the TCP/IP protocol suite for the LINUX + * operating system. INET is implemented using the BSD Socket + * interface as the means of communication with the user level. + * + * Definitions for the protocol dispatcher. + * + * Version: @(#)protocol.h 1.0.2 05/07/93 + * + * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + * Changes: + * Alan Cox : Added a name field and a frag handler + * field for later. + * Alan Cox : Cleaned up, and sorted types. + */ + +#ifndef _PROTOCOL_H +#define _PROTOCOL_H + +#define MAX_INET_PROTOS 32 /* Must be a power of 2 */ + + +/* This is used to register protocols. */ +struct inet_protocol { + int (*handler)(struct sk_buff *skb, struct device *dev, + struct options *opt, __u32 daddr, + unsigned short len, __u32 saddr, + int redo, struct inet_protocol *protocol); + void (*err_handler)(int type, int code, unsigned char *buff, + __u32 daddr, + __u32 saddr, + struct inet_protocol *protocol); + struct inet_protocol *next; + unsigned char protocol; + unsigned char copy:1; + void *data; + const char *name; +}; + + +extern struct inet_protocol *inet_protocol_base; +extern struct inet_protocol *inet_protos[MAX_INET_PROTOS]; + + +extern void inet_add_protocol(struct inet_protocol *prot); +extern int inet_del_protocol(struct inet_protocol *prot); + + +#endif /* _PROTOCOL_H */ diff --git a/i386/i386at/gpl/linux/include/net/psnap.h b/i386/i386at/gpl/linux/include/net/psnap.h new file mode 100644 index 0000000..b69859d --- /dev/null +++ b/i386/i386at/gpl/linux/include/net/psnap.h @@ -0,0 +1,2 @@ +struct datalink_proto *register_snap_client(unsigned char *desc, int (*rcvfunc)(struct sk_buff *, struct device *, struct packet_type *)); + diff --git a/i386/i386at/gpl/linux/include/net/psnapcall.h b/i386/i386at/gpl/linux/include/net/psnapcall.h new file mode 100644 index 0000000..9da5763 --- /dev/null +++ b/i386/i386at/gpl/linux/include/net/psnapcall.h @@ -0,0 +1,2 @@ +/* Separate to keep compilation of Space.c simpler */ +extern void snap_proto_init(struct net_proto *); diff --git a/i386/i386at/gpl/linux/include/net/rarp.h b/i386/i386at/gpl/linux/include/net/rarp.h new file mode 100644 index 0000000..7bfb08e --- /dev/null +++ b/i386/i386at/gpl/linux/include/net/rarp.h @@ -0,0 +1,12 @@ +/* linux/net/inet/rarp.h */ +#ifndef _RARP_H +#define _RARP_H + +extern int rarp_ioctl(unsigned int cmd, void *arg); +extern int rarp_get_info(char *buffer, + char **start, + off_t offset, + int length, + int dummy); +#endif /* _RARP_H */ + diff --git a/i386/i386at/gpl/linux/include/net/raw.h b/i386/i386at/gpl/linux/include/net/raw.h new file mode 100644 index 0000000..4b42487 --- /dev/null +++ b/i386/i386at/gpl/linux/include/net/raw.h @@ -0,0 +1,34 @@ +/* + * INET An implementation of the TCP/IP protocol suite for the LINUX + * operating system. INET is implemented using the BSD Socket + * interface as the means of communication with the user level. + * + * Definitions for the RAW-IP module. + * + * Version: @(#)raw.h 1.0.2 05/07/93 + * + * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ +#ifndef _RAW_H +#define _RAW_H + + +extern struct proto raw_prot; + + +extern void raw_err(int type, int code, unsigned char *header, __u32 daddr, + __u32 saddr, struct inet_protocol *protocol); +extern int raw_recvfrom(struct sock *sk, unsigned char *to, + int len, int noblock, unsigned flags, + struct sockaddr_in *sin, int *addr_len); +extern int raw_read(struct sock *sk, unsigned char *buff, + int len, int noblock, unsigned flags); +extern int raw_rcv(struct sock *, struct sk_buff *, struct device *, + __u32, __u32); + +#endif /* _RAW_H */ diff --git a/i386/i386at/gpl/linux/include/net/route.h b/i386/i386at/gpl/linux/include/net/route.h new file mode 100644 index 0000000..8ce6738 --- /dev/null +++ b/i386/i386at/gpl/linux/include/net/route.h @@ -0,0 +1,280 @@ +/* + * INET An implementation of the TCP/IP protocol suite for the LINUX + * operating system. INET is implemented using the BSD Socket + * interface as the means of communication with the user level. + * + * Definitions for the IP router. + * + * Version: @(#)route.h 1.0.4 05/27/93 + * + * Authors: Ross Biro, <bir7@leland.Stanford.Edu> + * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> + * Fixes: + * Alan Cox : Reformatted. Added ip_rt_local() + * Alan Cox : Support for TCP parameters. + * Alexey Kuznetsov: Major changes for new routing code. + * + * FIXME: + * Modules stuff is broken at the moment. + * Make atomic ops more generic and hide them in asm/... + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ +#ifndef _ROUTE_H +#define _ROUTE_H + +#include <linux/config.h> + +/* + * 0 - no debugging messages + * 1 - rare events and bugs situations (default) + * 2 - trace mode. + */ +#define RT_CACHE_DEBUG 1 + +#define RT_HASH_DIVISOR 256 +#define RT_CACHE_SIZE_MAX 256 + +#define RTZ_HASH_DIVISOR 256 + +#if RT_CACHE_DEBUG >= 2 +#define RTZ_HASHING_LIMIT 0 +#else +#define RTZ_HASHING_LIMIT 16 +#endif + +/* + * Maximal time to live for unused entry. + */ +#define RT_CACHE_TIMEOUT (HZ*300) + +/* + * Prevents LRU trashing, entries considered equivalent, + * if the difference between last use times is less then this number. + */ +#define RT_CACHE_BUBBLE_THRESHOULD (HZ*5) + +#include <linux/route.h> + +#ifdef __KERNEL__ +#define RTF_LOCAL 0x8000 +#endif + +/* + * Semaphores. + */ +#if defined(__alpha__) + +static __inline__ void ATOMIC_INCR(unsigned int * addr) +{ + unsigned tmp; + + __asm__ __volatile__( + "1:\n\ + ldl_l %1,%2\n\ + addl %1,1,%1\n\ + stl_c %1,%0\n\ + beq %1,1b\n" + : "m=" (*addr), "r=&" (tmp) + : "m"(*addr)); +} + +static __inline__ void ATOMIC_DECR(unsigned int * addr) +{ + unsigned tmp; + + __asm__ __volatile__( + "1:\n\ + ldl_l %1,%2\n\ + subl %1,1,%1\n\ + stl_c %1,%0\n\ + beq %1,1b\n" + : "m=" (*addr), "r=&" (tmp) + : "m"(*addr)); +} + +static __inline__ int ATOMIC_DECR_AND_CHECK (unsigned int * addr) +{ + unsigned tmp; + int result; + + __asm__ __volatile__( + "1:\n\ + ldl_l %1,%3\n\ + subl %1,1,%1\n\ + mov %1,%2\n\ + stl_c %1,%0\n\ + beq %1,1b\n" + : "m=" (*addr), "r=&" (tmp), "r=&"(result) + : "m"(*addr)); + return result; +} + +#elif defined(__i386__) +#include <asm/bitops.h> + +extern __inline__ void ATOMIC_INCR(void * addr) +{ + __asm__ __volatile__( + "incl %0" + :"=m" (ADDR)); +} + +extern __inline__ void ATOMIC_DECR(void * addr) +{ + __asm__ __volatile__( + "decl %0" + :"=m" (ADDR)); +} + +/* + * It is DECR that is ATOMIC, not CHECK! + * If you want to do atomic checks, use cli()/sti(). --ANK + */ + +extern __inline__ unsigned long ATOMIC_DECR_AND_CHECK(void * addr) +{ + unsigned long retval; + __asm__ __volatile__( + "decl %0\nmovl %0,%1" + : "=m" (ADDR), "=r"(retval)); + return retval; +} + + +#else + +static __inline__ void ATOMIC_INCR(unsigned int * addr) +{ + (*(__volatile__ unsigned int*)addr)++; +} + +static __inline__ void ATOMIC_DECR(unsigned int * addr) +{ + (*(__volatile__ unsigned int*)addr)--; +} + +static __inline__ int ATOMIC_DECR_AND_CHECK (unsigned int * addr) +{ + ATOMIC_DECR(addr); + return *(volatile unsigned int*)addr; +} + +#endif + + + +struct rtable +{ + struct rtable *rt_next; + __u32 rt_dst; + __u32 rt_src; + __u32 rt_gateway; + unsigned rt_refcnt; + unsigned rt_use; + unsigned long rt_window; + unsigned long rt_lastuse; + struct hh_cache *rt_hh; + struct device *rt_dev; + unsigned short rt_flags; + unsigned short rt_mtu; + unsigned short rt_irtt; + unsigned char rt_tos; +}; + +extern void ip_rt_flush(struct device *dev); +extern void ip_rt_redirect(__u32 src, __u32 dst, __u32 gw, struct device *dev); +extern struct rtable *ip_rt_slow_route(__u32 daddr, int local); +extern int rt_get_info(char * buffer, char **start, off_t offset, int length, int dummy); +extern int rt_cache_get_info(char *buffer, char **start, off_t offset, int length, int dummy); +extern int ip_rt_ioctl(unsigned int cmd, void *arg); +extern int ip_rt_new(struct rtentry *rt); +extern void ip_rt_check_expire(void); +extern void ip_rt_advice(struct rtable **rp, int advice); + +extern void ip_rt_run_bh(void); +extern int ip_rt_lock; +extern unsigned ip_rt_bh_mask; +extern struct rtable *ip_rt_hash_table[RT_HASH_DIVISOR]; + +extern __inline__ void ip_rt_fast_lock(void) +{ + ATOMIC_INCR(&ip_rt_lock); +} + +extern __inline__ void ip_rt_fast_unlock(void) +{ + ATOMIC_DECR(&ip_rt_lock); +} + +extern __inline__ void ip_rt_unlock(void) +{ + if (!ATOMIC_DECR_AND_CHECK(&ip_rt_lock) && ip_rt_bh_mask) + ip_rt_run_bh(); +} + +extern __inline__ unsigned ip_rt_hash_code(__u32 addr) +{ + unsigned tmp = addr + (addr>>16); + return (tmp + (tmp>>8)) & 0xFF; +} + + +extern __inline__ void ip_rt_put(struct rtable * rt) +#ifndef MODULE +{ + if (rt) + ATOMIC_DECR(&rt->rt_refcnt); +} +#else +; +#endif + +#ifdef CONFIG_KERNELD +extern struct rtable * ip_rt_route(__u32 daddr, int local); +#else +extern __inline__ struct rtable * ip_rt_route(__u32 daddr, int local) +#ifndef MODULE +{ + struct rtable * rth; + + ip_rt_fast_lock(); + + for (rth=ip_rt_hash_table[ip_rt_hash_code(daddr)^local]; rth; rth=rth->rt_next) + { + if (rth->rt_dst == daddr) + { + rth->rt_lastuse = jiffies; + ATOMIC_INCR(&rth->rt_use); + ATOMIC_INCR(&rth->rt_refcnt); + ip_rt_unlock(); + return rth; + } + } + return ip_rt_slow_route (daddr, local); +} +#else +; +#endif +#endif + +extern __inline__ struct rtable * ip_check_route(struct rtable ** rp, + __u32 daddr, int local) +{ + struct rtable * rt = *rp; + + if (!rt || rt->rt_dst != daddr || !(rt->rt_flags&RTF_UP) + || ((local==1)^((rt->rt_flags&RTF_LOCAL) != 0))) + { + ip_rt_put(rt); + rt = ip_rt_route(daddr, local); + *rp = rt; + } + return rt; +} + + +#endif /* _ROUTE_H */ diff --git a/i386/i386at/gpl/linux/include/net/slhc.h b/i386/i386at/gpl/linux/include/net/slhc.h new file mode 100644 index 0000000..c7b39db --- /dev/null +++ b/i386/i386at/gpl/linux/include/net/slhc.h @@ -0,0 +1,6 @@ +#ifndef __NET_SLHC_H +#define __NET_SLHC_H + +extern void slhc_install(void); + +#endif diff --git a/i386/i386at/gpl/linux/include/net/snmp.h b/i386/i386at/gpl/linux/include/net/snmp.h new file mode 100644 index 0000000..552292b --- /dev/null +++ b/i386/i386at/gpl/linux/include/net/snmp.h @@ -0,0 +1,107 @@ +/* + * + * SNMP MIB entries for the IP subsystem. + * + * Alan Cox <gw4pts@gw4pts.ampr.org> + * + * We don't chose to implement SNMP in the kernel (this would + * be silly as SNMP is a pain in the backside in places). We do + * however need to collect the MIB statistics and export them + * out of /proc (eventually) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + */ + +#ifndef _SNMP_H +#define _SNMP_H + +/* + * We use all unsigned longs. Linux will soon be so reliable that even these + * will rapidly get too small 8-). Seriously consider the IpInReceives count + * on the 20Gb/s + networks people expect in a few years time! + */ + +struct ip_mib +{ + unsigned long IpForwarding; + unsigned long IpDefaultTTL; + unsigned long IpInReceives; + unsigned long IpInHdrErrors; + unsigned long IpInAddrErrors; + unsigned long IpForwDatagrams; + unsigned long IpInUnknownProtos; + unsigned long IpInDiscards; + unsigned long IpInDelivers; + unsigned long IpOutRequests; + unsigned long IpOutDiscards; + unsigned long IpOutNoRoutes; + unsigned long IpReasmTimeout; + unsigned long IpReasmReqds; + unsigned long IpReasmOKs; + unsigned long IpReasmFails; + unsigned long IpFragOKs; + unsigned long IpFragFails; + unsigned long IpFragCreates; +}; + + +struct icmp_mib +{ + unsigned long IcmpInMsgs; + unsigned long IcmpInErrors; + unsigned long IcmpInDestUnreachs; + unsigned long IcmpInTimeExcds; + unsigned long IcmpInParmProbs; + unsigned long IcmpInSrcQuenchs; + unsigned long IcmpInRedirects; + unsigned long IcmpInEchos; + unsigned long IcmpInEchoReps; + unsigned long IcmpInTimestamps; + unsigned long IcmpInTimestampReps; + unsigned long IcmpInAddrMasks; + unsigned long IcmpInAddrMaskReps; + unsigned long IcmpOutMsgs; + unsigned long IcmpOutErrors; + unsigned long IcmpOutDestUnreachs; + unsigned long IcmpOutTimeExcds; + unsigned long IcmpOutParmProbs; + unsigned long IcmpOutSrcQuenchs; + unsigned long IcmpOutRedirects; + unsigned long IcmpOutEchos; + unsigned long IcmpOutEchoReps; + unsigned long IcmpOutTimestamps; + unsigned long IcmpOutTimestampReps; + unsigned long IcmpOutAddrMasks; + unsigned long IcmpOutAddrMaskReps; +}; + +struct tcp_mib +{ + unsigned long TcpRtoAlgorithm; + unsigned long TcpRtoMin; + unsigned long TcpRtoMax; + unsigned long TcpMaxConn; + unsigned long TcpActiveOpens; + unsigned long TcpPassiveOpens; + unsigned long TcpAttemptFails; + unsigned long TcpEstabResets; + unsigned long TcpCurrEstab; + unsigned long TcpInSegs; + unsigned long TcpOutSegs; + unsigned long TcpRetransSegs; +}; + +struct udp_mib +{ + unsigned long UdpInDatagrams; + unsigned long UdpNoPorts; + unsigned long UdpInErrors; + unsigned long UdpOutDatagrams; +}; + + +#endif diff --git a/i386/i386at/gpl/linux/include/net/sock.h b/i386/i386at/gpl/linux/include/net/sock.h new file mode 100644 index 0000000..dc7a4a9 --- /dev/null +++ b/i386/i386at/gpl/linux/include/net/sock.h @@ -0,0 +1,486 @@ +/* + * INET An implementation of the TCP/IP protocol suite for the LINUX + * operating system. INET is implemented using the BSD Socket + * interface as the means of communication with the user level. + * + * Definitions for the AF_INET socket handler. + * + * Version: @(#)sock.h 1.0.4 05/13/93 + * + * Authors: Ross Biro, <bir7@leland.Stanford.Edu> + * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> + * Corey Minyard <wf-rch!minyard@relay.EU.net> + * Florian La Roche <flla@stud.uni-sb.de> + * + * Fixes: + * Alan Cox : Volatiles in skbuff pointers. See + * skbuff comments. May be overdone, + * better to prove they can be removed + * than the reverse. + * Alan Cox : Added a zapped field for tcp to note + * a socket is reset and must stay shut up + * Alan Cox : New fields for options + * Pauline Middelink : identd support + * Alan Cox : Eliminate low level recv/recvfrom + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ +#ifndef _SOCK_H +#define _SOCK_H + +#include <linux/timer.h> +#include <linux/ip.h> /* struct options */ +#include <linux/in.h> /* struct sockaddr_in */ +#include <linux/tcp.h> /* struct tcphdr */ +#include <linux/config.h> + +#include <linux/netdevice.h> +#include <linux/skbuff.h> /* struct sk_buff */ +#include <net/protocol.h> /* struct inet_protocol */ +#ifdef CONFIG_AX25 +#include <net/ax25.h> +#ifdef CONFIG_NETROM +#include <net/netrom.h> +#endif +#endif +#ifdef CONFIG_IPX +#include <net/ipx.h> +#endif +#ifdef CONFIG_ATALK +#include <linux/atalk.h> +#endif + +#include <linux/igmp.h> + +/* Think big (also on some systems a byte is faster) */ +#define SOCK_ARRAY_SIZE 256 + + +/* + * The AF_UNIX specific socket options + */ + +struct unix_opt +{ + int family; + char * name; + int locks; + struct inode * inode; + struct semaphore readsem; + struct sock * other; +}; + +/* + * IP packet socket options + */ + +struct inet_packet_opt +{ + struct notifier_block notifier; /* Used when bound */ + struct device *bound_dev; + unsigned long dev_stamp; + struct packet_type *prot_hook; + char device_name[15]; +}; + + +/* + * This structure really needs to be cleaned up. + * Most of it is for TCP, and not used by any of + * the other protocols. + */ +struct sock +{ + struct options *opt; + volatile unsigned long wmem_alloc; + volatile unsigned long rmem_alloc; + unsigned long allocation; /* Allocation mode */ + __u32 write_seq; + __u32 sent_seq; + __u32 acked_seq; + __u32 copied_seq; + __u32 rcv_ack_seq; + __u32 window_seq; + __u32 fin_seq; + __u32 urg_seq; + __u32 urg_data; + int users; /* user count */ + /* + * Not all are volatile, but some are, so we + * might as well say they all are. + */ + volatile char dead, + urginline, + intr, + blog, + done, + reuse, + keepopen, + linger, + delay_acks, + destroy, + ack_timed, + no_check, + zapped, /* In ax25 & ipx means not linked */ + broadcast, + nonagle, + bsdism; + unsigned long lingertime; + int proc; + struct sock *next; + struct sock *prev; /* Doubly linked chain.. */ + struct sock *pair; + struct sk_buff * volatile send_head; + struct sk_buff * volatile send_tail; + struct sk_buff_head back_log; + struct sk_buff *partial; + struct timer_list partial_timer; + long retransmits; + struct sk_buff_head write_queue, + receive_queue; + struct proto *prot; + struct wait_queue **sleep; + __u32 daddr; + __u32 saddr; /* Sending source */ + __u32 rcv_saddr; /* Bound address */ + unsigned short max_unacked; + unsigned short window; + __u32 lastwin_seq; /* sequence number when we last updated the window we offer */ + volatile unsigned long ato; /* ack timeout */ + volatile unsigned long lrcvtime; /* jiffies at last rcv */ + unsigned short bytes_rcv; +/* + * mss is min(mtu, max_window) + */ + unsigned short mtu; /* mss negotiated in the syn's */ + volatile unsigned short mss; /* current eff. mss - can change */ + volatile unsigned short user_mss; /* mss requested by user in ioctl */ + volatile unsigned short max_window; + unsigned long window_clamp; + unsigned short num; + volatile unsigned short cong_window; + volatile unsigned short cong_count; + volatile unsigned short ssthresh; + volatile unsigned short packets_out; + volatile unsigned short shutdown; + volatile unsigned long rtt; + volatile unsigned long mdev; + volatile unsigned long rto; + +/* + * currently backoff isn't used, but I'm maintaining it in case + * we want to go back to a backoff formula that needs it + */ + + volatile unsigned short backoff; + volatile int err, err_soft; /* Soft holds errors that don't + cause failure but are the cause + of a persistent failure not just + 'timed out' */ + unsigned char protocol; + volatile unsigned char state; + volatile unsigned char ack_backlog; + unsigned char max_ack_backlog; + unsigned char priority; + unsigned char debug; + unsigned short rcvbuf; + unsigned short sndbuf; + unsigned short type; + unsigned char localroute; /* Route locally only */ +#ifdef CONFIG_IPX +/* + * Once the IPX ncpd patches are in these are going into protinfo + */ + ipx_address ipx_dest_addr; + ipx_interface *ipx_intrfc; + unsigned short ipx_port; + +/* To handle asynchronous messages from the NetWare server, we have to + * know the connection this socket belongs to. Sorry to blow up this + * structure even more. */ + struct ncp_server *ipx_ncp_server; + +#ifdef CONFIG_IPX_INTERN + unsigned char ipx_node[IPX_NODE_LEN]; +#endif + unsigned short ipx_type; +#endif +#ifdef CONFIG_AX25 + ax25_cb *ax25; +#ifdef CONFIG_NETROM + nr_cb *nr; +#endif +#endif + +/* + * This is where all the private (optional) areas that don't + * overlap will eventually live. + */ + + union + { + struct unix_opt af_unix; +#ifdef CONFIG_ATALK + struct atalk_sock af_at; +#endif +#ifdef CONFIG_INET + struct inet_packet_opt af_packet; +#endif + } protinfo; + +/* + * IP 'private area' or will be eventually + */ + int ip_ttl; /* TTL setting */ + int ip_tos; /* TOS */ + struct tcphdr dummy_th; + struct timer_list keepalive_timer; /* TCP keepalive hack */ + struct timer_list retransmit_timer; /* TCP retransmit timer */ + struct timer_list ack_timer; /* TCP delayed ack timer */ + int ip_xmit_timeout; /* Why the timeout is running */ + struct rtable *ip_route_cache; /* Cached output route */ + unsigned char ip_hdrincl; /* Include headers ? */ +#ifdef CONFIG_IP_MULTICAST + int ip_mc_ttl; /* Multicasting TTL */ + int ip_mc_loop; /* Loopback */ + char ip_mc_name[MAX_ADDR_LEN];/* Multicast device name */ + struct ip_mc_socklist *ip_mc_list; /* Group array */ +#endif + +/* + * This part is used for the timeout functions (timer.c). + */ + + int timeout; /* What are we waiting for? */ + struct timer_list timer; /* This is the TIME_WAIT/receive timer + * when we are doing IP + */ + struct timeval stamp; + + /* + * Identd + */ + + struct socket *socket; + + /* + * Callbacks + */ + + void (*state_change)(struct sock *sk); + void (*data_ready)(struct sock *sk,int bytes); + void (*write_space)(struct sock *sk); + void (*error_report)(struct sock *sk); + +}; + +/* + * IP protocol blocks we attach to sockets. + */ + +struct proto +{ + void (*close)(struct sock *sk, unsigned long timeout); + int (*build_header)(struct sk_buff *skb, + __u32 saddr, + __u32 daddr, + struct device **dev, int type, + struct options *opt, int len, + int tos, int ttl, struct rtable ** rp); + int (*connect)(struct sock *sk, + struct sockaddr_in *usin, int addr_len); + struct sock * (*accept) (struct sock *sk, int flags); + void (*queue_xmit)(struct sock *sk, + struct device *dev, struct sk_buff *skb, + int free); + void (*retransmit)(struct sock *sk, int all); + void (*write_wakeup)(struct sock *sk); + void (*read_wakeup)(struct sock *sk); + int (*rcv)(struct sk_buff *buff, struct device *dev, + struct options *opt, __u32 daddr, + unsigned short len, __u32 saddr, + int redo, struct inet_protocol *protocol); + int (*select)(struct sock *sk, int which, + select_table *wait); + int (*ioctl)(struct sock *sk, int cmd, + unsigned long arg); + int (*init)(struct sock *sk); + void (*shutdown)(struct sock *sk, int how); + int (*setsockopt)(struct sock *sk, int level, int optname, + char *optval, int optlen); + int (*getsockopt)(struct sock *sk, int level, int optname, + char *optval, int *option); + int (*sendmsg)(struct sock *sk, struct msghdr *msg, int len, + int noblock, int flags); + int (*recvmsg)(struct sock *sk, struct msghdr *msg, int len, + int noblock, int flags, int *addr_len); + int (*bind)(struct sock *sk, struct sockaddr *uaddr, int addr_len); + unsigned short max_header; + unsigned long retransmits; + char name[32]; + int inuse, highestinuse; + struct sock * sock_array[SOCK_ARRAY_SIZE]; +}; + +#define TIME_WRITE 1 +#define TIME_CLOSE 2 +#define TIME_KEEPOPEN 3 +#define TIME_DESTROY 4 +#define TIME_DONE 5 /* Used to absorb those last few packets */ +#define TIME_PROBE0 6 +/* + * About 10 seconds + */ +#define SOCK_DESTROY_TIME (10*HZ) + + +/* + * Sockets 0-1023 can't be bound too unless you are superuser + */ + +#define PROT_SOCK 1024 + + +#define SHUTDOWN_MASK 3 +#define RCV_SHUTDOWN 1 +#define SEND_SHUTDOWN 2 + +/* + * Used by processes to "lock" a socket state, so that + * interrupts and bottom half handlers won't change it + * from under us. It essentially blocks any incoming + * packets, so that we won't get any new data or any + * packets that change the state of the socket. + * + * Note the 'barrier()' calls: gcc may not move a lock + * "downwards" or a unlock "upwards" when optimizing. + */ +extern void __release_sock(struct sock *sk); + +static inline void lock_sock(struct sock *sk) +{ +#if 1 +/* debugging code: the test isn't even 100% correct, but it can catch bugs */ +/* Note that a double lock is ok in theory - it's just _usually_ a bug */ + if (sk->users) { + __label__ here; + printk("double lock on socket at %p\n", &&here); +here: + } +#endif + sk->users++; + barrier(); +} + +static inline void release_sock(struct sock *sk) +{ + barrier(); +#if 1 +/* debugging code: remove me when ok */ + if (sk->users == 0) { + __label__ here; + sk->users = 1; + printk("trying to unlock unlocked socket at %p\n", &&here); +here: + } +#endif + if (!--sk->users) + __release_sock(sk); +} + + +extern void destroy_sock(struct sock *sk); +extern unsigned short get_new_socknum(struct proto *, + unsigned short); +extern void put_sock(unsigned short, struct sock *); +extern struct sock *get_sock(struct proto *, unsigned short, + unsigned long, unsigned short, + unsigned long); +extern struct sock *get_sock_mcast(struct sock *, unsigned short, + unsigned long, unsigned short, + unsigned long); +extern struct sock *get_sock_raw(struct sock *, unsigned short, + unsigned long, unsigned long); + +extern struct sk_buff *sock_wmalloc(struct sock *sk, + unsigned long size, int force, + int priority); +extern struct sk_buff *sock_rmalloc(struct sock *sk, + unsigned long size, int force, + int priority); +extern void sock_wfree(struct sock *sk, + struct sk_buff *skb); +extern void sock_rfree(struct sock *sk, + struct sk_buff *skb); +extern unsigned long sock_rspace(struct sock *sk); +extern unsigned long sock_wspace(struct sock *sk); + +extern int sock_setsockopt(struct sock *sk, int level, + int op, char *optval, + int optlen); + +extern int sock_getsockopt(struct sock *sk, int level, + int op, char *optval, + int *optlen); +extern struct sk_buff *sock_alloc_send_skb(struct sock *skb, + unsigned long size, + unsigned long fallback, + int noblock, + int *errcode); + +/* + * Queue a received datagram if it will fit. Stream and sequenced + * protocols can't normally use this as they need to fit buffers in + * and play with them. + * + * Inlined as its very short and called for pretty much every + * packet ever received. + */ + +extern __inline__ int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) +{ + unsigned long flags; + if(sk->rmem_alloc + skb->truesize >= sk->rcvbuf) + return -ENOMEM; + save_flags(flags); + cli(); + sk->rmem_alloc+=skb->truesize; + skb->sk=sk; + restore_flags(flags); + skb_queue_tail(&sk->receive_queue,skb); + if(!sk->dead) + sk->data_ready(sk,skb->len); + return 0; +} + +/* + * Recover an error report and clear atomically + */ + +extern __inline__ int sock_error(struct sock *sk) +{ + int err=xchg(&sk->err,0); + return -err; +} + +/* + * Declarations from timer.c + */ + +extern struct sock *timer_base; + +extern void delete_timer (struct sock *); +extern void reset_timer (struct sock *, int, unsigned long); +extern void net_timer (unsigned long); + + +/* + * Enable debug/info messages + */ + +#define NETDEBUG(x) x + +#endif /* _SOCK_H */ diff --git a/i386/i386at/gpl/linux/include/net/tcp.h b/i386/i386at/gpl/linux/include/net/tcp.h new file mode 100644 index 0000000..3c7eb7d --- /dev/null +++ b/i386/i386at/gpl/linux/include/net/tcp.h @@ -0,0 +1,329 @@ +/* + * INET An implementation of the TCP/IP protocol suite for the LINUX + * operating system. INET is implemented using the BSD Socket + * interface as the means of communication with the user level. + * + * Definitions for the TCP module. + * + * Version: @(#)tcp.h 1.0.5 05/23/93 + * + * Authors: Ross Biro, <bir7@leland.Stanford.Edu> + * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ +#ifndef _TCP_H +#define _TCP_H + +#include <linux/tcp.h> +#include <net/checksum.h> + +#define MAX_SYN_SIZE 44 + MAX_HEADER + 15 +#define MAX_FIN_SIZE 40 + MAX_HEADER + 15 +#define MAX_ACK_SIZE 40 + MAX_HEADER + 15 +#define MAX_RESET_SIZE 40 + MAX_HEADER + 15 +#define MAX_WINDOW 32767 /* Never offer a window over 32767 without using + window scaling (not yet supported). Some poor + stacks do signed 16bit maths! */ +#define MIN_WINDOW 2048 +#define MAX_ACK_BACKLOG 2 +#define MIN_WRITE_SPACE 2048 +#define TCP_WINDOW_DIFF 2048 + +/* urg_data states */ +#define URG_VALID 0x0100 +#define URG_NOTYET 0x0200 +#define URG_READ 0x0400 + +#define TCP_RETR1 7 /* + * This is how many retries it does before it + * tries to figure out if the gateway is + * down. + */ + +#define TCP_RETR2 15 /* + * This should take at least + * 90 minutes to time out. + */ + +#define TCP_TIMEOUT_LEN (15*60*HZ) /* should be about 15 mins */ +#define TCP_TIMEWAIT_LEN (60*HZ) /* how long to wait to successfully + * close the socket, about 60 seconds */ +#define TCP_FIN_TIMEOUT (3*60*HZ) /* BSD style FIN_WAIT2 deadlock breaker */ +#define TCP_ACK_TIME (3*HZ) /* time to delay before sending an ACK */ +#define TCP_DONE_TIME (5*HZ/2)/* maximum time to wait before actually + * destroying a socket */ +#define TCP_WRITE_TIME (30*HZ) /* initial time to wait for an ACK, + * after last transmit */ +#define TCP_TIMEOUT_INIT (3*HZ) /* RFC 1122 initial timeout value */ +#define TCP_SYN_RETRIES 10 /* number of times to retry opening a + * connection (TCP_RETR2-....) */ +#define TCP_PROBEWAIT_LEN (1*HZ)/* time to wait between probes when + * I've got something to write and + * there is no window */ + +#define TCP_NO_CHECK 0 /* turn to one if you want the default + * to be no checksum */ + + +/* + * TCP option + */ + +#define TCPOPT_NOP 1 /* Padding */ +#define TCPOPT_EOL 0 /* End of options */ +#define TCPOPT_MSS 2 /* Segment size negotiating */ +/* + * We don't use these yet, but they are for PAWS and big windows + */ +#define TCPOPT_WINDOW 3 /* Window scaling */ +#define TCPOPT_TIMESTAMP 8 /* Better RTT estimations/PAWS */ + + +/* + * The next routines deal with comparing 32 bit unsigned ints + * and worry about wraparound (automatic with unsigned arithmetic). + */ + +extern __inline int before(__u32 seq1, __u32 seq2) +{ + return (__s32)(seq1-seq2) < 0; +} + +extern __inline int after(__u32 seq1, __u32 seq2) +{ + return (__s32)(seq2-seq1) < 0; +} + + +/* is s2<=s1<=s3 ? */ +extern __inline int between(__u32 seq1, __u32 seq2, __u32 seq3) +{ + return (after(seq1+1, seq2) && before(seq1, seq3+1)); +} + +static __inline__ int min(unsigned int a, unsigned int b) +{ + if (a < b) + return(a); + return(b); +} + +extern struct proto tcp_prot; +extern struct tcp_mib tcp_statistics; +extern struct wait_queue *master_select_wakeup; + +extern void tcp_err(int type, int code, unsigned char *header, __u32 daddr, + __u32, struct inet_protocol *protocol); +extern void tcp_shutdown (struct sock *sk, int how); +extern int tcp_rcv(struct sk_buff *skb, struct device *dev, + struct options *opt, __u32 daddr, + unsigned short len, __u32 saddr, int redo, + struct inet_protocol *protocol); + +extern int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg); + +extern void tcp_read_wakeup(struct sock *); +extern void tcp_write_xmit(struct sock *); +extern void tcp_time_wait(struct sock *); +extern void tcp_retransmit(struct sock *, int); +extern void tcp_do_retransmit(struct sock *, int); +extern void tcp_send_check(struct tcphdr *th, unsigned long saddr, + unsigned long daddr, int len, struct sk_buff *skb); + +/* tcp_output.c */ + +extern void tcp_send_probe0(struct sock *); +extern void tcp_send_partial(struct sock *); +extern void tcp_write_wakeup(struct sock *); +extern void tcp_send_fin(struct sock *sk); +extern void tcp_send_synack(struct sock *, struct sock *, struct sk_buff *); +extern void tcp_send_skb(struct sock *, struct sk_buff *); +extern void tcp_send_ack(u32, u32, struct sock *sk, struct tcphdr *th, u32); +extern void tcp_send_reset(unsigned long saddr, unsigned long daddr, struct tcphdr *th, + struct proto *prot, struct options *opt, struct device *dev, int tos, int ttl); + +extern void tcp_enqueue_partial(struct sk_buff *, struct sock *); +extern struct sk_buff * tcp_dequeue_partial(struct sock *); + +/* tcp_input.c */ +extern void tcp_cache_zap(void); + +/* tcp_timer.c */ +#define tcp_reset_msl_timer(x,y,z) reset_timer(x,y,z) +extern void tcp_reset_xmit_timer(struct sock *, int, unsigned long); +extern void tcp_retransmit_timer(unsigned long); + +/* + * Default sequence number picking algorithm. + * As close as possible to RFC 793, which + * suggests using a 250kHz clock. + * Further reading shows this assumes 2MB/s networks. + * For 10MB/s ethernet, a 1MHz clock is appropriate. + * That's funny, Linux has one built in! Use it! + */ + +static inline u32 tcp_init_seq(void) +{ + struct timeval tv; + do_gettimeofday(&tv); + return tv.tv_usec+tv.tv_sec*1000000; +} + +/* + * This function returns the amount that we can raise the + * usable window based on the following constraints + * + * 1. The window can never be shrunk once it is offered (RFC 793) + * 2. We limit memory per socket + */ + +static __inline__ unsigned short tcp_raise_window(struct sock *sk) +{ + long free_space = sock_rspace(sk); + long window; + + if (free_space > 1024) + free_space &= ~0x3FF; /* make free space a multiple of 1024 */ + + if(sk->window_clamp) + free_space = min(sk->window_clamp, free_space); + + /* + * compute the actual window i.e. + * old_window - received_bytes_on_that_win + */ + + window = sk->window - (sk->acked_seq - sk->lastwin_seq); + + if (sk->mss == 0) + sk->mss = sk->mtu; + + if ( window < 0 ) { + window = 0; + printk(KERN_DEBUG "TRW: win < 0 w=%d 1=%u 2=%u\n", + sk->window, sk->acked_seq, sk->lastwin_seq); + } + + if ( (free_space - window) >= min(sk->mss, MAX_WINDOW/2) ) + return ((free_space - window) / sk->mss) * sk->mss; + + return 0; +} + +static __inline__ unsigned short tcp_select_window(struct sock *sk) +{ + long free_space = sock_rspace(sk); + long window; + + if (free_space > 1024) + free_space &= ~0x3FF; /* make free space a multiple of 1024 */ + + if (sk->window_clamp) + free_space = min(sk->window_clamp, free_space); + + /* + * compute the actual window i.e. + * old_window - received_bytes_on_that_win + */ + + if (sk->mss == 0) + sk->mss = sk->mtu; + + window = sk->window - (sk->acked_seq - sk->lastwin_seq); + + if ( window < 0 ) { + window = 0; + printk(KERN_DEBUG "TSW: win < 0 w=%d 1=%u 2=%u\n", + sk->window, sk->acked_seq, sk->lastwin_seq); + } + + /* + * RFC 1122: + * "the suggested [SWS] avoidance algoritm for the receiver is to keep + * RECV.NEXT + RCV.WIN fixed until: + * RCV.BUFF - RCV.USER - RCV.WINDOW >= min(1/2 RCV.BUFF, MSS)" + * + * i.e. don't raise the right edge of the window until you can't raise + * it MSS bytes + */ + + if ( (free_space - window) >= min(sk->mss, MAX_WINDOW/2) ) + window += ((free_space - window) / sk->mss) * sk->mss; + + sk->window = window; + sk->lastwin_seq = sk->acked_seq; + + return sk->window; +} + +/* + * List all states of a TCP socket that can be viewed as a "connected" + * state. This now includes TCP_SYN_RECV, although I am not yet fully + * convinced that this is the solution for the 'getpeername(2)' + * problem. Thanks to Stephen A. Wood <saw@cebaf.gov> -FvK + */ + +extern __inline const int tcp_connected(const int state) +{ + return(state == TCP_ESTABLISHED || state == TCP_CLOSE_WAIT || + state == TCP_FIN_WAIT1 || state == TCP_FIN_WAIT2 || + state == TCP_SYN_RECV); +} + +/* + * Calculate(/check) TCP checksum + */ +static __inline__ u16 tcp_check(struct tcphdr *th, int len, + unsigned long saddr, unsigned long daddr, unsigned long base) +{ + return csum_tcpudp_magic(saddr,daddr,len,IPPROTO_TCP,base); +} + +#undef STATE_TRACE + +#ifdef STATE_TRACE +static char *statename[]={ + "Unused","Established","Syn Sent","Syn Recv", + "Fin Wait 1","Fin Wait 2","Time Wait", "Close", + "Close Wait","Last ACK","Listen","Closing" +}; +#endif + +static __inline__ void tcp_set_state(struct sock *sk, int state) +{ + int oldstate = sk->state; + + sk->state = state; + +#ifdef STATE_TRACE + if(sk->debug) + printk("TCP sk=%p, State %s -> %s\n",sk, statename[oldstate],statename[state]); +#endif + + switch (state) { + case TCP_ESTABLISHED: + if (oldstate != TCP_ESTABLISHED) { + tcp_statistics.TcpCurrEstab++; + /* This is a hack but it doesn't occur often and it's going to + be a real to fix nicely */ + if (oldstate == TCP_SYN_RECV) + wake_up_interruptible(&master_select_wakeup); + } + break; + + case TCP_CLOSE: + tcp_cache_zap(); + /* Should be about 2 rtt's */ + reset_timer(sk, TIME_DONE, min(sk->rtt * 2, TCP_DONE_TIME)); + /* fall through */ + default: + if (oldstate==TCP_ESTABLISHED) + tcp_statistics.TcpCurrEstab--; + } +} + +#endif /* _TCP_H */ diff --git a/i386/i386at/gpl/linux/include/net/udp.h b/i386/i386at/gpl/linux/include/net/udp.h new file mode 100644 index 0000000..13735d1 --- /dev/null +++ b/i386/i386at/gpl/linux/include/net/udp.h @@ -0,0 +1,52 @@ +/* + * INET An implementation of the TCP/IP protocol suite for the LINUX + * operating system. INET is implemented using the BSD Socket + * interface as the means of communication with the user level. + * + * Definitions for the UDP module. + * + * Version: @(#)udp.h 1.0.2 05/07/93 + * + * Authors: Ross Biro, <bir7@leland.Stanford.Edu> + * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> + * + * Fixes: + * Alan Cox : Turned on udp checksums. I don't want to + * chase 'memory corruption' bugs that aren't! + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ +#ifndef _UDP_H +#define _UDP_H + +#include <linux/udp.h> + + +#define UDP_NO_CHECK 0 + + +extern struct proto udp_prot; + + +extern void udp_err(int type, int code, unsigned char *header, __u32 daddr, + __u32 saddr, struct inet_protocol *protocol); +extern void udp_send_check(struct udphdr *uh, __u32 saddr, + __u32 daddr, int len, struct sock *sk); +extern int udp_recvfrom(struct sock *sk, unsigned char *to, + int len, int noblock, unsigned flags, + struct sockaddr_in *sin, int *addr_len); +extern int udp_read(struct sock *sk, unsigned char *buff, + int len, int noblock, unsigned flags); +extern int udp_connect(struct sock *sk, + struct sockaddr_in *usin, int addr_len); +extern int udp_rcv(struct sk_buff *skb, struct device *dev, + struct options *opt, __u32 daddr, + unsigned short len, __u32 saddr, int redo, + struct inet_protocol *protocol); +extern int udp_ioctl(struct sock *sk, int cmd, unsigned long arg); +extern void udp_cache_zap(void); /* Remove udp last socket cache */ + +#endif /* _UDP_H */ |