FreeNOS
socket.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2015 Niek Linnenbank
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef __LIBPOSIX_SYS_SOCKET_H
19#define __LIBPOSIX_SYS_SOCKET_H
20
21#include <Macros.h>
22#include "types.h"
23
36{
39};
40
44struct iovec
45{
46 void *iov_base;
47 size_t iov_len;
48};
49
51
65
75extern C int connect(int sockfd, struct sockaddr *addr, socklen_t addrlen);
76
89extern C int recvfrom(int sockfd, void *buf, size_t len, int flags,
90 struct sockaddr *addr, socklen_t addrlen);
91
104extern C int sendto(int sockfd, const void *buf, size_t len, int flags,
105 const struct sockaddr *addr, socklen_t addrlen);
106
116extern C int sendmsg(int sockfd, const struct msghdr *msg, int flags);
117
123#endif /* __LIBPOSIX_SYS_SOCKET_H */
u32 flags
Definition IntelACPI.h:3
C int sendto(int sockfd, const void *buf, size_t len, int flags, const struct sockaddr *addr, socklen_t addrlen)
Send a single datagram to a remote host.
Definition sendto.cpp:25
C int recvfrom(int sockfd, void *buf, size_t len, int flags, struct sockaddr *addr, socklen_t addrlen)
Receive a single datagram from a socket.
Definition recvfrom.cpp:25
C int connect(int sockfd, struct sockaddr *addr, socklen_t addrlen)
Connect a socket to an address/port.
Definition connect.cpp:23
Size socklen_t
Definition socket.h:50
C int sendmsg(int sockfd, const struct msghdr *msg, int flags)
Send multiple datagrams to a remote host.
Definition sendmsg.cpp:24
unsigned int u32
Unsigned 32-bit number.
Definition Types.h:53
unsigned short u16
Unsigned 16-bit number.
Definition Types.h:56
unsigned int Size
Any sane size indicator cannot go negative.
Definition Types.h:128
#define C
Used to define external C functions.
Definition Macros.h:134
Input/Output vector for multi-packet operations.
Definition socket.h:45
void * iov_base
Definition socket.h:46
size_t iov_len
Definition socket.h:47
Describes one or more datagrams.
Definition socket.h:56
struct iovec * msg_iov
Definition socket.h:59
socklen_t msg_namelen
Definition socket.h:58
void * msg_name
Definition socket.h:57
int msg_flags
Definition socket.h:63
size_t msg_controllen
Definition socket.h:62
size_t msg_iovlen
Definition socket.h:60
void * msg_control
Definition socket.h:61
Defines a socket address and port pair.
Definition socket.h:36
u32 addr
Definition socket.h:37
u16 port
Definition socket.h:38