Asterisk.org: Developer Documentation (28 Oct 2009)

Wed Oct 28 15:47:54 2009

## 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 <netinet/in.h>
    00032 #include "asterisk/io.h"
    00033 #include "asterisk/astobj.h"
    00034
    00035 struct ast_netsock;
    00036
    00037 struct ast_netsock_list;
    00038
    00039 struct ast_netsock_list *ast_netsock_list_alloc(void);
    00040
    00041 int ast_netsock_init(struct ast_netsock_list *list);
    00042
    00043 struct ast_netsock *ast_netsock_bind(struct ast_netsock_list *list, struct io_context *ioc,
    00044                  const char *bindinfo, int defaultport, int tos, ast_io_cb callback, void *data);
    00045
    00046 struct ast_netsock *ast_netsock_bindaddr(struct ast_netsock_list *list, struct io_context *ioc,
    00047                 struct sockaddr_in *bindaddr, int tos, ast_io_cb callback, void *data);
    00048
    00049 int ast_netsock_free(struct ast_netsock_list *list, struct ast_netsock *netsock);
    00050
    00051 int ast_netsock_release(struct ast_netsock_list *list);
    00052
    00053 struct ast_netsock *ast_netsock_find(struct ast_netsock_list *list,
    00054                  struct sockaddr_in *sa);
    00055
    00056 int ast_netsock_sockfd(const struct ast_netsock *ns);
    00057
    00058 const struct sockaddr_in *ast_netsock_boundaddr(const struct ast_netsock *ns);
    00059
    00060 void *ast_netsock_data(const struct ast_netsock *ns);
    00061
    00062 void ast_netsock_unref(struct ast_netsock *ns);
    00063
    00064 #if defined(__cplusplus) || defined(c_plusplus)
    00065 }
    00066 #endif
    00067
    00068 #endif /* _ASTERISK_NETSOCK_H */