diff options
author | Mark Spencer <markster@digium.com> | 2005-08-09 16:41:28 +0000 |
---|---|---|
committer | Mark Spencer <markster@digium.com> | 2005-08-09 16:41:28 +0000 |
commit | 97e1ede2923b2c1932e06f7eef1761515a54ce47 (patch) | |
tree | 58dbac449574b77b6fb579f87e67e53130b9b188 /acl.c | |
parent | 95cf08ee927ab3ea1e3723e179a279f5736a57c2 (diff) |
Centralize and fix tos for IAX (bug #4850 inspired)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6315 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'acl.c')
-rwxr-xr-x | acl.c | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -23,6 +23,7 @@ #include <sys/socket.h> #include <netdb.h> #include <net/if.h> +#include <netinet/in.h> #include <netinet/in_systm.h> #include <netinet/ip.h> #include <sys/ioctl.h> @@ -225,6 +226,26 @@ int ast_get_ip_or_srv(struct sockaddr_in *sin, const char *value, const char *se return 0; } +int ast_str2tos(const char *value, int *tos) +{ + int fval; + if (sscanf(value, "%i", &fval) == 1) + *tos = fval & 0xff; + else if (!strcasecmp(value, "lowdelay")) + *tos = IPTOS_LOWDELAY; + else if (!strcasecmp(value, "throughput")) + *tos = IPTOS_THROUGHPUT; + else if (!strcasecmp(value, "reliability")) + *tos = IPTOS_RELIABILITY; + else if (!strcasecmp(value, "mincost")) + *tos = IPTOS_MINCOST; + else if (!strcasecmp(value, "none")) + *tos = 0; + else + return -1; + return 0; +} + int ast_get_ip(struct sockaddr_in *sin, const char *value) { return ast_get_ip_or_srv(sin, value, NULL); |