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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [uclinux/] [uC-libc/] [include/] [sys/] [socket.h] - Blame information for rev 199

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 199 simons
#ifndef _SYS_SOCKET_H
2
#define _SYS_SOCKET_H
3
 
4
#include <features.h>
5
#include <sys/types.h>
6
#include <linux/socket.h>
7
 
8
#ifdef _MIT_POSIX_THREADS
9
#include <pthread/mit/posix.h>
10
#endif
11
 
12
__BEGIN_DECLS
13
 
14
/* struct msghdr is not defined in linux 1.2.  This will allow sendmsg
15
   and recvmsg in libc 5.2.9 to compile under 1.2.x and shouldn't cause
16
   any problem for 1.3.x */
17
struct msghdr;
18
 
19
/* Create a new socket of type TYPE in domain DOMAIN, using
20
   protocol PROTOCOL.  If PROTOCOL is zero, one is chosen
21
   automatically.  Returns a file descriptor for the new socket,
22
   or -1 for errors.  */
23
int socket __P ((int __family, int __type, int __protocol));
24
 
25
/* Create two new sockets, of type TYPE in domain DOMAIN and using
26
   protocol PROTOCOL, which are connected to each other, and put file
27
   descriptors for them in FDS[0] and FDS[1].  If PROTOCOL is zero,
28
   one will be chosen automatically.  Returns 0 on success, -1
29
   for errors.  */
30
int socketpair __P ((int __family, int __type, int __protocol,
31
                int __sockvec[2]));
32
 
33
/* Give the socket FD the local address ADDR (which is LEN bytes
34
   long).  */
35
int bind __P ((int __sockfd, __const struct sockaddr *__my_addr,
36
                int __addrlen));
37
 
38
/* Open a connection on socket FD to peer at ADDR (which LEN bytes
39
   long). For connectionless socket types, just set the default
40
   address to send to and the only address from which to accept
41
   transmissions.  Return 0 on success, -1 for errors.  */
42
int connect __P ((int __sockfd, __const struct sockaddr *__serv_addr,
43
                int __addrlen));
44
 
45
/* Prepare to accept connections on socket FD.
46
   N connection requests will be queued before further requests are
47
   refused. Returns 0 on success, -1 for errors.  */
48
int listen __P ((int __sockfd, int __n));
49
 
50
/* Await a connection on socket FD.
51
   When a connection arrives, open a new socket to communicate with it,
52
   set *ADDR (which is *ADDR_LEN bytes long) to the address of the
53
   connecting peer and *ADDR_LEN to the address's actual length, and
54
   return the new socket's descriptor, or -1 for errors.  */
55
int accept __P ((int __sockfd, __const struct sockaddr *__peer,
56
                int *__paddrlen));
57
 
58
/* Put the current value for socket FD's option OPTNAME at protocol
59
   level LEVEL into OPTVAL (which is *OPTLEN bytes long), and set
60
   *OPTLEN to the value's actual length. Returns 0 on success, -1 for
61
   errors.  */
62
int getsockopt __P ((int __s, int __level, int __optname,
63
                void *__optval, int *__optlen));
64
 
65
/* Set socket FD's option OPTNAME at protocol level LEVEL
66
   to *OPTVAL (which is OPTLEN bytes long).
67
   Returns 0 on success, -1 for errors.  */
68
int setsockopt __P ((int __s, int __level, int __optname,
69
                __const void *__optval, int optlen));
70
 
71
/* Put the local address of FD into *ADDR and its length in *LEN.  */
72
int getsockname __P ((int __sockfd, struct sockaddr *__addr,
73
                int *__paddrlen));
74
 
75
/* Put the address of the peer connected to socket FD into *ADDR
76
   (which is *LEN bytes long), and its actual length into *LEN.  */
77
int getpeername __P ((int __sockfd, struct sockaddr *__peer,
78
                int *__paddrlen));
79
 
80
/* Send N bytes of BUF to socket FD.  Returns the number sent or -1. */
81
int send __P ((int __sockfd, __const void *__buff, size_t __len,
82
                 unsigned int __flags));
83
 
84
/* Read N bytes into BUF from socket FD.
85
   Returns the number read or -1 for errors.  */
86
int recv __P ((int __sockfd, void *__buff, size_t __len,
87
                 unsigned int __flags));
88
 
89
/* Send N bytes of BUF on socket FD to peer at address ADDR (which is
90
   ADDR_LEN bytes long).  Returns the number sent, or -1 for errors. */
91
int sendto __P ((int __sockfd, __const void *__buff, size_t __len,
92
                 unsigned int __flags, __const struct sockaddr *__to,
93
                 int __tolen));
94
 
95
/* Read N bytes into BUF through socket FD.
96
   If ADDR is not NULL, fill in *ADDR_LEN bytes of it with tha address
97
   of the sender, and store the actual size of the address in
98
   *ADDR_LEN. Returns the number of bytes read or -1 for errors. */
99
int recvfrom __P ((int __sockfd, void *__buff, size_t __len,
100
                 unsigned int __flags, struct sockaddr *__from,
101
                 int *__fromlen));
102
 
103
/* Send a message described MESSAGE on socket FD.
104
   Returns the number of bytes sent, or -1 for errors.  */
105
extern int sendmsg __P ((int __fd, __const struct msghdr *__message,
106
                        unsigned int __flags));
107
 
108
/* Receive a message as described by MESSAGE from socket FD.
109
   Returns the number of bytes read or -1 for errors.  */
110
extern int recvmsg __P ((int __fd, struct msghdr *__message,
111
                        unsigned int __flags));
112
 
113
/* Shut down all or part of the connection open on socket FD.
114
   HOW determines what to shut down:
115
 
116
        1 = No more transmissions;
117
        2 = No more receptions or transmissions.
118
   Returns 0 on success, -1 for errors.  */
119
int shutdown __P ((int __sockfd, int __how));
120
 
121
 
122
/* belongs here or elsewhere? */
123
int rcmd __P ((char **__ahost, unsigned short __inport,
124
                __const char *__locuser, __const char *__remuser,
125
                __const char *__cmd, int *__fd2p));
126
int rresvport __P ((int *__port));
127
int ruserok __P ((__const char *__rhost, int __superuser,
128
                __const char *__ruser, __const char *__luser));
129
int rexec __P ((char **__ahost, int __inport, __const char *__user,
130
                 __const char *__passwd, __const char *__cmd,
131
                 int *__fd2p));
132
 
133
__END_DECLS
134
 
135
#endif /* _SYS_SOCKET_H */

powered by: WebSVN 2.1.0

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