net: qrtr: Add control packet definition to uapi
authorBjorn Andersson <bjorn.andersson@linaro.org>
Wed, 11 Oct 2017 06:45:19 +0000 (23:45 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 11 Oct 2017 22:28:38 +0000 (15:28 -0700)
The QMUX protocol specification defines structure of the special control
packet messages being sent between handlers of the control port.

Add these to the uapi header, as this structure and the associated types
are shared between the kernel and all userspace handlers of control
messages.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/uapi/linux/qrtr.h
net/qrtr/qrtr.c

index 63e8803e4d90e6a588da33add9477298fac3799d..179af64846e09640c513095b200557dd3505bfad 100644 (file)
@@ -13,4 +13,36 @@ struct sockaddr_qrtr {
        __u32 sq_port;
 };
 
+enum qrtr_pkt_type {
+       QRTR_TYPE_DATA          = 1,
+       QRTR_TYPE_HELLO         = 2,
+       QRTR_TYPE_BYE           = 3,
+       QRTR_TYPE_NEW_SERVER    = 4,
+       QRTR_TYPE_DEL_SERVER    = 5,
+       QRTR_TYPE_DEL_CLIENT    = 6,
+       QRTR_TYPE_RESUME_TX     = 7,
+       QRTR_TYPE_EXIT          = 8,
+       QRTR_TYPE_PING          = 9,
+       QRTR_TYPE_NEW_LOOKUP    = 10,
+       QRTR_TYPE_DEL_LOOKUP    = 11,
+};
+
+struct qrtr_ctrl_pkt {
+       __le32 cmd;
+
+       union {
+               struct {
+                       __le32 service;
+                       __le32 instance;
+                       __le32 node;
+                       __le32 port;
+               } server;
+
+               struct {
+                       __le32 node;
+                       __le32 port;
+               } client;
+       };
+} __packed;
+
 #endif /* _LINUX_QRTR_H */
index 15981abc042cbdae646b473979cdc4a10f401e2e..d85ca7170b8f7fca77fd9200b6495ede4179ad0e 100644 (file)
 #define QRTR_MIN_EPH_SOCKET 0x4000
 #define QRTR_MAX_EPH_SOCKET 0x7fff
 
-enum qrtr_pkt_type {
-       QRTR_TYPE_DATA          = 1,
-       QRTR_TYPE_HELLO         = 2,
-       QRTR_TYPE_BYE           = 3,
-       QRTR_TYPE_NEW_SERVER    = 4,
-       QRTR_TYPE_DEL_SERVER    = 5,
-       QRTR_TYPE_DEL_CLIENT    = 6,
-       QRTR_TYPE_RESUME_TX     = 7,
-       QRTR_TYPE_EXIT          = 8,
-       QRTR_TYPE_PING          = 9,
-};
-
 /**
  * struct qrtr_hdr - (I|R)PCrouter packet header
  * @version: protocol version