From a818fdccc17bd33b7241dfb3a995240f7b2875bc Mon Sep 17 00:00:00 2001 From: markster Date: Tue, 9 Aug 2005 16:41:28 +0000 Subject: Centralize and fix tos for IAX (bug #4850 inspired) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6315 f38db490-d61c-443f-a65b-d21fe96a405b --- acl.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'acl.c') diff --git a/acl.c b/acl.c index 032e76f8a..010ce26f8 100755 --- a/acl.c +++ b/acl.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -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); -- cgit v1.2.3