Holger Hans Peter Freyther | a7d50bf | 2013-12-23 14:26:36 +0100 | [diff] [blame] | 1 | #ifndef protocol_h |
| 2 | #define protocol_h |
| 3 | |
| 4 | #include <stdint.h> |
| 5 | |
| 6 | /* |
| 7 | * 79 00 03 00 06 00 9C 76 B6 07 00 00 D4 00 00 00 y......v¶...Ô... |
| 8 | * 02 00 00 00 39 00 00 00 63 F9 FF FF 00 00 00 00 ....9...cùÿÿ.... |
| 9 | * 41 43 51 20 53 74 61 72 74 65 64 2C 20 41 52 46 ACQ.Started,.ARF |
| 10 | * 43 4E 3D 25 64 2C 20 52 78 50 57 52 78 31 36 3D CN=%d,.RxPWRx16= |
| 11 | * 25 64 00 6C 31 5F 61 63 71 2E 63 00 %d.l1_acq.c. |
| 12 | */ |
| 13 | |
| 14 | struct ext_log_msg { |
| 15 | uint8_t type; |
| 16 | uint16_t unknown1; /* 0x00 0x03 type??? */ |
| 17 | uint16_t unknown2; /* 0x00 0x06 type??? */ |
| 18 | uint64_t timestamp; /* More 32 bit but dm-commands.h */ |
| 19 | uint8_t unknown3[3]; /* 0x00 0x00 0x00 */ |
| 20 | uint32_t unknown4; /* 0x02 0x00 0x00 0x00 */ |
| 21 | int32_t params[3]; /* three params */ |
| 22 | uint8_t data[0]; /* two NULL terminated strings from here */ |
| 23 | } __attribute__((packed)); |
| 24 | |
Harald Welte | f5d6fee | 2016-01-13 22:29:10 +0100 | [diff] [blame] | 25 | |
| 26 | /* message header */ |
| 27 | struct diag_msg_hdr { |
| 28 | uint8_t cmd_code; |
| 29 | uint8_t timestamp_type; |
| 30 | uint8_t num_args; |
| 31 | uint8_t drop_count; |
| 32 | uint64_t ts; |
| 33 | } __attribute__((packed)); |
| 34 | |
| 35 | /* message descriptor */ |
| 36 | struct diag_msg_desc { |
| 37 | uint16_t line; |
| 38 | uint16_t subsys_id; |
| 39 | uint16_t subsys_mask; |
| 40 | } __attribute__((packed)); |
| 41 | |
| 42 | /* message header for DIAG_EXT_MSG_F */ |
| 43 | struct diag_msg_ext { |
| 44 | struct diag_msg_hdr hdr; |
| 45 | struct diag_msg_desc desc; |
| 46 | uint32_t args[0]; /* see hdr.num_args */ |
| 47 | /* followed by null-terminated strings */ |
| 48 | } __attribute__((packed)); |
| 49 | |
| 50 | |
| 51 | /* message header for DIAG_LOG_F */ |
| 52 | struct diag_log_hdr { |
| 53 | uint8_t cmd_code; |
| 54 | uint8_t more; |
| 55 | uint16_t len; |
| 56 | uint8_t data[0]; |
| 57 | } __attribute__((packed)); |
| 58 | |
| 59 | struct log_hdr { |
| 60 | uint16_t len; |
| 61 | uint16_t code; |
| 62 | uint64_t ts; |
| 63 | uint8_t data[0]; |
| 64 | } __attribute__((packed)); |
| 65 | |
| 66 | |
| 67 | /* extended DIAG packet, */ |
| 68 | struct diagpkt_subsys_hdr { |
| 69 | uint8_t command; /* DIAG_SUBSYS_CMD_F */ |
| 70 | uint8_t subsys_id; |
| 71 | uint8_t subsys_cmd_code; |
| 72 | } __attribute__((packed)); |
| 73 | |
| 74 | int diag_push_subsys_hdr(struct msgb *msg, uint8_t subsys, uint8_t code); |
| 75 | |
Holger Hans Peter Freyther | a7d50bf | 2013-12-23 14:26:36 +0100 | [diff] [blame] | 76 | #endif |