summaryrefslogtreecommitdiff
path: root/pfinet/glue-include/linux/socket.h
blob: 8d5774deff1ceb2e8b620f471f75d7a4b6b21ed4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#ifndef _HACK_SOCKET_H_
#define _HACK_SOCKET_H_

#include <linux/types.h>
#include <asm/system.h>

#include <sys/socket.h>
#include <sys/uio.h>
#include <sys/ioctl.h>
#include <limits.h>


/* #define IP_MAX_MEMBERSHIPS 10 */

#define IPTOS_LOWDELAY 0x10
#define IPTOS_THROUGHPUT 0x08
#define IPTOS_RELIABILITY 0x04

#define SOPRI_INTERACTIVE 0
#define SOPRI_NORMAL 1
#define SOPRI_BACKGROUND 2

#define SOL_IP IPPROTO_IP
#define SOL_TCP IPPROTO_TCP
#define SOL_RAW IPPROTO_RAW

/* IP options */
#define IP_PKTINFO	190
#define IP_PKTOPTIONS	191
#define IP_MTU_DISCOVER	192
#define IP_RECVERR	193
#define IP_RECVTTL	194
#define	IP_RECVTOS	195
#define IP_MTU		196
#define IP_ROUTER_ALERT	197


/* TCP options */
#define TCP_NODELAY 1
#define TCP_MAXSEG 2
#define TCP_CORK 3

#define SO_NO_CHECK 11
#define SO_PRIORITY 12

#define	SO_PASSCRED 190
#define	SO_PEERCRED 191
#define	SO_BSDCOMPAT 192

/* Maximum queue length specifiable by listen.  */
#define SOMAXCONN	128

/* XXX */
#define msg_control	msg_accrights
#define msg_controllen	msg_accrightslen
struct cmsghdr { int cmsg_garbage; };
#define cmsg_len	cmsg_garbage
#define cmsg_type	cmsg_garbage
#define cmsg_level	cmsg_garbage
static inline int
put_cmsg(struct msghdr *msg, int level, int type, int len, void *data)
{ return 0; }
#define CMSG_FIRSTHDR(msg)	(0)
#define CMSG_NXTHDR(msg, cmsg)	(0)
#define CMSG_DATA(cmsg)		(0)
#define CMSG_ALIGN(size)	(0)
#define CMSG_LEN(size) 		(0)


#define MSG_NOSIGNAL	0
#define MSG_ERRQUEUE	0

/* There is no SOCK_PACKET, it is a bad bad thing.  This chicanery is
   because the one use of it is a comparison against a `short int' value;
   using a value outside the range of that type ensures that the comparison
   will always fail, and in fact it and the dead code will get optimized
   out entirely at compile time.  */
#define SOCK_PACKET	((int)((uint32_t)USHRT_MAX) * 2)
#define PF_PACKET	0

#ifndef UIO_MAXIOV
#define UIO_MAXIOV 4		/* 1 would do */
#endif


struct ucred {
  pid_t pid;
  uid_t uid;
  gid_t gid;
};


extern inline int		/* Does not modify IOV.  */
memcpy_fromiovecend (unsigned char *kdata, struct iovec *iov,
		     int offset, int len)
{
  assert (offset + len <= iov->iov_len);
  memcpy (kdata, iov->iov_base + offset, len);
  return 0;
}
extern inline int		/* Modifies IOV to consume LEN bytes.  */
memcpy_fromiovec (unsigned char *kdata, struct iovec *iov, int len)
{
  assert (len <= iov->iov_len);
  memcpy (kdata, iov->iov_base, len);
  iov->iov_base += len;
  iov->iov_len -= len;
  return 0;
}
extern inline void		/* Modifies IOV to consume LEN bytes.  */
memcpy_tokerneliovec (struct iovec *iov, unsigned char *kdata, int len)
{
  assert (len <= iov->iov_len);
  memcpy (iov->iov_base, kdata, len);
  iov->iov_base += len;
  iov->iov_len -= len;
}
extern inline int		/* Modifies IOV to consume LEN bytes.  */
memcpy_toiovec (struct iovec *iov, unsigned char *kdata, int len)
{
  memcpy_tokerneliovec (iov, kdata, len);
  return 0;
}

extern int csum_partial_copy_fromiovecend(unsigned char *kdata,
					  struct iovec *iov,
					  int offset,
					  unsigned int len, int *csump);

static inline int move_addr_to_kernel(void *uaddr, int ulen, void *kaddr)
{
  abort ();
  return 0;
}
#if 0
extern int verify_iovec(struct msghdr *m, struct iovec *iov, char *address, int mode);
extern int move_addr_to_user(void *kaddr, int klen, void *uaddr, int *ulen);
#endif


#endif