]> sjero.net Git - iperf/blobdiff - src/List.cpp
Native IPv6 support for iperf
[iperf] / src / List.cpp
index 8cba006dcd9c0ee7016439d70d17b3d223a0f6ed..4b850a6dcbf38c2befcd5997b44af1af7f3c6999 100644 (file)
@@ -71,7 +71,8 @@ void Iperf_pushback ( Iperf_ListEntry *add, Iperf_ListEntry **root ) {
 /*
  * Delete Entry del from the List
  */
-void Iperf_delete ( iperf_sockaddr *del, Iperf_ListEntry **root ) {
+void Iperf_delete (struct sockaddr_storage *del, Iperf_ListEntry **root)
+{
     Iperf_ListEntry *temp = Iperf_present( del, *root );
     if ( temp != NULL ) {
         if ( temp == *root ) {
@@ -106,14 +107,13 @@ void Iperf_destroy ( Iperf_ListEntry **root ) {
 /*
  * Check if the exact Entry find is present
  */
-Iperf_ListEntry* Iperf_present ( iperf_sockaddr *find, Iperf_ListEntry *root ) {
-    Iperf_ListEntry *itr = root;
-    while ( itr != NULL ) {
-        if ( SockAddr_are_Equal( (sockaddr*)itr, (sockaddr*)find ) ) {
+Iperf_ListEntry* Iperf_present(struct sockaddr_storage *find, Iperf_ListEntry *root)
+{
+    Iperf_ListEntry *itr;
+
+    for (itr = root; itr != NULL; itr = itr->next)
+        if (SockAddr_are_Equal(find, &itr->data))
             return itr;
-        }
-        itr = itr->next;
-    }
     return NULL;
 }
 
@@ -121,14 +121,9 @@ Iperf_ListEntry* Iperf_present ( iperf_sockaddr *find, Iperf_ListEntry *root ) {
  * Check if a Entry find is in the List or if any
  * Entry exists that has the same host as the 
  * Entry find
+ * FIXME: The `or' condition was not implemented
  */
-Iperf_ListEntry* Iperf_hostpresent ( iperf_sockaddr *find, Iperf_ListEntry *root ) {
-    Iperf_ListEntry *itr = root;
-    while ( itr != NULL ) {
-        if ( SockAddr_Hostare_Equal( (sockaddr*)itr, (sockaddr*)find ) ) {
-            return itr;
-        }
-        itr = itr->next;
-    }
-    return NULL;
+Iperf_ListEntry* Iperf_hostpresent(struct sockaddr_storage *find, Iperf_ListEntry *root)
+{
+    return Iperf_present(find, root);
 }