1 /*	$OpenBSD: linux_socketcall.h,v 1.4 2002/11/27 07:30:36 ish Exp $	*/
2 /*	$NetBSD: linux_socketcall.h,v 1.1 1995/02/28 23:26:05 fvdl Exp $	*/
3 
4 /*
5  * Copyright (c) 1995 Frank van der Linden
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  * 3. All advertising materials mentioning features or use of this software
17  *    must display the following acknowledgement:
18  *      This product includes software developed for the NetBSD Project
19  *      by Frank van der Linden
20  * 4. The name of the author may not be used to endorse or promote products
21  *    derived from this software without specific prior written permission
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
28  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
32  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  */
34 
35 #ifndef _LINUX_SOCKETCALL_H
36 #define _LINUX_SOCKETCALL_H
37 
38 /*
39  * Values passed to the Linux socketcall() syscall, determining the actual
40  * action to take.
41  */
42 #define LINUX_SYS_socket	1
43 #define LINUX_SYS_bind		2
44 #define LINUX_SYS_connect	3
45 #define LINUX_SYS_listen	4
46 #define LINUX_SYS_accept	5
47 #define LINUX_SYS_getsockname	6
48 #define LINUX_SYS_getpeername	7
49 #define LINUX_SYS_socketpair	8
50 #define LINUX_SYS_send		9
51 #define LINUX_SYS_recv		10
52 #define LINUX_SYS_sendto	11
53 #define LINUX_SYS_recvfrom	12
54 #define LINUX_SYS_shutdown	13
55 #define LINUX_SYS_setsockopt	14
56 #define LINUX_SYS_getsockopt	15
57 #define LINUX_SYS_sendmsg	16
58 #define LINUX_SYS_recvmsg	17
59 
60 /*
61  * Structures for the arguments of the different system calls. This looks
62  * a little better than copyin() of all values one by one.
63  */
64 struct linux_socket_args {
65 	int domain;
66 	int type;
67 	int protocol;
68 };
69 
70 struct linux_bind_args {
71 	int s;
72 	struct osockaddr *name;
73 	int namelen;
74 };
75 
76 struct linux_connect_args {
77 	int s;
78 	struct osockaddr *name;
79 	int namelen;
80 };
81 
82 struct linux_listen_args {
83 	int s;
84 	int backlog;
85 };
86 
87 struct linux_accept_args {
88 	int s;
89 	struct sockaddr *addr;
90 	int *namelen;
91 };
92 
93 struct linux_getsockname_args {
94 	int s;
95 	struct osockaddr *addr;
96 	int *namelen;
97 };
98 
99 struct linux_getpeername_args {
100 	int s;
101 	struct sockaddr *addr;
102 	int *namelen;
103 };
104 
105 struct linux_socketpair_args {
106 	int domain;
107 	int type;
108 	int protocol;
109 	int *rsv;
110 };
111 
112 struct linux_send_args {
113 	int s;
114 	void *msg;
115 	int len;
116 	int flags;
117 };
118 
119 struct linux_recv_args {
120 	int s;
121 	void *msg;
122 	int len;
123 	int flags;
124 };
125 
126 struct linux_sendto_args {
127 	int s;
128 	void *msg;
129 	int len;
130 	int flags;
131 	struct osockaddr *to;
132 	int tolen;
133 };
134 
135 struct linux_recvfrom_args {
136 	int s;
137 	void *buf;
138 	int len;
139 	int flags;
140 	struct osockaddr *from;
141 	int *fromlen;
142 };
143 
144 struct linux_shutdown_args {
145 	int s;
146 	int how;
147 };
148 
149 struct linux_getsockopt_args {
150 	int s;
151 	int level;
152 	int optname;
153 	void *optval;
154 	int *optlen;
155 };
156 
157 struct linux_setsockopt_args {
158 	int s;
159 	int level;
160 	int optname;
161 	void *optval;
162 	int optlen;
163 };
164 
165 struct linux_sendmsg_args {
166 	int s;
167 	struct msghdr *msg;
168 	int flags;
169 };
170 
171 struct linux_recvmsg_args {
172 	int s;
173 	struct msghdr *msg;
174 	int flags;
175 };
176 
177 #endif /* _LINUX_SOCKETCALL_H */
178