Wed Jan 8 2020 09:49:48

Asterisk developer's documentation


netsock.h
Go to the documentation of this file.
1 /*
2  * Asterisk -- An open source telephony toolkit.
3  *
4  * Copyright (C) 1999 - 2005, Digium, Inc.
5  *
6  * Mark Spencer <markster@digium.com>
7  * Kevin P. Fleming <kpfleming@digium.com>
8  *
9  * See http://www.asterisk.org for more information about
10  * the Asterisk project. Please do not directly contact
11  * any of the maintainers of this project for assistance;
12  * the project provides a web site, mailing lists and IRC
13  * channels for your use.
14  *
15  * This program is free software, distributed under the terms of
16  * the GNU General Public License Version 2. See the LICENSE file
17  * at the top of the source tree.
18  */
19 
20 /*! \file
21  * \brief Network socket handling
22  */
23 
24 #ifndef _ASTERISK_NETSOCK_H
25 #define _ASTERISK_NETSOCK_H
26 
27 #if defined(__cplusplus) || defined(c_plusplus)
28 extern "C" {
29 #endif
30 
31 #include "asterisk/network.h"
32 #include "asterisk/io.h"
33 
34 struct ast_netsock;
35 
36 struct ast_netsock_list;
37 
39 
40 int ast_netsock_init(struct ast_netsock_list *list);
41 
42 struct ast_netsock *ast_netsock_bind(struct ast_netsock_list *list, struct io_context *ioc,
43  const char *bindinfo, int defaultport, int tos, int cos, ast_io_cb callback, void *data);
44 
45 struct ast_netsock *ast_netsock_bindaddr(struct ast_netsock_list *list, struct io_context *ioc,
46  struct sockaddr_in *bindaddr, int tos, int cos, ast_io_cb callback, void *data);
47 
48 int ast_netsock_release(struct ast_netsock_list *list);
49 
50 struct ast_netsock *ast_netsock_find(struct ast_netsock_list *list,
51  struct sockaddr_in *sa);
52 
53 int ast_netsock_set_qos(int netsocket, int tos, int cos, const char *desc);
54 
55 int ast_netsock_sockfd(const struct ast_netsock *ns);
56 
57 const struct sockaddr_in *ast_netsock_boundaddr(const struct ast_netsock *ns);
58 
59 void *ast_netsock_data(const struct ast_netsock *ns);
60 
61 void ast_netsock_unref(struct ast_netsock *ns);
62 
63 #if defined(__cplusplus) || defined(c_plusplus)
64 }
65 #endif
66 
67 #endif /* _ASTERISK_NETSOCK_H */
void * data
Definition: netsock.c:56
struct io_context * ioc
Definition: netsock.c:55
static unsigned int tos
Definition: chan_h323.c:146
int ast_netsock_sockfd(const struct ast_netsock *ns)
Definition: netsock.c:202
int ast_netsock_release(struct ast_netsock_list *list)
Definition: netsock.c:84
int ast_netsock_set_qos(int netsocket, int tos, int cos, const char *desc)
Definition: netsock.c:158
struct ast_netsock_list * ast_netsock_list_alloc(void)
Definition: netsock.c:71
struct ast_netsock * ast_netsock_bindaddr(struct ast_netsock_list *list, struct io_context *ioc, struct sockaddr_in *bindaddr, int tos, int cos, ast_io_cb callback, void *data)
Definition: netsock.c:108
I/O Management (derived from Cheops-NG)
struct ast_netsock * ast_netsock_find(struct ast_netsock_list *list, struct sockaddr_in *sa)
Definition: netsock.c:93
struct ast_netsock * ast_netsock_bind(struct ast_netsock_list *list, struct io_context *ioc, const char *bindinfo, int defaultport, int tos, int cos, ast_io_cb callback, void *data)
Definition: netsock.c:178
static int netsocket
Definition: pbx_dundi.c:178
void ast_netsock_unref(struct ast_netsock *ns)
Definition: netsock.c:217
Global IO variables are now in a struct in order to be made threadsafe.
Definition: io.c:66
struct sockaddr_in * ast_netsock_boundaddr(const struct ast_netsock *ns)
Definition: netsock.c:207
Wrapper for network related headers, masking differences between various operating systems...
static const char desc[]
Definition: cdr_radius.c:85
struct ast_sockaddr bindaddr
Definition: chan_sip.c:1146
int ast_netsock_init(struct ast_netsock_list *list)
Definition: netsock.c:76
int(* ast_io_cb)(int *id, int fd, short events, void *cbdata)
Definition: io.h:71
static unsigned int cos
Definition: chan_h323.c:147
void * ast_netsock_data(const struct ast_netsock *ns)
Definition: netsock.c:212