OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [uclinux/] [uClinux-2.0.x/] [include/] [linux/] [in.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 199 simons
/*
2
 * INET         An implementation of the TCP/IP protocol suite for the LINUX
3
 *              operating system.  INET is implemented using the  BSD Socket
4
 *              interface as the means of communication with the user level.
5
 *
6
 *              Definitions of the Internet Protocol.
7
 *
8
 * Version:     @(#)in.h        1.0.1   04/21/93
9
 *
10
 * Authors:     Original taken from the GNU Project <netinet/in.h> file.
11
 *              Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
12
 *
13
 *              This program is free software; you can redistribute it and/or
14
 *              modify it under the terms of the GNU General Public License
15
 *              as published by the Free Software Foundation; either version
16
 *              2 of the License, or (at your option) any later version.
17
 */
18
#ifndef _LINUX_IN_H
19
#define _LINUX_IN_H
20
 
21
#include <linux/types.h>
22
 
23
/* Standard well-defined IP protocols.  */
24
enum {
25
  IPPROTO_IP = 0,                /* Dummy protocol for TCP               */
26
  IPPROTO_ICMP = 1,             /* Internet Control Message Protocol    */
27
  IPPROTO_IGMP = 2,             /* Internet Group Management Protocol   */
28
  IPPROTO_IPIP = 4,             /* IPIP tunnels (older KA9Q tunnels use 94) */
29
  IPPROTO_TCP = 6,              /* Transmission Control Protocol        */
30
  IPPROTO_EGP = 8,              /* Exterior Gateway Protocol            */
31
  IPPROTO_PUP = 12,             /* PUP protocol                         */
32
  IPPROTO_UDP = 17,             /* User Datagram Protocol               */
33
  IPPROTO_IDP = 22,             /* XNS IDP protocol                     */
34
  IPPROTO_GRE = 47,             /* GRE Encapsulation used by PPTP et al */
35
  IPPROTO_ESP = 50,             /* ESP protocol for IPSec               */
36
  IPPROTO_AH = 51,              /* AH protocol for IPSec                */
37
 
38
  IPPROTO_RAW = 255,            /* Raw IP packets                       */
39
  IPPROTO_MAX
40
};
41
 
42
 
43
/* Internet address. */
44
struct in_addr {
45
        __u32   s_addr;
46
};
47
 
48
/* Request struct for multicast socket ops */
49
 
50
struct ip_mreq
51
{
52
        struct in_addr imr_multiaddr;   /* IP multicast address of group */
53
        struct in_addr imr_interface;   /* local IP address of interface */
54
};
55
 
56
 
57
/* Structure describing an Internet (IP) socket address. */
58
#define __SOCK_SIZE__   16              /* sizeof(struct sockaddr)      */
59
struct sockaddr_in {
60
  short int             sin_family;     /* Address family               */
61
  unsigned short int    sin_port;       /* Port number                  */
62
  struct in_addr        sin_addr;       /* Internet address             */
63
 
64
  /* Pad to size of `struct sockaddr'. */
65
  unsigned char         __pad[__SOCK_SIZE__ - sizeof(short int) -
66
                        sizeof(unsigned short int) - sizeof(struct in_addr)];
67
};
68
#define sin_zero        __pad           /* for BSD UNIX comp. -FvK      */
69
 
70
 
71
/*
72
 * Definitions of the bits in an Internet address integer.
73
 * On subnets, host and network parts are found according
74
 * to the subnet mask, not these masks.
75
 */
76
#define IN_CLASSA(a)            ((((long int) (a)) & 0x80000000) == 0)
77
#define IN_CLASSA_NET           0xff000000
78
#define IN_CLASSA_NSHIFT        24
79
#define IN_CLASSA_HOST          (0xffffffff & ~IN_CLASSA_NET)
80
#define IN_CLASSA_MAX           128
81
 
82
#define IN_CLASSB(a)            ((((long int) (a)) & 0xc0000000) == 0x80000000)
83
#define IN_CLASSB_NET           0xffff0000
84
#define IN_CLASSB_NSHIFT        16
85
#define IN_CLASSB_HOST          (0xffffffff & ~IN_CLASSB_NET)
86
#define IN_CLASSB_MAX           65536
87
 
88
#define IN_CLASSC(a)            ((((long int) (a)) & 0xe0000000) == 0xc0000000)
89
#define IN_CLASSC_NET           0xffffff00
90
#define IN_CLASSC_NSHIFT        8
91
#define IN_CLASSC_HOST          (0xffffffff & ~IN_CLASSC_NET)
92
 
93
#define IN_CLASSD(a)            ((((long int) (a)) & 0xf0000000) == 0xe0000000)
94
#define IN_MULTICAST(a)         IN_CLASSD(a)
95
#define IN_MULTICAST_NET        0xF0000000
96
 
97
#define IN_EXPERIMENTAL(a)      ((((long int) (a)) & 0xe0000000) == 0xe0000000)
98
#define IN_BADCLASS(a)          ((((long int) (a)) & 0xf0000000) == 0xf0000000)
99
 
100
/* Address to accept any incoming messages. */
101
#define INADDR_ANY              ((unsigned long int) 0x00000000)
102
 
103
/* Address to send to all hosts. */
104
#define INADDR_BROADCAST        ((unsigned long int) 0xffffffff)
105
 
106
/* Address indicating an error return. */
107
#define INADDR_NONE             ((unsigned long int) 0xffffffff)
108
 
109
/* Network number for local host loopback. */
110
#define IN_LOOPBACKNET          127
111
 
112
/* Address to loopback in software to local host.  */
113
#define INADDR_LOOPBACK         0x7f000001      /* 127.0.0.1   */
114
#define IN_LOOPBACK(a)          ((((long int) (a)) & 0xff000000) == 0x7f000000)
115
 
116
/* Defines for Multicast INADDR */
117
#define INADDR_UNSPEC_GROUP     0xe0000000      /* 224.0.0.0   */
118
#define INADDR_ALLHOSTS_GROUP   0xe0000001      /* 224.0.0.1   */
119
#define INADDR_MAX_LOCAL_GROUP  0xe00000ff      /* 224.0.0.255 */
120
 
121
/* <asm/byteorder.h> contains the htonl type stuff.. */
122
 
123
#include <asm/byteorder.h> 
124
 
125
/* Some random defines to make it easier in the kernel.. */
126
#ifdef __KERNEL__
127
 
128
#define LOOPBACK(x)     (((x) & htonl(0xff000000)) == htonl(0x7f000000))
129
#define MULTICAST(x)    (((x) & htonl(0xf0000000)) == htonl(0xe0000000))
130
 
131
#endif
132
 
133
/*
134
 *      IPv6 definitions as we start to include them. This is just
135
 *      a beginning -- don't get excited 8)
136
 */
137
 
138
struct in_addr6
139
{
140
        unsigned char s6_addr[16];
141
};
142
 
143
struct sockaddr_in6
144
{
145
        unsigned short sin6_family;
146
        unsigned short sin6_port;
147
        unsigned long sin6_flowinfo;
148
        struct in_addr6 sin6_addr;
149
};
150
 
151
 
152
#endif  /* _LINUX_IN_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.