The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Decode and print Zephyr packets. |
| 3 | * |
| 4 | * http://web.mit.edu/zephyr/doc/protocol |
| 5 | * |
| 6 | * Copyright (c) 2001 Nickolai Zeldovich <kolya@MIT.EDU> |
| 7 | * All rights reserved. |
| 8 | * |
| 9 | * Redistribution and use in source and binary forms, with or without |
| 10 | * modification, are permitted provided that: (1) source code |
| 11 | * distributions retain the above copyright notice and this paragraph |
| 12 | * in its entirety, and (2) distributions including binary code include |
| 13 | * the above copyright notice and this paragraph in its entirety in |
| 14 | * the documentation or other materials provided with the distribution. |
| 15 | * The name of the author(s) may not be used to endorse or promote |
| 16 | * products derived from this software without specific prior written |
| 17 | * permission. THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY |
| 18 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE |
| 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 20 | * PURPOSE. |
| 21 | */ |
| 22 | |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 23 | /* \summary: Zephyr printer */ |
| 24 | |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 25 | #ifdef HAVE_CONFIG_H |
| 26 | #include "config.h" |
| 27 | #endif |
| 28 | |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 29 | #include <netdissect-stdinc.h> |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 30 | |
| 31 | #include <stdio.h> |
| 32 | #include <string.h> |
| 33 | #include <stdlib.h> |
| 34 | |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 35 | #include "netdissect.h" |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 36 | |
| 37 | struct z_packet { |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 38 | const char *version; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 39 | int numfields; |
| 40 | int kind; |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 41 | const char *uid; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 42 | int port; |
| 43 | int auth; |
| 44 | int authlen; |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 45 | const char *authdata; |
| 46 | const char *class; |
| 47 | const char *inst; |
| 48 | const char *opcode; |
| 49 | const char *sender; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 50 | const char *recipient; |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 51 | const char *format; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 52 | int cksum; |
| 53 | int multi; |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 54 | const char *multi_uid; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 55 | /* Other fields follow here.. */ |
| 56 | }; |
| 57 | |
| 58 | enum z_packet_type { |
| 59 | Z_PACKET_UNSAFE = 0, |
| 60 | Z_PACKET_UNACKED, |
| 61 | Z_PACKET_ACKED, |
| 62 | Z_PACKET_HMACK, |
| 63 | Z_PACKET_HMCTL, |
| 64 | Z_PACKET_SERVACK, |
| 65 | Z_PACKET_SERVNAK, |
| 66 | Z_PACKET_CLIENTACK, |
| 67 | Z_PACKET_STAT |
| 68 | }; |
| 69 | |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 70 | static const struct tok z_types[] = { |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 71 | { Z_PACKET_UNSAFE, "unsafe" }, |
| 72 | { Z_PACKET_UNACKED, "unacked" }, |
| 73 | { Z_PACKET_ACKED, "acked" }, |
| 74 | { Z_PACKET_HMACK, "hm-ack" }, |
| 75 | { Z_PACKET_HMCTL, "hm-ctl" }, |
| 76 | { Z_PACKET_SERVACK, "serv-ack" }, |
| 77 | { Z_PACKET_SERVNAK, "serv-nak" }, |
| 78 | { Z_PACKET_CLIENTACK, "client-ack" }, |
Elliott Hughes | cec480a | 2017-12-19 16:54:57 -0800 | [diff] [blame] | 79 | { Z_PACKET_STAT, "stat" }, |
| 80 | { 0, NULL } |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 81 | }; |
| 82 | |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 83 | static char z_buf[256]; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 84 | |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 85 | static const char * |
Elliott Hughes | cec480a | 2017-12-19 16:54:57 -0800 | [diff] [blame] | 86 | parse_field(netdissect_options *ndo, const char **pptr, int *len, int *truncated) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 87 | { |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 88 | const char *s; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 89 | |
Elliott Hughes | cec480a | 2017-12-19 16:54:57 -0800 | [diff] [blame] | 90 | /* Start of string */ |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 91 | s = *pptr; |
Elliott Hughes | cec480a | 2017-12-19 16:54:57 -0800 | [diff] [blame] | 92 | /* Scan for the NUL terminator */ |
| 93 | for (;;) { |
| 94 | if (*len == 0) { |
| 95 | /* Ran out of packet data without finding it */ |
| 96 | return NULL; |
| 97 | } |
| 98 | if (!ND_TTEST(**pptr)) { |
| 99 | /* Ran out of captured data without finding it */ |
| 100 | *truncated = 1; |
| 101 | return NULL; |
| 102 | } |
| 103 | if (**pptr == '\0') { |
| 104 | /* Found it */ |
| 105 | break; |
| 106 | } |
| 107 | /* Keep scanning */ |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 108 | (*pptr)++; |
| 109 | (*len)--; |
| 110 | } |
Elliott Hughes | cec480a | 2017-12-19 16:54:57 -0800 | [diff] [blame] | 111 | /* Skip the NUL terminator */ |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 112 | (*pptr)++; |
| 113 | (*len)--; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 114 | return s; |
| 115 | } |
| 116 | |
| 117 | static const char * |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 118 | z_triple(const char *class, const char *inst, const char *recipient) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 119 | { |
| 120 | if (!*recipient) |
| 121 | recipient = "*"; |
| 122 | snprintf(z_buf, sizeof(z_buf), "<%s,%s,%s>", class, inst, recipient); |
| 123 | z_buf[sizeof(z_buf)-1] = '\0'; |
| 124 | return z_buf; |
| 125 | } |
| 126 | |
| 127 | static const char * |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 128 | str_to_lower(const char *string) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 129 | { |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 130 | char *zb_string; |
| 131 | |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 132 | strncpy(z_buf, string, sizeof(z_buf)); |
| 133 | z_buf[sizeof(z_buf)-1] = '\0'; |
| 134 | |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 135 | zb_string = z_buf; |
| 136 | while (*zb_string) { |
| 137 | *zb_string = tolower((unsigned char)(*zb_string)); |
| 138 | zb_string++; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 139 | } |
| 140 | |
| 141 | return z_buf; |
| 142 | } |
| 143 | |
| 144 | void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 145 | zephyr_print(netdissect_options *ndo, const u_char *cp, int length) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 146 | { |
| 147 | struct z_packet z; |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 148 | const char *parse = (const char *) cp; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 149 | int parselen = length; |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 150 | const char *s; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 151 | int lose = 0; |
Elliott Hughes | cec480a | 2017-12-19 16:54:57 -0800 | [diff] [blame] | 152 | int truncated = 0; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 153 | |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 154 | /* squelch compiler warnings */ |
| 155 | |
| 156 | z.kind = 0; |
| 157 | z.class = 0; |
| 158 | z.inst = 0; |
| 159 | z.opcode = 0; |
| 160 | z.sender = 0; |
| 161 | z.recipient = 0; |
| 162 | |
Elliott Hughes | cec480a | 2017-12-19 16:54:57 -0800 | [diff] [blame] | 163 | #define PARSE_STRING \ |
| 164 | s = parse_field(ndo, &parse, &parselen, &truncated); \ |
| 165 | if (truncated) goto trunc; \ |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 166 | if (!s) lose = 1; |
| 167 | |
| 168 | #define PARSE_FIELD_INT(field) \ |
| 169 | PARSE_STRING \ |
| 170 | if (!lose) field = strtol(s, 0, 16); |
| 171 | |
| 172 | #define PARSE_FIELD_STR(field) \ |
| 173 | PARSE_STRING \ |
| 174 | if (!lose) field = s; |
| 175 | |
| 176 | PARSE_FIELD_STR(z.version); |
| 177 | if (lose) return; |
| 178 | if (strncmp(z.version, "ZEPH", 4)) |
| 179 | return; |
| 180 | |
| 181 | PARSE_FIELD_INT(z.numfields); |
| 182 | PARSE_FIELD_INT(z.kind); |
| 183 | PARSE_FIELD_STR(z.uid); |
| 184 | PARSE_FIELD_INT(z.port); |
| 185 | PARSE_FIELD_INT(z.auth); |
| 186 | PARSE_FIELD_INT(z.authlen); |
| 187 | PARSE_FIELD_STR(z.authdata); |
| 188 | PARSE_FIELD_STR(z.class); |
| 189 | PARSE_FIELD_STR(z.inst); |
| 190 | PARSE_FIELD_STR(z.opcode); |
| 191 | PARSE_FIELD_STR(z.sender); |
| 192 | PARSE_FIELD_STR(z.recipient); |
| 193 | PARSE_FIELD_STR(z.format); |
| 194 | PARSE_FIELD_INT(z.cksum); |
| 195 | PARSE_FIELD_INT(z.multi); |
| 196 | PARSE_FIELD_STR(z.multi_uid); |
| 197 | |
Elliott Hughes | cec480a | 2017-12-19 16:54:57 -0800 | [diff] [blame] | 198 | if (lose) |
| 199 | goto trunc; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 200 | |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 201 | ND_PRINT((ndo, " zephyr")); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 202 | if (strncmp(z.version+4, "0.2", 3)) { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 203 | ND_PRINT((ndo, " v%s", z.version+4)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 204 | return; |
| 205 | } |
| 206 | |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 207 | ND_PRINT((ndo, " %s", tok2str(z_types, "type %d", z.kind))); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 208 | if (z.kind == Z_PACKET_SERVACK) { |
| 209 | /* Initialization to silence warnings */ |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 210 | const char *ackdata = NULL; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 211 | PARSE_FIELD_STR(ackdata); |
| 212 | if (!lose && strcmp(ackdata, "SENT")) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 213 | ND_PRINT((ndo, "/%s", str_to_lower(ackdata))); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 214 | } |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 215 | if (*z.sender) ND_PRINT((ndo, " %s", z.sender)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 216 | |
| 217 | if (!strcmp(z.class, "USER_LOCATE")) { |
| 218 | if (!strcmp(z.opcode, "USER_HIDE")) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 219 | ND_PRINT((ndo, " hide")); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 220 | else if (!strcmp(z.opcode, "USER_UNHIDE")) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 221 | ND_PRINT((ndo, " unhide")); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 222 | else |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 223 | ND_PRINT((ndo, " locate %s", z.inst)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 224 | return; |
| 225 | } |
| 226 | |
| 227 | if (!strcmp(z.class, "ZEPHYR_ADMIN")) { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 228 | ND_PRINT((ndo, " zephyr-admin %s", str_to_lower(z.opcode))); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 229 | return; |
| 230 | } |
| 231 | |
| 232 | if (!strcmp(z.class, "ZEPHYR_CTL")) { |
| 233 | if (!strcmp(z.inst, "CLIENT")) { |
| 234 | if (!strcmp(z.opcode, "SUBSCRIBE") || |
| 235 | !strcmp(z.opcode, "SUBSCRIBE_NODEFS") || |
| 236 | !strcmp(z.opcode, "UNSUBSCRIBE")) { |
| 237 | |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 238 | ND_PRINT((ndo, " %ssub%s", strcmp(z.opcode, "SUBSCRIBE") ? "un" : "", |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 239 | strcmp(z.opcode, "SUBSCRIBE_NODEFS") ? "" : |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 240 | "-nodefs")); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 241 | if (z.kind != Z_PACKET_SERVACK) { |
| 242 | /* Initialization to silence warnings */ |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 243 | const char *c = NULL, *i = NULL, *r = NULL; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 244 | PARSE_FIELD_STR(c); |
| 245 | PARSE_FIELD_STR(i); |
| 246 | PARSE_FIELD_STR(r); |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 247 | if (!lose) ND_PRINT((ndo, " %s", z_triple(c, i, r))); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 248 | } |
| 249 | return; |
| 250 | } |
| 251 | |
| 252 | if (!strcmp(z.opcode, "GIMME")) { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 253 | ND_PRINT((ndo, " ret")); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 254 | return; |
| 255 | } |
| 256 | |
| 257 | if (!strcmp(z.opcode, "GIMMEDEFS")) { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 258 | ND_PRINT((ndo, " gimme-defs")); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 259 | return; |
| 260 | } |
| 261 | |
| 262 | if (!strcmp(z.opcode, "CLEARSUB")) { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 263 | ND_PRINT((ndo, " clear-subs")); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 264 | return; |
| 265 | } |
| 266 | |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 267 | ND_PRINT((ndo, " %s", str_to_lower(z.opcode))); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 268 | return; |
| 269 | } |
| 270 | |
| 271 | if (!strcmp(z.inst, "HM")) { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 272 | ND_PRINT((ndo, " %s", str_to_lower(z.opcode))); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 273 | return; |
| 274 | } |
| 275 | |
| 276 | if (!strcmp(z.inst, "REALM")) { |
| 277 | if (!strcmp(z.opcode, "ADD_SUBSCRIBE")) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 278 | ND_PRINT((ndo, " realm add-subs")); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 279 | if (!strcmp(z.opcode, "REQ_SUBSCRIBE")) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 280 | ND_PRINT((ndo, " realm req-subs")); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 281 | if (!strcmp(z.opcode, "RLM_SUBSCRIBE")) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 282 | ND_PRINT((ndo, " realm rlm-sub")); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 283 | if (!strcmp(z.opcode, "RLM_UNSUBSCRIBE")) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 284 | ND_PRINT((ndo, " realm rlm-unsub")); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 285 | return; |
| 286 | } |
| 287 | } |
| 288 | |
| 289 | if (!strcmp(z.class, "HM_CTL")) { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 290 | ND_PRINT((ndo, " hm_ctl %s", str_to_lower(z.inst))); |
| 291 | ND_PRINT((ndo, " %s", str_to_lower(z.opcode))); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 292 | return; |
| 293 | } |
| 294 | |
| 295 | if (!strcmp(z.class, "HM_STAT")) { |
| 296 | if (!strcmp(z.inst, "HMST_CLIENT") && !strcmp(z.opcode, "GIMMESTATS")) { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 297 | ND_PRINT((ndo, " get-client-stats")); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 298 | return; |
| 299 | } |
| 300 | } |
| 301 | |
| 302 | if (!strcmp(z.class, "WG_CTL")) { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 303 | ND_PRINT((ndo, " wg_ctl %s", str_to_lower(z.inst))); |
| 304 | ND_PRINT((ndo, " %s", str_to_lower(z.opcode))); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 305 | return; |
| 306 | } |
| 307 | |
| 308 | if (!strcmp(z.class, "LOGIN")) { |
| 309 | if (!strcmp(z.opcode, "USER_FLUSH")) { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 310 | ND_PRINT((ndo, " flush_locs")); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 311 | return; |
| 312 | } |
| 313 | |
| 314 | if (!strcmp(z.opcode, "NONE") || |
| 315 | !strcmp(z.opcode, "OPSTAFF") || |
| 316 | !strcmp(z.opcode, "REALM-VISIBLE") || |
| 317 | !strcmp(z.opcode, "REALM-ANNOUNCED") || |
| 318 | !strcmp(z.opcode, "NET-VISIBLE") || |
| 319 | !strcmp(z.opcode, "NET-ANNOUNCED")) { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 320 | ND_PRINT((ndo, " set-exposure %s", str_to_lower(z.opcode))); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 321 | return; |
| 322 | } |
| 323 | } |
| 324 | |
| 325 | if (!*z.recipient) |
| 326 | z.recipient = "*"; |
| 327 | |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 328 | ND_PRINT((ndo, " to %s", z_triple(z.class, z.inst, z.recipient))); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 329 | if (*z.opcode) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 330 | ND_PRINT((ndo, " op %s", z.opcode)); |
Elliott Hughes | cec480a | 2017-12-19 16:54:57 -0800 | [diff] [blame] | 331 | return; |
| 332 | |
| 333 | trunc: |
| 334 | ND_PRINT((ndo, " [|zephyr] (%d)", length)); |
| 335 | return; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 336 | } |