Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv14884

Modified Files:
        acl.c 
Log Message:
Centralize and fix tos for IAX (bug #4850 inspired)


Index: acl.c
===================================================================
RCS file: /usr/cvsroot/asterisk/acl.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- acl.c       19 Jul 2005 23:35:45 -0000      1.51
+++ acl.c       9 Aug 2005 16:41:28 -0000       1.52
@@ -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 @@
        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);

_______________________________________________
Asterisk-Cvs mailing list
[email protected]
http://lists.digium.com/mailman/listinfo/asterisk-cvs

Reply via email to