libosmocore  0.9.3
Osmocom core library
include/osmocom/core/socket.h
Go to the documentation of this file.
00001 #pragma once
00002 
00011 #include <stdint.h>
00012 
00013 struct sockaddr;
00014 struct osmo_fd;
00015 
00016 /* flags for osmo_sock_init. */
00017 #define OSMO_SOCK_F_CONNECT     (1 << 0)
00018 #define OSMO_SOCK_F_BIND        (1 << 1)
00019 #define OSMO_SOCK_F_NONBLOCK    (1 << 2)
00020 
00021 int osmo_sock_init(uint16_t family, uint16_t type, uint8_t proto,
00022                    const char *host, uint16_t port, unsigned int flags);
00023 
00024 int osmo_sock_init_ofd(struct osmo_fd *ofd, int family, int type, int proto,
00025                         const char *host, uint16_t port, unsigned int flags);
00026 
00027 int osmo_sock_init_sa(struct sockaddr *ss, uint16_t type,
00028                       uint8_t proto, unsigned int flags);
00029 
00030 int osmo_sockaddr_is_local(struct sockaddr *addr, unsigned int addrlen);
00031 
00032 int osmo_sock_unix_init(uint16_t type, uint8_t proto,
00033                         const char *socket_path, unsigned int flags);
00034 
00035 int osmo_sock_unix_init_ofd(struct osmo_fd *ofd, uint16_t type, uint8_t proto,
00036                             const char *socket_path, unsigned int flags);
00037