chiark / gitweb /
sd-rtnl: beef up rtnl-util a bit
[elogind.git] / src / libsystemd / sd-rtnl / rtnl-internal.h
index 5dc66ac9d6f7eadbeb0798a54847b31ef1780c90..4bfcb836d6f44f68878e9485ea38800fbaa5f38d 100644 (file)
 
 #include "sd-rtnl.h"
 
+#define RTNL_DEFAULT_TIMEOUT ((usec_t) (10 * USEC_PER_SEC))
+
+#define RTNL_WQUEUE_MAX 1024
+#define RTNL_RQUEUE_MAX 64*1024
+
+#define RTNL_CONTAINER_DEPTH 32
+
 struct reply_callback {
         sd_rtnl_message_handler_t callback;
         void *userdata;
@@ -78,20 +85,18 @@ struct sd_rtnl {
         sd_event *event;
 };
 
-#define RTNL_DEFAULT_TIMEOUT ((usec_t) (10 * USEC_PER_SEC))
-
-#define RTNL_WQUEUE_MAX 1024
-#define RTNL_RQUEUE_MAX 64*1024
+struct sd_rtnl_message {
+        RefCount n_ref;
 
-#define RTNL_CONTAINER_DEPTH 32
+        struct nlmsghdr *hdr;
+        size_t container_offsets[RTNL_CONTAINER_DEPTH]; /* offset from hdr to each container's start */
+        unsigned n_containers; /* number of containers */
+        size_t next_rta_offset; /* offset from hdr to next rta */
 
-int message_new_synthetic_error(int error, uint32_t serial, sd_rtnl_message **ret);
-uint32_t message_get_serial(sd_rtnl_message *m);
-int message_seal(sd_rtnl *nl, sd_rtnl_message *m);
+        bool sealed:1;
+};
 
-bool message_type_is_link(uint16_t type);
-bool message_type_is_addr(uint16_t type);
-bool message_type_is_route(uint16_t type);
+int message_new(sd_rtnl_message **ret, size_t initial_size);
 
 int socket_write_message(sd_rtnl *nl, sd_rtnl_message *m);
 int socket_read_message(sd_rtnl *nl, sd_rtnl_message **ret);