Asterisk - The Open Source Telephony Project  18.5.0
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 <[email protected]>
7  * Kevin P. Fleming <[email protected]>
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  * \deprecated Use netsock2.h instead
24  */
25 
26 #ifndef _ASTERISK_NETSOCK_H
27 #define _ASTERISK_NETSOCK_H
28 
29 #if defined(__cplusplus) || defined(c_plusplus)
30 extern "C" {
31 #endif
32 
33 #include "asterisk/network.h"
34 #include "asterisk/io.h"
35 #include "asterisk/netsock2.h"
36 
37 struct ast_netsock;
38 
39 struct ast_netsock_list;
40 
42 
43 int ast_netsock_init(struct ast_netsock_list *list);
44 
45 struct ast_netsock *ast_netsock_bind(struct ast_netsock_list *list, struct io_context *ioc,
46  const char *bindinfo, int defaultport, int tos, int cos, ast_io_cb callback, void *data);
47 
48 struct ast_netsock *ast_netsock_bindaddr(struct ast_netsock_list *list, struct io_context *ioc,
49  struct ast_sockaddr *bindaddr, int tos, int cos, ast_io_cb callback, void *data);
50 
51 int ast_netsock_release(struct ast_netsock_list *list);
52 
53 struct ast_netsock *ast_netsock_find(struct ast_netsock_list *list,
54  struct ast_sockaddr *addr);
55 
56 /*!
57  * \deprecated Use ast_seq_qos in netsock2.h which properly handles IPv4 and IPv6
58  * sockets, instead.
59  */
60 int ast_netsock_set_qos(int sockfd, int tos, int cos, const char *desc);
61 
62 int ast_netsock_sockfd(const struct ast_netsock *ns);
63 
64 const struct ast_sockaddr *ast_netsock_boundaddr(const struct ast_netsock *ns);
65 
66 void *ast_netsock_data(const struct ast_netsock *ns);
67 
68 void ast_netsock_unref(struct ast_netsock *ns);
69 
70 #if defined(__cplusplus) || defined(c_plusplus)
71 }
72 #endif
73 
74 #endif /* _ASTERISK_NETSOCK_H */
void * data
Definition: netsock.c:57
unsigned int cos
Definition: chan_iax2.c:352
struct io_context * ioc
Definition: netsock.c:56
const struct ast_sockaddr * ast_netsock_boundaddr(const struct ast_netsock *ns)
Definition: netsock.c:188
int ast_netsock_sockfd(const struct ast_netsock *ns)
Definition: netsock.c:183
int sockfd
Definition: netsock.c:54
int ast_netsock_release(struct ast_netsock_list *list)
Definition: netsock.c:85
struct ast_netsock * ast_netsock_bindaddr(struct ast_netsock_list *list, struct io_context *ioc, struct ast_sockaddr *bindaddr, int tos, int cos, ast_io_cb callback, void *data)
Definition: netsock.c:109
int ast_netsock_set_qos(int sockfd, int tos, int cos, const char *desc)
Definition: netsock.c:162
static const char desc[]
Definition: cdr_mysql.c:73
struct ast_netsock_list * ast_netsock_list_alloc(void)
Definition: netsock.c:72
I/O Management (derived from Cheops-NG)
Socket address structure.
Definition: netsock2.h:97
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:167
unsigned int tos
Definition: chan_iax2.c:351
void ast_netsock_unref(struct ast_netsock *ns)
Definition: netsock.c:198
int(* ast_io_cb)(int *id, int fd, short events, void *cbdata)
Definition: io.h:72
Global IO variables are now in a struct in order to be made threadsafe.
Definition: io.c:71
Network socket handling.
Wrapper for network related headers, masking differences between various operating systems...
struct ast_netsock * ast_netsock_find(struct ast_netsock_list *list, struct ast_sockaddr *addr)
Definition: netsock.c:94
int ast_netsock_init(struct ast_netsock_list *list)
Definition: netsock.c:77
void * ast_netsock_data(const struct ast_netsock *ns)
Definition: netsock.c:193
struct ast_sockaddr bindaddr
Definition: chan_ooh323.c:353