00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
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_release(struct ast_netsock_list *list);
00050
00051 struct ast_netsock *ast_netsock_find(struct ast_netsock_list *list,
00052 struct sockaddr_in *sa);
00053
00054 int ast_netsock_sockfd(const struct ast_netsock *ns);
00055
00056 const struct sockaddr_in *ast_netsock_boundaddr(const struct ast_netsock *ns);
00057
00058 void *ast_netsock_data(const struct ast_netsock *ns);
00059
00060 void ast_netsock_unref(struct ast_netsock *ns);
00061
00062 #if defined(__cplusplus) || defined(c_plusplus)
00063 }
00064 #endif
00065
00066 #endif