xref: /titanic_51/usr/src/lib/libsocket/common/llib-lsocket (revision 799823bbed51a695d01e13511bbb1369980bb714)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21/*
22 * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
23 * Use is subject to license terms.
24 */
25/* Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved. */
26
27/* LINTLIBRARY */
28/* PROTOLIB1 */
29
30#include <sys/types.h>
31#include <sys/socket.h>
32#include <net/if.h>
33#include <netinet/in.h>
34#include <sys/uio.h>
35#include <sys/isa_defs.h>
36#include <arpa/inet.h>
37#include <sys/ethernet.h>
38#include <netdb.h>
39#include <net/if_dl.h>
40#include <ifaddrs.h>
41#include <libsocket_priv.h>
42
43/*
44 * usr/src/lib/libsocket/inet routines not prototyped in the above
45 * header files.
46 */
47
48/* bindresvport.c */
49int bindresvport(int sd, struct sockaddr_in *sin);
50
51/* bootparams_getbyname.c */
52int bootparams_getbyname(char *name, char *linebuf, int linelen);
53
54/* inet6_rthdr.c */
55int __inet6_rthdr_add(void *, const struct in6_addr *);
56struct in6_addr *__inet6_rthdr_getaddr(void *, int);
57
58/* netmasks.c */
59int getnetmaskbynet(const struct in_addr net, struct in_addr *mask);
60
61/* ruserpass.c */
62void _ruserpass(const char *host, char **aname, char **apass);
63
64/*
65 * usr/src/lib/libsocket/socket routines
66 */
67
68/* _soutil.c */
69
70/* socket.c */
71int socket(int domain, int type, int protocol);
72int _socket(int domain, int type, int protocol);
73int _socket_bsd(int family, int type, int protocol);
74int __xnet_socket(int family, int type, int protocol);
75
76/* socketpair.c */
77int socketpair(int domain, int type, int protocol, int sv[]);
78int _socketpair(int domain, int type, int protocol, int *sv);
79int _socketpair_bsd(int domain, int type, int protocol, int *sv);
80int __xnet_socketpair(int domain, int type, int protocol, int *sv);
81
82/* weaks.c */
83int bind(int s, const struct sockaddr *name, socklen_t namelen);
84int listen(int s, int backlog);
85int accept(int s, struct sockaddr *addr, Psocklen_t addrlen);
86int accept4(int s, struct sockaddr *addr, Psocklen_t addrlen, int flags);
87int connect(int s, const struct sockaddr *name, socklen_t namelen);
88int shutdown(int s, int how);
89ssize_t recv(int s, void *buf, size_t len, int flags);
90ssize_t recvfrom(int s, void *buf, size_t len, int flags,
91				struct sockaddr *from, Psocklen_t fromlen);
92ssize_t recvmsg(int s, struct msghdr *msg, int flags);
93ssize_t send(int s, const void *msg, size_t len, int flags);
94ssize_t sendmsg(int s, const struct msghdr *msg, int flags);
95ssize_t sendto(int s, const void *msg, size_t len, int flags,
96				const struct sockaddr *to, socklen_t tolen);
97int getpeername(int s, struct sockaddr *name, Psocklen_t namelen);
98int getsockname(int s, struct sockaddr *name, Psocklen_t namelen);
99int getsockopt(int s, int level, int optname, void *optval, Psocklen_t optlen);
100int setsockopt(int s, int level, int optname, const void *optval, socklen_t optlen);
101
102int _bind(int s, const struct sockaddr *name, int namelen);
103int _listen(int s, int backlog);
104int _accept(int s, struct sockaddr *addr, int *addrlen);
105int _accept4(int s, struct sockaddr *addr, int *addrlen, int flags);
106int _connect(int s, struct sockaddr *name, int namelen);
107int _shutdown(int s, int how);
108int _recv(int s, char *buf, int len, int flags);
109int _recvfrom(int s, char *buf, int len, int flags,
110					struct sockaddr *from, int *fromlen);
111int _recvmsg(int s, struct msghdr *msg, int flags);
112int _send(int s, const char *msg, int len, int flags);
113int _sendmsg(int s, const struct msghdr *msg, int flags);
114int _sendto(int s, const char *msg, int len, int flags,
115					const struct sockaddr *to, int tolen);
116int _getpeername(int s, struct sockaddr *name, int *namelen);
117int _getsockname(int s, struct sockaddr *name, int *namelen);
118int _getsockopt(int s, int level, int optname, char *optval, int *optlen);
119int _setsockopt(int s, int level, int optname, const char *optval, int optlen);
120int __xnet_bind(int sock, const struct sockaddr *addr, socklen_t addrlen);
121int __xnet_listen(int sock, int backlog);
122int __xnet_connect(int sock, const struct sockaddr *addr, socklen_t addrlen);
123int __xnet_recvmsg(int sock, struct msghdr *msg, int flags);
124int __xnet_sendmsg(int sock, const struct msghdr *msg, int flags);
125int __xnet_sendto(int sock, const void *buf, size_t len, int flags,
126    const struct sockaddr *addr, socklen_t addrlen);
127int __xnet_getsockopt(int sock, int level, int option_name,
128    void *option_value, socklen_t *option_lenp);
129