Revision: 14840
Author: adrian.chadd
Date: Tue Jan 11 21:26:33 2011
Log: Add some helper functions which abstract away accessing entries in the
ipcache address array.


http://code.google.com/p/lusca-cache/source/detail?r=14840

Modified:
 /playpen/LUSCA_HEAD_ipv6/libsqname/ipcache.c
 /playpen/LUSCA_HEAD_ipv6/libsqname/ipcache.h

=======================================
--- /playpen/LUSCA_HEAD_ipv6/libsqname/ipcache.c        Tue Jan 11 17:46:15 2011
+++ /playpen/LUSCA_HEAD_ipv6/libsqname/ipcache.c        Tue Jan 11 21:26:33 2011
@@ -715,3 +715,22 @@
     }
     return removed;
 }
+
+/*
+ * XXX legacy - no bounds checking!
+ */
+struct in_addr
+ipcacheGetAddrV4(const ipcache_addrs *ia, int i)
+{
+       return ia->in_addrs[i];
+}
+
+int
+ipcacheGetAddr(const ipcache_addrs *ia, int i, sqaddr_t *a)
+{
+       if (i >= ia->count)
+               return 0;
+
+       sqinet_set_v4_inaddr(a, &ia->in_addrs[i]);
+       return 1;
+}
=======================================
--- /playpen/LUSCA_HEAD_ipv6/libsqname/ipcache.h        Tue Jan 11 17:46:15 2011
+++ /playpen/LUSCA_HEAD_ipv6/libsqname/ipcache.h        Tue Jan 11 21:26:33 2011
@@ -65,7 +65,8 @@
 extern void ipcache_restart(void);
 extern int ipcacheAddEntryFromHosts(const char *name, const char *ipaddr);
 extern int ipcacheFlushAll(void);
-
+extern struct in_addr ipcacheGetAddrV4(const ipcache_addrs *, int i);
+extern int ipcacheGetAddr(const ipcache_addrs *, int i, sqaddr_t *a);

 #endif

--
You received this message because you are subscribed to the Google Groups 
"lusca-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/lusca-commit?hl=en.

Reply via email to