1 /* $OpenBSD: linux_socketcall.h,v 1.1 2006/07/02 12:34:15 sturm 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 char *linux_socketcall_names[] = { 43 NULL, 44 #define LINUX_SYS_socket 1 45 "socket", 46 #define LINUX_SYS_bind 2 47 "bind", 48 #define LINUX_SYS_connect 3 49 "connect", 50 #define LINUX_SYS_listen 4 51 "listen", 52 #define LINUX_SYS_accept 5 53 "accept", 54 #define LINUX_SYS_getsockname 6 55 "getsockname", 56 #define LINUX_SYS_getpeername 7 57 "getpeername", 58 #define LINUX_SYS_socketpair 8 59 "socketpair", 60 #define LINUX_SYS_send 9 61 "send", 62 #define LINUX_SYS_recv 10 63 "recv", 64 #define LINUX_SYS_sendto 11 65 "sendto", 66 #define LINUX_SYS_recvfrom 12 67 "recvfrom", 68 #define LINUX_SYS_shutdown 13 69 "shutdown", 70 #define LINUX_SYS_setsockopt 14 71 "setsockopt", 72 #define LINUX_SYS_getsockopt 15 73 "getsockopt", 74 #define LINUX_SYS_sendmsg 16 75 "sendmsg", 76 #define LINUX_SYS_recvmsg 17 77 "recvmsg" }; 78 79 /* 80 * Structures for the arguments of the different system calls. This looks 81 * a little better than copyin() of all values one by one. 82 */ 83 struct linux_socket_args { 84 int domain; 85 int type; 86 int protocol; 87 }; 88 89 struct linux_bind_args { 90 int s; 91 struct sockaddr *name; 92 int namelen; 93 }; 94 95 struct linux_connect_args { 96 int s; 97 struct sockaddr *name; 98 int namelen; 99 }; 100 101 struct linux_listen_args { 102 int s; 103 int backlog; 104 }; 105 106 struct linux_accept_args { 107 int s; 108 struct sockaddr *addr; 109 int *namelen; 110 }; 111 112 struct linux_getsockname_args { 113 int s; 114 struct sockaddr *addr; 115 int *namelen; 116 }; 117 118 struct linux_getpeername_args { 119 int s; 120 struct sockaddr *addr; 121 int *namelen; 122 }; 123 124 struct linux_socketpair_args { 125 int domain; 126 int type; 127 int protocol; 128 int *rsv; 129 }; 130 131 struct linux_send_args { 132 int s; 133 void *msg; 134 int len; 135 int flags; 136 }; 137 138 struct linux_recv_args { 139 int s; 140 void *msg; 141 int len; 142 int flags; 143 }; 144 145 struct linux_sendto_args { 146 int s; 147 void *msg; 148 int len; 149 int flags; 150 struct sockaddr *to; 151 int tolen; 152 }; 153 154 struct linux_recvfrom_args { 155 int s; 156 void *buf; 157 int len; 158 int flags; 159 struct sockaddr *from; 160 int *fromlen; 161 }; 162 163 struct linux_shutdown_args { 164 int s; 165 int how; 166 }; 167 168 struct linux_getsockopt_args { 169 int s; 170 int level; 171 int optname; 172 void *optval; 173 int *optlen; 174 }; 175 176 struct linux_setsockopt_args { 177 int s; 178 int level; 179 int optname; 180 void *optval; 181 int optlen; 182 }; 183 184 struct linux_sendmsg_args { 185 int s; 186 struct msghdr *msg; 187 int flags; 188 }; 189 190 struct linux_recvmsg_args { 191 int s; 192 struct msghdr *msg; 193 int flags; 194 }; 195 196 #endif /* _LINUX_SOCKETCALL_H */ 197