1 /*
2  * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 #ifndef _WLAN_NAN_MSG_COMMON_V2_H_
18 #define _WLAN_NAN_MSG_COMMON_V2_H_
19 /*
20  * WLAN NAN CONSTANTS
21  */
22 #ifndef PACKED_PRE
23 #define PACKED_PRE PREPACK
24 #endif
25 
26 #ifndef PACKED_POST
27 #define PACKED_POST POSTPACK
28 #endif
29 
30 /* ALL THE INTERFACE DEFINITIONS ARE ASSUMED TO BE IN LITTLE ENDIAN ORDER.
31  * BIG ENDIAN HOST IS RESPONSIBLE TO SEND/INTERPRET MESSAGES IN LITTLE
32  * ENDIAN FORMAT ONLY
33  */
34 
35 /* NAN message IDs */
36 typedef enum {
37     NAN_MSG_ID_ERROR_RSP                    = 0,
38     NAN_MSG_ID_CONFIGURATION_REQ            = 1,
39     NAN_MSG_ID_CONFIGURATION_RSP            = 2,
40     NAN_MSG_ID_PUBLISH_SERVICE_REQ          = 3,
41     NAN_MSG_ID_PUBLISH_SERVICE_RSP          = 4,
42     NAN_MSG_ID_PUBLISH_SERVICE_CANCEL_REQ   = 5,
43     NAN_MSG_ID_PUBLISH_SERVICE_CANCEL_RSP   = 6,
44     NAN_MSG_ID_PUBLISH_REPLIED_IND          = 7,
45     NAN_MSG_ID_PUBLISH_TERMINATED_IND       = 8,
46     NAN_MSG_ID_SUBSCRIBE_SERVICE_REQ        = 9,
47     NAN_MSG_ID_SUBSCRIBE_SERVICE_RSP        = 10,
48     NAN_MSG_ID_SUBSCRIBE_SERVICE_CANCEL_REQ = 11,
49     NAN_MSG_ID_SUBSCRIBE_SERVICE_CANCEL_RSP = 12,
50     NAN_MSG_ID_MATCH_IND                    = 13,
51     NAN_MSG_ID_UNMATCH_IND                  = 14,
52     NAN_MSG_ID_SUBSCRIBE_TERMINATED_IND     = 15,
53     NAN_MSG_ID_DE_EVENT_IND                 = 16,
54     NAN_MSG_ID_TRANSMIT_FOLLOWUP_REQ        = 17,
55     NAN_MSG_ID_TRANSMIT_FOLLOWUP_RSP        = 18,
56     NAN_MSG_ID_FOLLOWUP_IND                 = 19,
57     NAN_MSG_ID_STATS_REQ                    = 20,
58     NAN_MSG_ID_STATS_RSP                    = 21,
59     NAN_MSG_ID_ENABLE_REQ                   = 22,
60     NAN_MSG_ID_ENABLE_RSP                   = 23,
61     NAN_MSG_ID_DISABLE_REQ                  = 24,
62     NAN_MSG_ID_DISABLE_RSP                  = 25,
63     NAN_MSG_ID_DISABLE_IND                  = 26,
64     NAN_MSG_ID_TCA_REQ                      = 27,
65     NAN_MSG_ID_TCA_RSP                      = 28,
66     NAN_MSG_ID_TCA_IND                      = 29,
67     NAN_MSG_ID_BEACON_SDF_REQ               = 30,
68     NAN_MSG_ID_BEACON_SDF_RSP               = 31,
69     NAN_MSG_ID_BEACON_SDF_IND               = 32,
70     NAN_MSG_ID_CAPABILITIES_REQ             = 33,
71     NAN_MSG_ID_CAPABILITIES_RSP             = 34,
72     NAN_MSG_ID_SELF_TRANSMIT_FOLLOWUP_IND   = 35,
73     NAN_MSG_ID_RANGING_REQUEST_IND          = 36,
74     NAN_MSG_ID_RANGING_RESULT_IND           = 37,
75     /* Add regular/non-test mode messages here */
76     NAN_MSG_ID_TESTMODE_REQ                 = 1025,
77 } nan_msg_id_t;
78 
79 /* 8-byte control message header used by NAN */
80 typedef PACKED_PRE struct PACKED_POST {
81     A_UINT16 msg_version:4;
82     A_UINT16 msg_id:12;
83     A_UINT16 msg_len;
84     A_UINT16 handle;
85     A_UINT16 transaction_id;
86 } nan_msg_header_t, *nan_msg_header_tp;
87 
88 #endif /* WLAN_NAN_MSG_COMMON_V2_H */
89