Asterisk.org: Developer Documentation (28 Oct 2009)

Wed Oct 28 15:47:47 2009

## Asterisk developer's documentation

# acl.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  *
    00008  * See http://www.asterisk.org for more information about
    00009  * the Asterisk project. Please do not directly contact
    00010  * any of the maintainers of this project for assistance;
    00011  * the project provides a web site, mailing lists and IRC
    00012  * channels for your use.
    00013  *
    00014  * This program is free software, distributed under the terms of
    00015  * the GNU General Public License Version 2. See the LICENSE file
    00016  * at the top of the source tree.
    00017  */
    00018
    00019 /*! \file
    00020  * \brief Access Control of various sorts
    00021  */
    00022
    00023 #ifndef _ASTERISK_ACL_H
    00024 #define _ASTERISK_ACL_H
    00025
    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
    00034 #define AST_SENSE_DENY                  0
    00035 #define AST_SENSE_ALLOW                 1
    00036
    00037 /* Host based access control */
    00038
    00039 struct ast_ha {
    00040    /* Host access rule */
    00041    struct in_addr netaddr;
    00042    struct in_addr netmask;
    00043    int sense;
    00044    struct ast_ha *next;
    00045 };
    00046
    00047 void ast_free_ha(struct ast_ha *ha);
    00048 void ast_copy_ha(const struct ast_ha *from, struct ast_ha *to);
    00049 struct ast_ha *ast_append_ha(char *sense, const char *stuff, struct ast_ha *path);
    00050 extern int ast_apply_ha(struct ast_ha *ha, struct sockaddr_in *sin);
    00051 extern int ast_get_ip(struct sockaddr_in *sin, const char *value);
    00052 extern int ast_get_ip_or_srv(struct sockaddr_in *sin, const char *value, const char *service);
    00053 extern int ast_ouraddrfor(struct in_addr *them, struct in_addr *us);
    00054 extern int ast_lookup_iface(char *iface, struct in_addr *address);
    00055 extern struct ast_ha *ast_duplicate_ha_list(struct ast_ha *original);
    00056 extern int ast_find_ourip(struct in_addr *ourip, struct sockaddr_in bindaddr);
    00057 extern int ast_str2tos(const char *value, int *tos);
    00058
    00059 #if defined(__cplusplus) || defined(c_plusplus)
    00060 }
    00061 #endif
    00062
    00063 #endif /* _ASTERISK_ACL_H */