Thu Apr 28 2011 17:13:34

Asterisk developer's documentation


netsock.h

Go to the documentation of this file.
00001 /*
00002  * Asterisk -- An open source telephony toolkit.
00003  *
00004  * Copyright (C) 1999 - 2005, Digium, Inc.
00005  *
00006  * Mark Spencer <markster@digium.com>
00007  * Kevin P. Fleming <kpfleming@digium.com>
00008  *
00009  * See http://www.asterisk.org for more information about
00010  * the Asterisk project. Please do not directly contact
00011  * any of the maintainers of this project for assistance;
00012  * the project provides a web site, mailing lists and IRC
00013  * channels for your use.
00014  *
00015  * This program is free software, distributed under the terms of
00016  * the GNU General Public License Version 2. See the LICENSE file
00017  * at the top of the source tree.
00018  */
00019 
00020 /*! \file
00021  * \brief Network socket handling
00022  */
00023 
00024 #ifndef _ASTERISK_NETSOCK_H
00025 #define _ASTERISK_NETSOCK_H
00026 
00027 #if defined(__cplusplus) || defined(c_plusplus)
00028 extern "C" {
00029 #endif
00030 
00031 #include "asterisk/network.h"
00032 #include "asterisk/io.h"
00033 
00034 struct ast_netsock;
00035 
00036 struct ast_netsock_list;
00037 
00038 struct ast_netsock_list *ast_netsock_list_alloc(void);
00039 
00040 int ast_netsock_init(struct ast_netsock_list *list);
00041 
00042 struct ast_netsock *ast_netsock_bind(struct ast_netsock_list *list, struct io_context *ioc,
00043                  const char *bindinfo, int defaultport, int tos, int cos, ast_io_cb callback, void *data);
00044 
00045 struct ast_netsock *ast_netsock_bindaddr(struct ast_netsock_list *list, struct io_context *ioc,
00046                 struct sockaddr_in *bindaddr, int tos, int cos, ast_io_cb callback, void *data);
00047 
00048 int ast_netsock_release(struct ast_netsock_list *list);
00049 
00050 struct ast_netsock *ast_netsock_find(struct ast_netsock_list *list,
00051                  struct sockaddr_in *sa);
00052 
00053 int ast_netsock_set_qos(int netsocket, int tos, int cos, const char *desc);
00054 
00055 int ast_netsock_sockfd(const struct ast_netsock *ns);
00056 
00057 const struct sockaddr_in *ast_netsock_boundaddr(const struct ast_netsock *ns);
00058 
00059 void *ast_netsock_data(const struct ast_netsock *ns);
00060 
00061 void ast_netsock_unref(struct ast_netsock *ns);
00062 
00063 #if defined(__cplusplus) || defined(c_plusplus)
00064 }
00065 #endif
00066 
00067 #endif /* _ASTERISK_NETSOCK_H */