summaryrefslogtreecommitdiffstats
path: root/sys/netgraph/ng_message.h
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2006-01-12 19:14:40 +0000
committerglebius <glebius@FreeBSD.org>2006-01-12 19:14:40 +0000
commita8f06e957080a331d9ecc145c6607b6288af3659 (patch)
treeb2c0019bd35fabc0a5c9e34912a888b49f88722b /sys/netgraph/ng_message.h
parent658b743414248c41e39ec8f375117931bc29b5e2 (diff)
downloadFreeBSD-src-a8f06e957080a331d9ecc145c6607b6288af3659.zip
FreeBSD-src-a8f06e957080a331d9ecc145c6607b6288af3659.tar.gz
In the splnet(9) times netgraph(4) was synchronous and if a message
had been replied, the reply was always delivered to the originator synchronously. With introduction of netgraph item callbacks and a wait channel with mutex in ng_socket(4), we have fixed the problem with ngctl(8) returning earlier than the command has been proceeded by target node. But still ngctl(8) can return prior to the reply has arrived to its node. To fix this: - Introduce a new flag for netgraph(4) messages - NGM_HASREPLY. This flag is or'ed with message like NGM_READONLY. - In netgraph userland library if we have sent a message with NGM_HASREPLY flag, then select(2) until reply comes. - Mark appropriate generic commands with NGM_HASREPLY flag, gathering them into one enum {}. Bump generic cookie.
Diffstat (limited to 'sys/netgraph/ng_message.h')
-rw-r--r--sys/netgraph/ng_message.h50
1 files changed, 32 insertions, 18 deletions
diff --git a/sys/netgraph/ng_message.h b/sys/netgraph/ng_message.h
index c132b03..8648708 100644
--- a/sys/netgraph/ng_message.h
+++ b/sys/netgraph/ng_message.h
@@ -78,8 +78,10 @@ struct ng_mesg {
char data[]; /* placeholder for actual data */
};
-/* this command is guaranteed to not alter data or'd into the command */
+/* This command is guaranteed to not alter data (or'd into the command). */
#define NGM_READONLY 0x10000000
+/* This command is guaranteed to have a reply (or'd into the command). */
+#define NGM_HASREPLY 0x20000000
/* Keep this in sync with the above structure definition */
#define NG_GENERIC_NG_MESG_INFO(dtype) { \
@@ -117,23 +119,35 @@ struct ng_mesg {
*/
/* Generic message type cookie */
-#define NGM_GENERIC_COOKIE 977674408
-
-/* Generic messages defined for this type cookie */
-#define NGM_SHUTDOWN 1 /* shut down node */
-#define NGM_MKPEER 2 /* create and attach a peer node */
-#define NGM_CONNECT 3 /* connect two nodes */
-#define NGM_NAME 4 /* give a node a name */
-#define NGM_RMHOOK 5 /* break a connection btw. two nodes */
-#define NGM_NODEINFO (6|NGM_READONLY)/* get nodeinfo for target */
-#define NGM_LISTHOOKS (7|NGM_READONLY)/* get list of hooks on node */
-#define NGM_LISTNAMES (8|NGM_READONLY)/* list globally named nodes */
-#define NGM_LISTNODES (9|NGM_READONLY)/* list nodes, named & not */
-#define NGM_LISTTYPES (10|NGM_READONLY)/* list installed node types */
-#define NGM_TEXT_STATUS (11|NGM_READONLY)/* (optional) get txt status */
-#define NGM_BINARY2ASCII (12|NGM_READONLY)/* convert ng_mesg to ascii */
-#define NGM_ASCII2BINARY (13|NGM_READONLY)/* convert ascii to ng_mesg */
-#define NGM_TEXT_CONFIG 14 /* (optional) get/set text config */
+#define NGM_GENERIC_COOKIE 1137070366
+
+/* Generic messages defined for this type cookie. */
+enum {
+ NGM_SHUTDOWN = 1, /* Shut down node. */
+ NGM_MKPEER = 2, /* Create and attach a peer node. */
+ NGM_CONNECT = 3, /* Connect two nodes. */
+ NGM_NAME = 4, /* Give a node a name. */
+ NGM_RMHOOK = 5, /* Break a connection between two nodes. */
+
+ /* Get nodeinfo for target. */
+ NGM_NODEINFO = (6|NGM_READONLY|NGM_HASREPLY),
+ /* Get list of hooks on node. */
+ NGM_LISTHOOKS = (7|NGM_READONLY|NGM_HASREPLY),
+ /* List globally named nodes. */
+ NGM_LISTNAMES = (8|NGM_READONLY|NGM_HASREPLY),
+ /* List all nodes. */
+ NGM_LISTNODES = (9|NGM_READONLY|NGM_HASREPLY),
+ /* List installed node types. */
+ NGM_LISTTYPES = (10|NGM_READONLY|NGM_HASREPLY),
+ /* (optional) Get text status. */
+ NGM_TEXT_STATUS = (11|NGM_READONLY|NGM_HASREPLY),
+ /* Convert struct ng_mesg to ASCII. */
+ NGM_BINARY2ASCII= (12|NGM_READONLY|NGM_HASREPLY),
+ /* Convert ASCII to struct ng_mesg. */
+ NGM_ASCII2BINARY= (13|NGM_READONLY|NGM_HASREPLY),
+ /* (optional) Get/set text config. */
+ NGM_TEXT_CONFIG = 14,
+};
/*
* Flow control and intra node control messages.
OpenPOWER on IntegriCloud