Add *preliminary* per-peer outbound proxy (bug #2859, new patch though)
[asterisk/asterisk.git] / include / asterisk / acl.h
1 /*
2  * Asterisk -- A telephony toolkit for Linux.
3  *
4  * Access Control of various sorts
5  * 
6  * Copyright (C) 1999, Mark Spencer
7  *
8  * Mark Spencer <markster@linux-support.net>
9  *
10  * This program is free software, distributed under the terms of
11  * the GNU General Public License
12  */
13
14 #ifndef _ASTERISK_ACL_H
15 #define _ASTERISK_ACL_H
16
17 #define AST_SENSE_DENY                  0
18 #define AST_SENSE_ALLOW                 1
19
20
21 #if defined(__cplusplus) || defined(c_plusplus)
22 extern "C" {
23 #endif
24
25 #include <netinet/in.h>
26
27 /* Host based access control */
28
29 struct ast_ha;
30
31 extern void ast_free_ha(struct ast_ha *ha);
32 extern struct ast_ha *ast_append_ha(char *sense, char *stuff, struct ast_ha *path);
33 extern int ast_apply_ha(struct ast_ha *ha, struct sockaddr_in *sin);
34 extern int ast_get_ip(struct sockaddr_in *sin, const char *value);
35 extern int ast_get_ip_or_srv(struct sockaddr_in *sin, const char *value, const char *service);
36 extern int ast_ouraddrfor(struct in_addr *them, struct in_addr *us);
37 extern int ast_lookup_iface(char *iface, struct in_addr *address);
38 extern struct ast_ha *ast_duplicate_ha_list(struct ast_ha *original);
39
40 //! Compares the source address and port of two sockaddr_in
41 static inline int inaddrcmp(struct sockaddr_in *sin1, struct sockaddr_in *sin2)
42 {
43         return ((sin1->sin_addr.s_addr != sin2->sin_addr.s_addr ) 
44                 || (sin1->sin_port != sin2->sin_port));
45 }
46
47 #if defined(__cplusplus) || defined(c_plusplus)
48 }
49 #endif
50
51 #endif