]> git.meshlink.io Git - meshlink/commitdiff
Finished sockaddr_t to sockaddr_storage copy on meshlink_edge_t.
authorAaron Krebs <aaron.krebs@everbase.net>
Mon, 11 Aug 2014 08:56:58 +0000 (10:56 +0200)
committerAaron Krebs <aaron.krebs@everbase.net>
Mon, 11 Aug 2014 08:56:58 +0000 (10:56 +0200)
src/meshlink.c
src/meshlink.h

index 6396163dc4d6938a230f2039132cd8ce2dbc044a..9011879312ea34b27a5bb0833782640ab1372ea8 100644 (file)
@@ -1868,8 +1868,9 @@ meshlink_edge_t **meshlink_get_all_edges_state(meshlink_handle_t *mesh, size_t *
                        copy = xzalloc(sizeof *copy);
                        copy->from = (meshlink_node_t*)e->from;
                        copy->to = (meshlink_node_t*)e->to;
-                       //TODO fix conversion from sockaddr_t to sockaddr_storage
-                       //copy->address = e->address.ss;
+#ifdef HAVE_STRUCT_SOCKADDR_STORAGE
+                       copy->address = e->address.storage;
+#endif
                        copy->options = e->options;
                        copy->weight = e->weight;
                        *p++ = copy;
index 8bc8c706f5a4bff29455f302a8b262c22d5e61d1..404a8fdec9c308db1509aeb3de43e5b340e267ae 100644 (file)
@@ -100,13 +100,22 @@ struct meshlink_channel {
 
 #endif // MESHLINK_INTERNAL_H
 
-// TODO documentation
+/// An edge in the meshlink network.
 struct meshlink_edge {
-       struct meshlink_node *from;
-       struct meshlink_node *to;
-       struct sockaddr_storage address;
-       uint32_t options;
-       int weight;
+       struct meshlink_node *from;     ///< Pointer to a node. Node memory is
+                                       //   owned by meshlink and should not be
+                                       //   deallocated. Node contents may be
+                                       //   changed by meshlink.
+       struct meshlink_node *to;       ///< Pointer to a node. Node memory is
+                                        //   owned by meshlink and should not be
+                                        //   deallocated. Node contents may be
+                                        //   changed by meshlink.
+#ifdef HAVE_STRUCT_SOCKADDR_STORAGE
+       struct sockaddr_storage address;///< The address information associated
+#endif
+                                       //   with this edge.
+       uint32_t options;               ///< Edge options. @TODO what are edge options?
+       int weight;                     ///< Weight assigned to this edge.
 };
 
 /// Get the text for the given MeshLink error code.