1 /* packet-assa_r3.c
2  * Routines for R3 packet dissection
3  * Copyright (c) 2009 Assa Abloy USA <jcwren[AT]assaabloyusa.com>
4  *
5  * R3 is an electronic lock management protocol for configuring operational
6  *  parameters, adding/removing/altering users, dumping log files, etc.
7  *
8  * Wireshark - Network traffic analyzer
9  * By Gerald Combs <gerald@wireshark.org>
10  * Copyright 1998 Gerald Combs
11  *
12  * SPDX-License-Identifier: GPL-2.0-or-later
13  */
14 
15 #include "config.h"
16 
17 #include <epan/packet.h>
18 #include <epan/expert.h>
19 #include <epan/range.h>
20 #include <epan/crc16-tvb.h>
21 #include "packet-tcp.h"
22 
23 void proto_register_r3(void);
24 void proto_reg_handoff_r3(void);
25 
26 #if 0
27 /* */
28 /*  System limits */
29 /* */
30 #define MAX_USERS            2400
31 #define MAX_TIMEZONES          32
32 #define MAX_EXCEPTIONS         64
33 #define MAX_EXCEPTIONGROUPS    64
34 #define MAX_EVENTENTRIES    10000
35 #define MAX_DECLINEDENTRIES   500
36 #define MAX_ALARMENTRIES      200
37 #endif
38 
39 /*
40  *  Enumerations
41  */
42 typedef enum
43 {
44   ACCESSMODE_NONE = 0,        /* 0 - No access mode (not used, not legal, I think) */
45   ACCESSMODE_PRIMARYONLY,     /* 1 - Primary only */
46   ACCESSMODE_PRIMARYORAUX,    /* 2 - Primary or aux field */
47   ACCESSMODE_PRIMARYANDAUX,   /* 3 - Primary and aux field */
48   ACCESSMODE_PRIMARYTHENAUX,  /* 4 - Primary required first, then aux */
49   ACCESSMODE_LAST             /* 5 - Dummy, for range checking */
50 }
51 accessMode_e;
52 
53 typedef enum
54 {
55   ADDUSERPARAMTYPE_DISPOSITION = 0,   /*  0 - What we're supposed to do (add, delete, etc) */
56   ADDUSERPARAMTYPE_USERNO,            /*  1 - User to manage (user number, U16) */
57   ADDUSERPARAMTYPE_ACCESSALWAYS,      /*  2 - Access always (boolean) */
58   ADDUSERPARAMTYPE_ACCESSMODE,        /*  3 - Access type (accessMode_e) */
59   ADDUSERPARAMTYPE_CACHED,            /*  4 - Entry is managed by cache system (boolean) */
60   ADDUSERPARAMTYPE_USERTYPE,          /*  5 - User type (userType_e) */
61   ADDUSERPARAMTYPE_PRIMARYFIELD,      /*  6 - Primary field (MAX_CREDENTIALBYTES) */
62   ADDUSERPARAMTYPE_PRIMARYFIELDTYPE,  /*  7 - Primary field type (fieldType_e); */
63   ADDUSERPARAMTYPE_AUXFIELD,          /*  8 - Auxiliary field (MAX_CREDENTIALBYTES) */
64   ADDUSERPARAMTYPE_AUXFIELDTYPE,      /*  9 - Auxiliary field type (fieldType_e) */
65   ADDUSERPARAMTYPE_TIMEZONE,          /* 10 - Timezone bitmap (U32) */
66   ADDUSERPARAMTYPE_EXPIREON,          /* 11 - Date on which user no longer granted access, if non-0 */
67   ADDUSERPARAMTYPE_USECOUNT,          /* 12 - Use count */
68   ADDUSERPARAMTYPE_EXCEPTIONGROUP,    /* 13 - Exception group */
69   ADDUSERPARAMTYPE_LAST
70 }
71 addUserParamType_e;
72 
73 typedef enum
74 {
75   ALARMID_NONE = 0,       /* 0 - No alarm */
76   ALARMID_VALIDIN,        /* 1 - Valid entry */
77   ALARMID_DENIEDACCESS,   /* 2 - Denied access (bad credential) */
78   ALARMID_SECURED,        /* 3 - Door closed & secured (only seen after alarms 3 or 4) */
79   ALARMID_DOORFORCED,     /* 4 - Door forced */
80   ALARMID_KEYOVERRIDE,    /* 5 - Key override */
81   ALARMID_INVALIDENTRY,   /* 6 - Door open but invalid entry (key used?) */
82   ALARMID_DOORAJAR,       /* 7 - Door ajar (needs .ja woman with Engrish accent) */
83   ALARMID_LOWBATTERY,     /* 8 - Low battery alarm */
84   ALARMID_RXHELD,         /* 9 - RX held */
85   ALARMID_LAST
86 }
87 alarmID_e;
88 
89 typedef enum
90 {
91   CAPABILITIES_USERS = 0,         /* 0 - Number of users supported */
92   CAPABILITIES_TIMEZONES,         /* 1 - Number of timezone supported */
93   CAPABILITIES_EXCEPTIONS,        /* 2 - Number of exceptions supported */
94   CAPABILITIES_EXCEPTIONGROUPS,   /* 3 - Number of exception groups supported */
95   CAPABILITIES_EVENTLOG,          /* 4 - Number of event log entries supported */
96   CAPABILITIES_DECLINEDLOG,       /* 5 - Number of declined log entries supported */
97   CAPABILITIES_ALARMLOG,          /* 6 - Number of alarm log entries supported */
98   CAPABILITIES_TOTALEVENTS,       /* 7 - Total events (EVENT_LAST - 1) */
99   CAPABILITIES_LAST
100 }
101 capabilities_e;
102 
103 typedef enum
104 {
105   CHECKSUMRESULT_CONFIGURATIONNVRAM = 0,  /*  0 - Checksum results of the configuration NVRAM */
106   CHECKSUMRESULT_EXCEPTIONS,              /*  1 - Checksum results of the exceptions NVRAM */
107   CHECKSUMRESULT_EXCEPTIONGROUPS,         /*  2 - Checksum results of the exception groups NVRAM */
108   CHECKSUMRESULT_TZCALENDARS,             /*  3 - Checksum results of the time zone calendar NVRAM */
109   CHECKSUMRESULT_TIMEZONES,               /*  4 - Checksum results of the time zone NVRAM */
110   CHECKSUMRESULT_USERS,                   /*  5 - Checksum results of the users NVRAM */
111   CHECKSUMRESULT_CACHELRU,                /*  6 - Checksum results of the cache LRU */
112   CHECKSUMRESULT_LAST
113 }
114 checksumResult_e;
115 
116 typedef enum
117 {
118   CMD_RESPONSE = 0,               /*  0 - Response to command */
119   CMD_HANDSHAKE,                  /*  1 - Establish session */
120   CMD_KILLSESSION,                /*  2 - Kill session */
121   CMD_QUERYSERIALNUMBER,          /*  3 - Query serial number */
122   CMD_QUERYVERSION,               /*  4 - Query version */
123   CMD_SETDATETIME,                /*  5 - Set date and time */
124   CMD_QUERYDATETIME,              /*  6 - Query date and time */
125   CMD_SETCONFIG,                  /*  7 - Set configuration options */
126   CMD_GETCONFIG,                  /*  8 - Read configuration options  */
127   CMD_MANAGEUSER,                 /*  9 - Manage users (add/delete/replace/update) */
128   CMD_DELETEUSERS,                /* 10 - Delete users (all/most/cached) */
129   CMD_DEFINEEXCEPTION,            /* 11 - Define exception (old block holiday) */
130   CMD_DEFINEEXCEPTIONGROUP,       /* 12 - Define exception group */
131   CMD_DEFINECALENDAR,             /* 13 - Define calendar */
132   CMD_DEFINETIMEZONE,             /* 14 - Define time zone */
133   CMD_RMTAUTHRETRY,               /* 15 - Remote authorization retry */
134   CMD_FILTERS,                    /* 16 - Event log filter configuration */
135   CMD_ALARMCONFIGURE,             /* 17 - Alarm condition configuration */
136   CMD_EVENTLOGDUMP,               /* 18 - Dump event log */
137   CMD_DECLINEDLOGDUMP,            /* 19 - Dump declined log */
138   CMD_ALARMLOGDUMP,               /* 20 - Dump alarm log */
139   CMD_DOWNLOADFIRMWARE,           /* 21 - Download firmware */
140   CMD_DOWNLOADFIRMWARETIMEOUT,    /* 22 - Download firmware timeout (internal command only) */
141   CMD_POWERTABLESELECTION,        /* 23 - Power table selection */
142   CMD_CLEARNVRAM,                 /* 24 - Clear nvram (config/event log/declined log/etc) */
143   CMD_DPAC,                       /* 25 - DPAC manipulation commands */
144   CMD_SELFTEST,                   /* 26 - Selftest (heh) */
145   CMD_RESET,                      /* 27 - Restart controller */
146   CMD_LOGWRITE,                   /* 28 - Write event to event log */
147   CMD_MFGCOMMAND,                 /* 29 - Manufacturing commands */
148   CMD_NVRAMBACKUP,                /* 30 - Backup/restore/erase NVRAM */
149   CMD_EXTENDEDRESPONSE,           /* 31 - Response to command (extended version) */
150   CMD_LAST
151 }
152 cmdCommand_e;
153 
154 typedef enum
155 {
156   CMDMFG_SETSERIALNUMBER = 0,   /*  0 - Set serial number */
157   CMDMFG_SETCRYPTKEY,           /*  1 - Set encryption key */
158   CMDMFG_DUMPNVRAM,             /*  2 - Dump NVRAM */
159   CMDMFG_TERMINAL,              /*  3 - DPAC terminal mode */
160   CMDMFG_REMOTEUNLOCK,          /*  4 - Remote unlock (only on 'd' builds) */
161   CMDMFG_AUXCTLRVERSION,        /*  5 - Request version of auxiliary controller */
162   CMDMFG_IOPINS,                /*  6 - Read I/O pin states */
163   CMDMFG_ADCS,                  /*  7 - Read ADC values */
164   CMDMFG_HARDWAREID,            /*  8 - Read hardware ID and CPU ID */
165   CMDMFG_CHECKPOINTLOGDUMP,     /*  9 - Dump checkpoint log */
166   CMDMFG_CHECKPOINTLOGCLEAR,    /* 10 - Clear checkpoint log */
167   CMDMFG_READREGISTERS,         /* 11 - Read selected CPU registers */
168   CMDMFG_FORCEOPTIONS,          /* 12 - Force I/O lines to certain states */
169   CMDMFG_COMMUSER,              /* 13 - Fake a comm user entry */
170   CMDMFG_DUMPKEYPAD,            /* 14 - Dump keypad debugging buffer */
171   CMDMFG_BATTERYCHECK,          /* 15 - Force battery check */
172   CMDMFG_RAMREFRESH,            /* 16 - Refresh RAM variables from NVRAM */
173   CMDMFG_TASKFLAGS,             /* 17 - Dump task flags */
174   CMDMFG_TIMERCHAIN,            /* 18 - Dump active timer chains */
175   CMDMFG_PEEKPOKE,              /* 19 - Peek/poke CPU RAM memory */
176   CMDMFG_LOCKSTATE,             /* 20 - Display global gLockState variable */
177   CMDMFG_CAPABILITIES,          /* 21 - Read firmware capabilities (# users/event log entries, etc) */
178   CMDMFG_DUMPM41T81,            /* 22 - Dump M41T81 RTC registers */
179   CMDMFG_DEBUGLOGDUMP,          /* 23 - Dump debugging log */
180   CMDMFG_DEBUGLOGCLEAR,         /* 24 - Clear debugging log */
181   CMDMFG_TESTWDT,               /* 25 - Test watchdog */
182   CMDMFG_QUERYCKSUM,            /* 26 - Query NVRAM checksum value */
183   CMDMFG_VALIDATECHECKSUMS,     /* 27 - Validate checksums */
184   CMDMFG_REBUILDLRUCACHE,       /* 28 - Rebuild LRC cache */
185   CMDMFG_TZUPDATE,              /* 29 - Send TZCHANGE to tod.c */
186   CMDMFG_TESTPRESERVE,          /* 30 - Test preserve save/restore code */
187   CMDMFG_MORTISESTATELOGDUMP,   /* 31 - Dump the mortise state log */
188   CMDMFG_MORTISESTATELOGCLEAR,  /* 32 - Clear the mortise state log */
189   CMDMFG_MORTISEPINS,           /* 33 - Display current mortise pin status */
190   CMDMFG_HALTANDCATCHFIRE,      /* 34 - Stop processor (optionally catch fire) */
191   CMDMFG_LAST
192 }
193 cmdMfgCommand_e;
194 
195 typedef enum
196 {
197   CONFIGITEM_SERIAL_NUMBER = 0,           /*    0 - Ye olde serial number */
198   CONFIGITEM_CRYPT_KEY,                   /*    1 - The encryption/decryption key */
199   CONFIGITEM_HARDWARE_OPTIONS_MFG,        /*    2 - Bit map of hardware options at manufacturing time (hardwareOptions_e) */
200   CONFIGITEM_HARDWARE_OPTIONS,            /*    3 - Bit map of hardware options at runtime time (hardwareOptions_e) */
201   CONFIGITEM_NVRAM_CHANGES,               /*    4 - Log of NVRAM changes since reset (which blocks were reset) */
202 
203   CONFIGITEM_NVRAMDIRTY,                  /*    5 - NVRAM is (or might be) dirty */
204   CONFIGITEM_NVRAM_WV,                    /*    6 - NVRAM write verify (I2C parts only) */
205   CONFIGITEM_ENABLE_WDT,                  /*    7 - If true, and OPT_WATCHDOG enabled, enables WDT */
206   CONFIGITEM_EARLY_ACK,                   /*    8 - Generates early RESPONSE_COMMANDRECEIVED message for commands that take some time */
207   CONFIGITEM_CONSOLE_AES_ONLY,            /*    9 - If set, requires AES encryption on serial communications */
208   CONFIGITEM_RADIO_AES_ONLY,              /*   10 - If set, requires AES encryption on radio communications */
209   CONFIGITEM_NDRLE,                       /*   11 - RLE (Run Length Encoding) NVRAM dump enable/disable */
210   CONFIGITEM_SOMF,                        /*   12 - Stop on mortise failure */
211   CONFIGITEM_NOGAF,                       /*   13 - Prevents what should be fatal errors from being fatal (i.e, No One Gives A Flip) */
212   CONFIGITEM_CARD_READER_POWER,           /*   14 - External mag reader power supply control */
213   CONFIGITEM_PROX_ENABLE,                 /*   15 - Prox into permanent sleep mode */
214   CONFIGITEM_CKSUMCONFIG,                 /*   16 - Configuration NVRAM checksum enable/disable  */
215   CONFIGITEM_DAILY_BATTERY_CHECK,         /*   17 - Enable/disable daily battery check */
216   CONFIGITEM_DAILY_BATTERY_CHECK_HOUR,    /*   18 - If daily battery check enabled, top of the hour to check at */
217   CONFIGITEM_BATTERY_LOW,                 /*   19 - Return low battery status (TRUE = low) */
218 
219   CONFIGITEM_LRU_HEAD,                    /*   20 - Cache LRU head pointer */
220   CONFIGITEM_LRU_TAIL,                    /*   21 - Cache LRU tail pointer */
221   CONFIGITEM_RTC_CALIBRATION,             /*   22 - Signed 6 bit value written to M41T81 calibration register */
222   CONFIGITEM_ACVREQUESTER,                /*   23 - Auxiliary controller version requester (fromDevice_e, internal variable) */
223   CONFIGITEM_LOCAL_LED,                   /*   24 - Local LED function assignment */
224 
225   CONFIGITEM_ERRCNT_XORLEN,               /*   25 - Error counter for XOR length not matching in protocol.c */
226   CONFIGITEM_ERRCNT_CRC,                  /*   26 - Error counter for bad CRC in protocol.c */
227   CONFIGITEM_ERRCNT_NOTSIGIL,             /*   27 - Error counter for character received was not sigil in protocol.c */
228   CONFIGITEM_ERRCNT_TIMEOUT,              /*   28 - Error counter for timeout in protocol.c */
229   CONFIGITEM_ERRCNT_TOOLONG,              /*   29 - Error counter for packet too long in protocol.c */
230   CONFIGITEM_ERRCNT_TOOSHORT,             /*   30 - Error counter for packet too short in protocol.c */
231   CONFIGITEM_ERRCNT_HITDEFAULT,           /*   31 - Error counter for hitting default handler in protocol.c */
232   CONFIGITEM_ERRCNT_OVERRUN,              /*   32 - Error counter for serial buffer overrun in serial.c */
233   CONFIGITEM_ERRCNT_UARTFE,               /*   33 - Error counter for UART framing error in serial.c */
234   CONFIGITEM_ERRCNT_UARTOE,               /*   34 - Error counter for UART overrun error in serial.c */
235 
236   CONFIGITEM_DST_SET,                     /*   35 - Daylight savings time currently active */
237   CONFIGITEM_DST_MODE,                    /*   36 - Determines if repeating month/date, repeating month/day, or specific month/date (dstMode_e) */
238   CONFIGITEM_DST_FORWARD_MONTH,           /*   37 - Month to skip forward on (1-12) (DSTMODE_REPEATINGDATE, DSTMODE_REPEATINGDOW, DSTMODE_ONETIMEDATE) */
239   CONFIGITEM_DST_FORWARD_DOM,             /*   38 - Day of month to skip forward on (1-31) (DSTMODE_REPEATINGDATE, DSTMODE_ONETIMEDATE) */
240   CONFIGITEM_DST_FORWARD_OOD,             /*   39 - Occurrence number of CONFIGITEM_DST_FORWARD_DOW to skip forward on (1-5)  (DSTMODE_REPEATINGDOW) */
241   CONFIGITEM_DST_FORWARD_DOW,             /*   40 - Day of week to skip forward on (1-7) (DSTMODE_REPEATINGDOW) */
242   CONFIGITEM_DST_FORWARD_HOUR,            /*   41 - Hour of day of month to skip forward on (0-23) (DSTMODE_REPEATINGDATE, DSTMODE_REPEATINGDOW, DSTMODE_ONETIMEDATE) */
243   CONFIGITEM_DST_FORWARD_MINUTE,          /*   42 - Hour of day of month to skip forward on (0-23) (DSTMODE_REPEATINGDATE, DSTMODE_REPEATINGDOW, DSTMODE_ONETIMEDATE) */
244   CONFIGITEM_DST_FORWARD_ADJUST,          /*   43 - Number of minutes to move forward */
245   CONFIGITEM_DST_BACK_MONTH,              /*   44 - Month to fall back on (1-12) (DSTMODE_REPEATINGDATE, DSTMODE_REPEATINGDAY, DSTMODE_ONETIMEDATE) */
246   CONFIGITEM_DST_BACK_DOM,                /*   45 - Day of month to fall back on (1-31) (DSTMODE_REPEATINGDATE, DSTMODE_ONETIMEDATE) */
247   CONFIGITEM_DST_BACK_OOD,                /*   46 - Occurrence number of CONFIGITEM_DST_BACK_DOW to fall back on (1-5)  (DSTMODE_REPEATINGDOW) */
248   CONFIGITEM_DST_BACK_DOW,                /*   47 - Day of week to fall back on (1-7) (DSTMODE_REPEATINGDATE, DSTMODE_ONETIMEDATE) */
249   CONFIGITEM_DST_BACK_HOUR,               /*   48 - Hour of day of month to fall back on (0-23) (DSTMODE_REPEATINGDATE, DSTMODE_REPEATINGDOW, DSTMODE_ONETIMEDATE) */
250   CONFIGITEM_DST_BACK_MINUTE,             /*   49 - Hour of day of month to fall back on (0-23) (DSTMODE_REPEATINGDATE, DSTMODE_REPEATINGDOW, DSTMODE_ONETIMEDATE) */
251   CONFIGITEM_DST_BACK_ADJUST,             /*   50 - Number of minutes to move backwards */
252 
253   CONFIGITEM_EVENTLOG_ZEROMEM,            /*   51 - If set, event log memory is zeroed when event log cleared */
254   CONFIGITEM_EVENTLOG_BEGIN,              /*   52 - Beginning record number when event log cleared */
255   CONFIGITEM_EVENTLOG_RECORD,             /*   53 - Next event log record to write */
256   CONFIGITEM_EVENTLOG_ENTRIES,            /*   54 - Number of entries in event log */
257   CONFIGITEM_EVENTLOG_WARNDEVICE,         /*   55 - Event log warning device */
258   CONFIGITEM_EVENTLOG_WARNEVERY,          /*   56 - Warn at every 'n' records (more or less) */
259   CONFIGITEM_EVENTLOG_RMTDEVICE,          /*   57 - Device event log entries copied to (fromDevice_e) */
260 
261   CONFIGITEM_DECLINEDLOG_ZEROMEM,         /*   58 - If set, declined log memory is zeroed when declined log cleared */
262   CONFIGITEM_DECLINEDLOG_BEGIN,           /*   59 - Beginning record number when declined log cleared */
263   CONFIGITEM_DECLINEDLOG_RECORD,          /*   60 - Next declined log record to write */
264   CONFIGITEM_DECLINEDLOG_ENTRIES,         /*   61 - Number of entries in declined log */
265   CONFIGITEM_DECLINEDLOG_WARNDEVICE,      /*   62 - Declined record warning device */
266   CONFIGITEM_DECLINEDLOG_WARNEVERY,       /*   63 - Warn at every 'n' records (more or less) */
267   CONFIGITEM_DECLINEDLOG_RMTDEVICE,       /*   64 - Device declined entries copied to (fromDevice_e) */
268 
269   CONFIGITEM_ALARMLOG_ZEROMEM,            /*   65 - If set, alarm log memory is zeroed when alarm log cleared */
270   CONFIGITEM_ALARMLOG_BEGIN,              /*   66 - Beginning record number when alarm log cleared */
271   CONFIGITEM_ALARMLOG_RECORD,             /*   67 - Next alarm log record to write */
272   CONFIGITEM_ALARMLOG_ENTRIES,            /*   68 - Number of entries in alarm log */
273   CONFIGITEM_ALARMLOG_WARNDEVICE,         /*   69 - Alarm record warning device */
274   CONFIGITEM_ALARMLOG_WARNEVERY,          /*   70 - Warn at every 'n' records (more or less) */
275   CONFIGITEM_ALARMLOG_RMTDEVICE,          /*   71 - Device alarm entries copied to (fromDevice_e) */
276 
277   CONFIGITEM_VISIBLE_FEEDBACK,            /*   72 - Visible feedback on keypad presses enabled */
278   CONFIGITEM_AUDIBLE_FEEDBACK,            /*   73 - Audible feedback on keypad presses enabled */
279   CONFIGITEM_VISIBLE_INDICATORS,          /*   74 - Visible indicators on all actions (run dark) */
280   CONFIGITEM_AUDIBLE_INDICATORS,          /*   75 - Audible indicators on all actions (run silent) */
281   CONFIGITEM_2NDPINDURATION,              /*   76 - Number of seconds to wait for second PIN */
282   CONFIGITEM_LOCKOUT_ATTEMPTS,            /*   77 - Number of pin/prox/magcard attempts before lockout */
283   CONFIGITEM_LOCKOUT_DURATION,            /*   78 - Duration of lockout, in penta-seconds */
284   CONFIGITEM_KEYPAD_INACTIVITY,           /*   79 - Duration in seconds with no key entries before key buffer cleared */
285   CONFIGITEM_ICIDLE_DURATION,             /*   80 - If last credential was invalid, invalid attempt counter reset after this many seconds */
286   CONFIGITEM_WRITE_DECLINED_LOG,          /*   81 - Declined log writing enable/disable */
287   CONFIGITEM_LOW_BATTERY_INDICATOR,       /*   82 - Low battery audio/visual indicator enable/disable */
288 
289   CONFIGITEM_PANIC_MODE,                  /*   83 - Enable/disable panic mode */
290 
291   CONFIGITEM_TIMEZONE_ENABLE,             /*   84 - Timezones enabled (applies to users, not passage modes) */
292   CONFIGITEM_EXCEPTION_ENABLE,            /*   85 - Exceptions enabled (applies to users and passage modes) */
293   CONFIGITEM_AUTOUNLOCK_ENABLE,           /*   86 - Auto-unlocking (schedule based) enabled */
294 
295   CONFIGITEM_LOCK_PRIORITY_EMERGENCY,     /*   87 - DPAC/PWM lock priority for emergency users (lockPriority_e) */
296   CONFIGITEM_LOCK_PRIORITY_SUPERVISOR,    /*   88 - DPAC/PWM lock priority for supervisors (lockPriority_e) */
297   CONFIGITEM_LOCK_PRIORITY_USER,          /*   89 - DPAC/PWM lock priority for users (lockPriority_e) */
298   CONFIGITEM_LOCK_PRIORITY_PASSAGE,       /*   90 - DPAC/PWM lock priority for passage mode (lockPriority_e) */
299   CONFIGITEM_LOCK_PRIORITY_PANIC,         /*   91 - DPAC/PWM lock priority for panic mode/panic users (lockPriority_e) */
300   CONFIGITEM_LOCK_PRIORITY_LOCKOUT,       /*   92 - DPAC/PWM lock priority for remote unlock (lockPriority_e) */
301   CONFIGITEM_LOCK_PRIORITY_RELOCK,        /*   93 - DPAC/PWM lock priority for remote unlock (lockPriority_e) */
302   CONFIGITEM_LOCK_PRIORITY_BOLTTHROWN,    /*   94 - DPAC/PWM lock priority for bolt thrown (lockPriority_e) */
303   CONFIGITEM_LOCK_PRIORITY_CONFIGCHANGE,  /*   95 - DPAC/PWM lock priority for configuration change (CONFIGITEM_LOCK_TYPE) (lockPriority_e) */
304   CONFIGITEM_LOCK_PRIORITY_REMOTE,        /*   96 - DPAC/PWM lock priority for remote unlock (lockPriority_e) */
305   CONFIGITEM_LOCK_TYPE,                   /*   97 - Type of lock (PWM, electric, magnetic) */
306   CONFIGITEM_DOUBLE_PULSE,                /*   98 - Lock double pulse enabled */
307   CONFIGITEM_DOUBLE_DELAY,                /*   99 - Delay between double pulses, in centiseconds */
308   CONFIGITEM_MOTOR_DURATION,              /*  100 - Duration lock motor to run, in centiseconds */
309   CONFIGITEM_MORTISE_TYPE,                /*  101 - Type of mortise connected to controller */
310   CONFIGITEM_UNLOCK_TIME,                 /*  102 - Normal unlock duration  in seconds */
311   CONFIGITEM_EXT_UNLOCK_TIME,             /*  103 - Extended unlock duration, in seconds */
312   CONFIGITEM_DOOR_AJAR_TIME,              /*  104 - Time before door considered stuck open, in seconds */
313 
314   CONFIGITEM_SESSION_TIMEOUT,             /*  105 - Session timeout, in seconds */
315   CONFIGITEM_RETRY_ON_TIMEOUT,            /*  106 - Retry lock-initiated sessions if comm session timed out (instead of terminated by remote end) */
316 
317   CONFIGITEM_UNSOLICITED_ENCRYPT,         /*  107 - Unsolicited messages are encrypted (encryptionScheme_e) */
318   CONFIGITEM_RMT_AUTH_TIMEOUT,            /*  108 - Seconds to wait for remote authorization timeout (0 = no remote auth) */
319   CONFIGITEM_RMT_AUTH_DEVICE,             /*  109 - Device remote authorization requests sent over (fromDevice_e) */
320   CONFIGITEM_ALARM_DEVICE,                /*  110 - Device alarm condition connects via */
321   CONFIGITEM_NOTIFY_DEVICE,               /*  111 - Notify user device */
322   CONFIGITEM_COMMUSER_DEVICE,             /*  112 - Device comm user connects via */
323   CONFIGITEM_SCHEDULER_DEVICE,            /*  113 - Device scheduler connects via */
324 
325   CONFIGITEM_SCHEDULER_TYPE,              /*  114 - Scheduling algorithm to use (schedulerType_e) */
326   CONFIGITEM_SCHEDULER_AWAKE,             /*  115 - Number of decaseconds scheduler is awake for */
327   CONFIGITEM_SCHEDULER_PERIOD,            /*  116 - Interval in minutes between scheduled wakeups (SCHEDULERTYPE_SIMPLE) */
328   CONFIGITEM_SCHEDULER_HOD,               /*  117 - Hour of day map (SCHEDULERTYPE_HOD) */
329   CONFIGITEM_SCHEDULER_DOW,               /*  118 - Day of month map (SCHEDULERTYPE_DOW) */
330   CONFIGITEM_SCHEDULER_DOM,               /*  119 - Day of month map (SCHEDULERTYPE_DOM) */
331   CONFIGITEM_SCHEDULER_HM1,               /*  120 - On at hour:minute #1 */
332   CONFIGITEM_SCHEDULER_HM2,               /*  121 - On at hour:minute #2 */
333   CONFIGITEM_SCHEDULER_HM3,               /*  122 - On at hour:minute #3 */
334   CONFIGITEM_SCHEDULER_HM4,               /*  123 - On at hour:minute #4 */
335 
336   CONFIGITEM_RADIO_TYPE,                  /*  124 - Radio type (None, DPAC, WiPort, etc) */
337   CONFIGITEM_RADIO_MODE,                  /*  125 - Radio mode (DPAC=active/passive) */
338   CONFIGITEM_RADIO_TIMEOUT,               /*  126 - Number of seconds before we decide server didn't hear us (only in RADIOMODE_LOCKINITIATED) */
339   CONFIGITEM_RADIO_ATTEMPTS,              /*  127 - Number of times to attempt connection to server (only in RADIOMODE_LOCKINITIATED) */
340   CONFIGITEM_RADIO_HOUSEKEEPING,          /*  128 - Time we allow for radio housekeeping (associate with AP, etc) */
341   CONFIGITEM_RADIO_LEAPUSERNAME,          /*  129 - LEAP username */
342   CONFIGITEM_RADIO_LEAPPASSWORD,          /*  130 - LEAP password */
343 
344   CONFIGITEM_INHIBIT_VOLTAGE,             /*  131 - Voltage when battery is considered dead */
345   CONFIGITEM_LOW_VOLTAGE,                 /*  132 - Voltage when battery is considered low */
346   CONFIGITEM_PT_RANGE_1,                  /*  133 - Power table for 0.00 to 5.99 volts */
347   CONFIGITEM_PT_RANGE_2,                  /*  134 - Power table for 6.00 to 6.49 volts */
348   CONFIGITEM_PT_RANGE_3,                  /*  135 - Power table for 6.50 to 6.99 volts */
349   CONFIGITEM_PT_RANGE_4,                  /*  136 - Power table for 7.00 to 7.49 volts */
350   CONFIGITEM_PT_RANGE_5,                  /*  137 - Power table for 7.50 to 7.99 volts */
351   CONFIGITEM_PT_RANGE_6,                  /*  138 - Power table for 8.00 to 8.49 volts */
352   CONFIGITEM_PT_RANGE_7,                  /*  139 - Power table for 8.50 to 8.99 volts */
353   CONFIGITEM_PT_RANGE_8,                  /*  140 - Power table for 9.00 and up volts */
354 
355   CONFIGITEM_MAGCARD_IFS,                 /*  141 - Include field separator character in returned data */
356   CONFIGITEM_MAGCARD_FIELDS,              /*  142 - Mag card fields to include */
357   CONFIGITEM_MAGCARD_OFFSET,              /*  143 - Offset into concatenated field */
358   CONFIGITEM_MAGCARD_DIGITS,              /*  144 - Number of digits to return past offset */
359 
360   CONFIGITEM_ALARMS,                      /*  145 - Alarms (not writable) */
361   CONFIGITEM_FILTERS,                     /*  146 - Event filter storage (not writable) */
362   CONFIGITEM_ALARMSTATE,                  /*  147 - Current alarm state (alarmID_e) */
363   CONFIGITEM_DOORSTATE,                   /*  148 - Current door state (doorState_e) */
364 
365   CONFIGITEM_DPACDEBUG,                   /*  149 - Enable DPAC debug events to event log */
366   CONFIGITEM_FAILOPENSECURE,              /*  150 - Fail open (false) or secure (true) on battery dead */
367 
368   CONFIGITEM_REPLACED_VOLTAGE,            /*  151 - If battery above this voltage, it's been replaced */
369 
370   CONFIGITEM_RX_HELD_TIME,                /*  152 - If RX held longer than this, sent RX held alarm */
371   CONFIGITEM_PACKET_TIMEOUT,              /*  153 - Time (in seconds) that a complete packet must arrive in */
372 
373   CONFIGITEM_EXTENDEDRESPONSE,            /*  154 - Enables extended response (which includes original sequence number) */
374   CONFIGITEM_PASSAGEMODEINDICATOR,        /*  155 - When lock in passage mode, LEDs show denied if set, granted if cleared (Squish #1133) */
375 
376   CONFIGITEM_PFMRETURNTIME,               /*  156 - Number of seconds power must be present to exit power fail death loop */
377 
378   CONFIGITEM_LAST                          /*  Must be last item defined (All non-virtual items added above) */
379 
380 #if 0 /* XXX: unused ? */
381   ,
382   CONFIGITEM_MAGIC_FIRST = 239,           /*  Next item is first magic command */
383   CONFIGITEM_MAGIC_USERFIELD,             /*  240 - Virtual command to delete PIN '8989', add user '8989' */
384   CONFIGITEM_MAGIC_USERADD,               /*  241 - Virtual command to add a user (PIN only) */
385   CONFIGITEM_MAGIC_USERDELETE,            /*  242 - Virtual command to delete a user */
386   CONFIGITEM_MAGIC_NVRAMBACKUP,           /*  243 - Virtual command to backup NVRAM to FLASH */
387   CONFIGITEM_MAGIC_NVRAMRESTORE,          /*  244 - Virtual command to restore NVRAM from FLASH */
388   CONFIGITEM_MAGIC_NVRAMERASE,            /*  245 - Virtual command to erase backed-up NVRAM */
389   CONFIGITEM_MAGIC_LAST                   /*  *Really* the last item */
390 #endif
391 }
392 configItem_e;
393 
394 typedef enum
395 {
396   DELETEUSERS_ALL = 0,    /* 0 - Delete ALL users, including master and emergency, restores default users */
397   DELETEUSERS_CACHED,     /* 1 - Delete only cached users */
398   DELETEUSERS_LAST
399 }
400 deleteUsers_e;
401 
402 typedef enum
403 {
404   DISPOSITION_ADD = 0,    /* 0 - Add, must not exist (by user number only) */
405   DISPOSITION_REPLACE,    /* 1 - Replace, (add, but overwrite if necessary) */
406   DISPOSITION_UPDATE,     /* 2 - Update, must already exist */
407   DISPOSITION_DELETE,     /* 3 - Delete, exists or not is irrelevant */
408   DISPOSITION_RETRIEVE,   /* 4 - Retrieve, must exist */
409   DISPOSITION_LAST
410 }
411 disposition_e;
412 
413 #if 0
414 typedef enum
415 {
416   DOORSTATE_NONE = 0,       /* 0 - No door state available */
417   DOORSTATE_SECURED,        /* 1 - Door closed & secured */
418   DOORSTATE_DOORFORCED,     /* 2 - Door forced */
419   DOORSTATE_KEYOVERRIDE,    /* 3 - Key override */
420   DOORSTATE_DOORAJAR,       /* 4 - Door ajar  */
421   DOORSTATE_LAST
422 }
423 doorState_e;
424 #endif
425 
426 #if 0
427 typedef enum
428 {
429   DSTMODE_NONE,           /* 0 - Automatic DST switching disabled */
430   DSTMODE_REPEATINGDOM,   /* 1 - Particular day on a particular month (Apr 2nd) */
431   DSTMODE_REPEATINGDOW,   /* 2 - Day of week on a particular week of a particular month (Sunday of last week of April) */
432   DSTMODE_ONETIMEDOM,     /* 3 - Like DSTMODE_REPEATINGDOM, but clears CONFIGITEM_DST_[FORWARD|BACK][MONTH|DAY] items */
433   DSTMODE_ONETIMEDOW,     /* 4 - Like DSTMODE_REPEATINGDOW, but clears CONFIGITEM_DST_[FORWARD|BACK][MONTH|OOD|DOW] items */
434   DSTMODE_LAST
435 }
436 dstMode_e;
437 #endif
438 
439 typedef enum
440 {
441   ENCRYPTIONSCHEME_NONE = 0,  /* 0 - No encryption */
442   ENCRYPTIONSCHEME_ROLLING,   /* 1 - XOR with crypt key, shift each byte */
443   ENCRYPTIONSCHEME_SN,        /* 2 - XOR with serial number, shift each byte */
444   ENCRYPTIONSCHEME_AESIV,     /* 3 - AES implementation (set initial vector) */
445   ENCRYPTIONSCHEME_AES,       /* 4 - AES implementation */
446   ENCRYPTIONSCHEME_LAST
447 }
448 encryptionScheme_e;
449 
450 typedef enum
451 {
452   EVENT_INVALIDPIN = 0,       /*   0 - Entered PIN was invalid */
453   EVENT_USER,                 /*   1 - Regular user has been granted access */
454   EVENT_ONETIME,              /*   2 - One-time user has been granted access */
455   EVENT_PASSAGEBEGIN,         /*   3 - Lock has unlocked because of auto-unlock mode */
456   EVENT_PASSAGEEND,           /*   4 - Lock has relocked because of auto-unlock mode */
457   EVENT_BADTIME,              /*   5 - Access attempted outside of allowed time/date */
458   EVENT_LOCKEDOUT,            /*   6 - Access attempted during panic or lockout */
459   EVENT_LOWBATTERY,           /*   7 - Battery is low */
460   EVENT_DEADBATTERY,          /*   8 - Battery is dead */
461   EVENT_BATTERYREPLACED,      /*   9 - Battery has been replaced */
462   EVENT_USERADDED,            /*  10 - User added or changed */
463   EVENT_USERDELETED,          /*  11 - User deleted */
464   EVENT_EMERGENCY,            /*  12 - The emergency code was entered */
465   EVENT_PANIC,                /*  13 - Somebody pushed the panic button */
466   EVENT_RELOCK,               /*  14 - Relock code was entered */
467   EVENT_LOCKOUTBEGIN,         /*  15 - Lockout code was entered */
468   EVENT_LOCKOUTEND,           /*  16 - Lockout code was entered again */
469   EVENT_RESET,                /*  17 - Lock was reset (restarted) */
470   EVENT_DATETIMESET,          /*  18 - System date & time was set */
471   EVENT_LOGCLEARED,           /*  19 - Event log cleared */
472   EVENT_DBRESET,              /*  20 - User database reset */
473   EVENT_COMMSTARTED,          /*  21 - Communications session started */
474   EVENT_COMMENDED,            /*  22 - Communications session ended */
475   EVENT_FIRMWAREABORT,        /*  23 - A firmware update aborted */
476   EVENT_FIRMWAREERROR,        /*  24 - A firmware update encountered an error */
477   EVENT_FIRMWARETIMEOUT,      /*  25 - Timeout expecting firmware download data record */
478   EVENT_DSTFALLBACK,          /*  26 - Clock set back */
479   EVENT_DSTSPRINGFORWARD,     /*  27 - Clock set forward */
480   EVENT_BOLTTHROWN,           /*  28 - Bolt thrown */
481   EVENT_BOLTRETRACTED,        /*  29 - Bolt retracted */
482   EVENT_MASTERCODE,           /*  30 - Master code entered (clears panic, relock, and lockout) */
483   EVENT_COMMUSER,             /*  31 - A comm user was activated */
484   EVENT_DPACDISABLED,         /*  32 - DPAC disabled */
485   EVENT_NOTIFY,               /*  33 - Notify user has been granted access */
486   EVENT_EXPIRED,              /*  34 - Expired user attempted access */
487   EVENT_SUPERVISOR,           /*  35 - The supervisor code was entered */
488   EVENT_MCCENTER,             /*  36 - Entered MCC programming mode */
489   EVENT_MCCEXIT,              /*  37 - Exited MCC programming mode */
490   EVENT_SERIALRXOVERRUN,      /*  38 - Serial receiver overrun */
491   EVENT_DPACRXOVERRUN,        /*  39 - DPAC receiver overrun */
492   EVENT_NVRAMPBCLEAR,         /*  40 - NVRAM cleared by pushybutton */
493   EVENT_NVRAMLAYOUTCHANGE,    /*  41 - NVRAM cleared by revision */
494   EVENT_NVRAMOK,              /*  42 - NVRAM wasn't changed */
495   EVENT_USERREPLACED,         /*  43 - User replaced */
496   EVENT_RADIOTIMEOUT,         /*  44 - Radio timed out waiting for remote login */
497   EVENT_SUSPENDEDUSER,        /*  45 - Suspended user attempted access */
498   EVENT_USERUPDATED,          /*  46 - User updated */
499   EVENT_DOORBOLTED,           /*  47 - Access denied because door is bolted */
500   EVENT_PANICACTIVE,          /*  48 - Access denied because lock is in panic mode */
501   EVENT_PASSAGEACTIVE,        /*  49 - Access denied because lock is in passage mode */
502   EVENT_PASSAGEINACTIVE,      /*  50 - Access denied because lock is not in passage mode */
503   EVENT_BADACCESSMODE,        /*  51 - Access denied because access mode is weird */
504   EVENT_CLOCKERR,             /*  52 - Error reading RTC */
505   EVENT_REMOTEUNLOCK,         /*  53 - Remote unlock */
506   EVENT_TZHAUDISABLED,        /*  54 - Time zone, exceptions, and auto-unlock functionality disabled */
507   EVENT_EVENTLOGWRAPPED,      /*  55 - Event log wrapped */
508   EVENT_DECLINEDLOGWRAPPED,   /*  56 - Declined log wrapped */
509   EVENT_ALARMLOGWRAPPED,      /*  57 - Alarm log wrapped */
510   EVENT_RADIOBUSYEMERGENCY,   /*  58 - Access denied because radio is busy */
511   EVENT_RADIOBUSYSUPERVISOR,  /*  59 - Access denied because radio is busy */
512   EVENT_RADIOBUSYONETIME,     /*  60 - Access denied because radio is busy */
513   EVENT_RADIOBUSYUSER,        /*  61 - Access denied because radio is busy */
514   EVENT_RADIOBUSYPANIC,       /*  62 - Access denied because radio is busy */
515   EVENT_RADIOBUSYREX,         /*  63 - Access denied because radio is busy */
516   EVENT_RADIOBUSYLOCKOUT,     /*  64 - Access denied because radio is busy */
517   EVENT_RADIOBUSYRELOCK,      /*  65 - Access denied because radio is busy */
518   EVENT_BATTERYCHECKHELDOFF,  /*  66 - Battery check was not performed (user number says why) */
519   EVENT_RMTAUTHREQUEST,       /*  67 - Remote authorization request made */
520   EVENT_FIRMWAREUPDATE,       /*  68 - A firmware update was attempted, and succeeded */
521   EVENT_FIRMWAREUPDATEFAILED, /*  69 - A firmware update was attempted, and failed */
522   EVENT_MSMFAILURE,           /*  70 - Mortise state machine failure */
523   EVENT_CLOCKRESET,           /*  71 - The RTC was reset, likely due to ESD */
524   EVENT_POWERFAIL,            /*  72 - Power Fail Monitor (PFM) circuit triggered */
525   EVENT_DPAC501WENTSTUPID,    /*  73 - DPAC-501 failed to release CTS on power up */
526   /*
527    * These are all internal debugging events.  Real events should go before these.
528    */
529   EVENT_CHECKSUMCONFIG,       /*  74 - Performing checksum on configuration NVRAM */
530   EVENT_CHECKSUMTZ,           /*  75 - Performing checksum on timezone data NVRAM */
531   EVENT_DEBUG,                /*  76 - Debug event, could mean anything (programmer discretion) */
532   EVENT_LAST                  /*  77 - Everything must go before this entry */
533 }
534 event_e;
535 
536 typedef enum
537 {
538   FIELDTYPE_NONE = 0,   /* 0 - Field contains nothing */
539   FIELDTYPE_PIN,        /* 1 - Field contains PIN */
540   FIELDTYPE_PROX,       /* 2 - Field contains Prox card */
541   FIELDTYPE_MAGCARD,    /* 3 - Field contains mag card */
542   FIELDTYPE_LAST
543 }
544 fieldType_e;
545 
546 #if 0
547 typedef enum
548 {
549   FILTERMODE_NORMAL = 0,  /* 0 - Filters events specified */
550   FILTERMODE_INVERT,      /* 1 - Filters events not specified */
551   FILTERMODE_LAST
552 }
553 filterMode_e;
554 #endif
555 
556 typedef enum
557 {
558   FILTERSELECT_RECORDING = 0,   /* 0 - Recording filters */
559   FILTERSELECT_REPORTING,       /* 1 - Reporting filters */
560   FILTERSELECT_LAST
561 }
562 filterSelect_e;
563 
564 
565 /* XXX: enum vals don't all match vals in comments ??? */
566 typedef enum
567 {
568   FORCEITEM_RADIOPOWER = 0,   /*  0 - Radio power */
569   FORCEITEM_RADIOENABLE,      /*  1 - Radio enable */
570   FORCEITEM_LEDRED,           /*  2 - Red keypad LED */
571   FORCEITEM_LEDGREEN,         /*  3 - Green keypad LED */
572   FORCEITEM_LEDYELLOW,        /*  4 - Yellow keypad LED */
573   FORCEITEM_PIEZO,            /*  5 - Keypad peizo */
574   FORCEITEM_MAGPOWER,         /*  6 - Mag card reader power supply */
575   FORCEITEM_MAGLEDA,          /*  7 - Mag card LED A (usually red) */
576   FORCEITEM_MAGLEDB,          /*  8 - Mag card LED B (usually green) */
577   FORCEITEM_PROXPOWER,        /* 13 - Prox circuitry power (opamps, etc) */
578   FORCEITEM_PROXPING,         /* 14 - Prox PIC12F629 ping/sleep mode */
579   FORCEITEM_PROXMODE,         /* 15 - Prox ping/read mode (selects 50hz/125KHz filters) */
580   FORCEITEM_I2CPOWER,         /* 16 - I2C power */
581   FORCEITEM_MOTORARUN,        /* 17 - Motor A run (to H-bridge) */
582   FORCEITEM_MOTORBRUN,        /* 18 - Motor B run (to H-bridge) */
583   FORCEITEM_VMON,             /* 19 - VMon (ADC 0 battery sense) */
584   FORCEITEM_PROX,             /* 20 - Prox test mode (continuous 125KHz read) */
585   FORCEITEM_MORTISETEST,      /* 21 - Force mortise into test mode */
586   FORCEITEM_KEYPADTEST,       /* 22 - Force keypad into test mode */
587   FORCEITEM_MAGTEST,          /* 23 - Force mag card test mode */
588   FORCEITEM_PROXTEST,         /* 24 - Force prox card test mode */
589   FORCEITEM_ICLASSPOWER,      /* 25 - iClass Prox power */
590   FORCEITEM_ICLASSRESET,      /* 26 - iClass Prox reset */
591   FORCEITEM_LAST
592 }
593 forceItem_e;
594 
595 typedef enum
596 {
597   FROMDEVICE_NONE = 0,      /* 0 - Used to indicate no device */
598   FROMDEVICE_INTERNAL,      /* 1 - Generated internally */
599   FROMDEVICE_KEYPAD,        /* 2 - Generated from keypad */
600   FROMDEVICE_CONSOLE,       /* 3 - Generated from console */
601   FROMDEVICE_WIFI,          /* 4 - Generated from wi-fi (DPAC) */
602   FROMDEVICE_LAST
603 }
604 fromDevice_e;
605 
606 #if 0
607 typedef enum
608 {
609   HARDWAREOPTIONS_NONE         = 0x0000,   /* No options installed (?!) */
610   HARDWAREOPTIONS_CLOCK        = 0x0001,   /* Has RTC installed (always set) */
611   HARDWAREOPTIONS_CONSOLE      = 0x0002,   /* Has serial console (always set) */
612   HARDWAREOPTIONS_KEYPAD       = 0x0004,   /* Has keypad installed */
613   HARDWAREOPTIONS_PROXREADER   = 0x0008,   /* Has Prox card circuitry installed */
614   HARDWAREOPTIONS_MAGREADER    = 0x0010,   /* Has magnetic card reader attached */
615   HARDWAREOPTIONS_1WIRE        = 0x0020,   /* Has Dallas 1-wire interface installed */
616   HARDWAREOPTIONS_WIFI         = 0x0040,   /* Has WiFi module installed (DPAC only, for now) */
617   HARDWAREOPTIONS_RS485        = 0x0080,   /* Has RS-485 optioning (RS-232 assumed if not) */
618   HARDWAREOPTIONS_IR           = 0x0100,   /* Has IR LED communications interface installed */
619   HARDWAREOPTIONS_PUSHBUTTON   = 0x0200,   /* Has MCC pushbutton */
620   HARDWAREOPTIONS_WATCHDOG     = 0x0400,   /* Has watchdog option compiled in */
621   HARDWAREOPTIONS_ICLASSREADER = 0x0800,   /* Has iClass OEM75 prox reader installed */
622   HARDWAREOPTIONS_AVAIL1000    = 0x1000,   /* Not defined */
623   HARDWAREOPTIONS_AVAIL2000    = 0x2000,   /* Not defined */
624   HARDWAREOPTIONS_AVAIL4000    = 0x4000,   /* Not defined */
625   HARDWAREOPTIONS_AVAIL8000    = 0x8000,   /* Not defined */
626 
627   HARDWAREOPTIONS_RADIO        = (HARDWAREOPTIONS_WIFI),
628 
629   HARDWAREOPTIONS_LAST         = 0xffff    /* Place holder, don't use */
630 }
631 hardwareOptions_e;
632 #endif
633 
634 #if 0
635 typedef enum
636 {
637   LOCALLED_NONE = 0,      /*  0 - No assignment */
638   LOCALLED_RADIOPOWER,    /*  1 - Follows radio power supply (lit=power on) */
639   LOCALLED_LOCKUNLOCKED,  /*  2 - Follows strike state (lit=locked) */
640   LOCALLED_I2CPOWER,      /*  3 - Follows I2C power (lit=power on) */
641   LOCALLED_AUTHCONSOLE,   /*  4 - Follows authorization from console port (lit=authorized) */
642   LOCALLED_AUTHWIFI,      /*  5 - Follows authorization from Wifi port (lit=authorized) */
643   LOCALLED_BATTERYLOW,    /*  6 - Follows battery low status (lit=low) */
644   LOCALLED_BATTERYDEAD,   /*  7 - Follows battery dead status (lit=battery dead) */
645   LOCALLED_PROXREADY,     /*  8 - Follows Prox ready to read (lit=ready) */
646   LOCALLED_APACQUIRED,    /*  9 - Follows WAP acquired via DPAC (lit=acquired) */
647   LOCALLED_PASSMODE,      /* 10 - Follows DPAC entering pass mode (lit=pass mode successful) */
648   LOCALLED_PROXREAD,      /* 11 - Follows receiving a prox read event (PROXCARDEVENT_READCARD) */
649   LOCALLED_CONNECTED,     /* 12 - Follows the DPAC interrupt line, indicating connection status */
650   LOCALLED_DPACCTSTIMER,  /* 13 - Follows DPAC CTS line, if asserted more than 5 seconds */
651   LOCALLED_PFMCHARGING,   /* 14 - Follows the state of the PFM super-cap charger */
652   LOCALLED_LAST
653 }
654 localLED_e;
655 #endif
656 
657 #if 0
658 typedef enum
659 {
660   LOCKPRIORITY_NONE = 0,      /* 0 - Radio is not shut down for motor run, access not denied if radio is on */
661   LOCKPRIORITY_DPAC,          /* 1 - Radio is not shut down for motor run, access denied if radio is on */
662   LOCKPRIORITY_LOCK,          /* 2 - Radio is shut down for motor run, access not denied if radio is on */
663   LOCKPRIORITY_LAST
664 }
665 lockPriority_e;
666 #endif
667 
668 #if 0
669 typedef enum
670 {
671   LOCKTYPE_NONE = 0,          /* 0 - No lock present */
672   LOCKTYPE_PWM,               /* 1 - PWM motor */
673   LOCKTYPE_ELECTRIC_STRIKE,   /* 2 - Electric strike (normally de-energized, uses Motor A side of H-bridge) */
674   LOCKTYPE_MAGNETIC_LOCK,     /* 3 - Magnetic lock (normally energized, uses Motor A side of H-bridge) */
675   LOCKTYPE_RELAY,             /* 4 - Relay (normally de-energized, uses Motor B side of H-bridge) */
676   LOCKTYPE_LAST
677 }
678 lockType_e;
679 #endif
680 
681 typedef enum
682 {
683   MFGFIELD_IOPINS = 0,            /*  0 - Contains data about the state of the IO pins */
684   MFGFIELD_ADCS,                  /*  1 - Contains raw ADC data */
685   MFGFIELD_HARDWAREID,            /*  2 - Contains hardware ID & revision of PIC */
686   MFGFIELD_CHECKPOINTLOG,         /*  3 - Contains the checkpoint log data */
687   MFGFIELD_CPUREGISTERS,          /*  4 - Contains the contents of selected PIC registers */
688   MFGFIELD_TASKFLAGS,             /*  5 - Contains a list of all task flag values */
689   MFGFIELD_TIMERCHAIN,            /*  6 - Contains a complete list of all active timers (timerData_t) */
690   MFGFIELD_PEEKPOKE,              /*  7 - Contains results of peeking memory (U8, U16, U32, or string) */
691   MFGFIELD_LOCKSTATE,             /*  8 - Contains the current passage mode flags (lockState_t) */
692   MFGFIELD_CAPABILITIES,          /*  9 - Contains lock capability info (# users, event log entries, etc) */
693   MFGFIELD_DUMPM41T81,            /* 10 - Contains a complete dump of the M41T81 RTC registers */
694   MFGFIELD_NVRAMCHECKSUMVALUE,    /* 11 - Contains the 32-bit NVRAM checksum value */
695   MFGFIELD_CHECKSUMRESULTS,       /* 12 - Contains results from checksumming exceptions, exceptiong roups, time zone calendars and time zones */
696   MFGFIELD_MORTISESTATELOG,       /* 13 - Contains the last 32 mortise state changes */
697   MFGFIELD_MORTISEPINS,           /* 14 - Contains the mortise pin status (S1,S2,S3,S4) */
698   MFGFIELD_KEYPADCHAR,            /* 15 - Contains a character from the keypad */
699   MFGFIELD_MAGCARD,               /* 16 - Contains mag card data */
700   MFGFIELD_PROXCARD,              /* 17 - Contains prox card data */
701   MFGFIELD_LAST
702 }
703 mfgField_e;
704 
705 typedef enum
706 {
707   MORTISETYPE_NONE = 0,           /*  0 - No mortise installed */
708   MORTISETYPE_S82276,             /*  1 - Sargent 82276 mortise (A) */
709   MORTISETYPE_S82277,             /*  2 - Sargent 82277 mortise, no cylinder (B) */
710   MORTISETYPE_S82278,             /*  3 - Sargent 82278 mortise, no deadbolt (C) */
711   MORTISETYPE_S82279,             /*  4 - Sargent 82279 mortise, no cylinder or deadbolt (D) */
712   MORTISETYPE_S10G77,             /*  5 - Sargent 10G77 bored lock body (E) */
713   MORTISETYPE_S8877,              /*  6 - Sargent 8877 mortise exit device (F) */
714   MORTISETYPE_S8878,              /*  7 - Sargent 8878 mortise exit device, no cylinder (G) */
715   MORTISETYPE_S8977,              /*  8 - Sargent 8977 mortise exit device (H) */
716   MORTISETYPE_S8978,              /*  9 - Sargent 8978 mortise exit device, no cylinder (I) */
717   MORTISETYPE_CRML20x36,          /* 10 - Corbin-Russwin ML20736/ML20836 mortise (J) */
718   MORTISETYPE_CRML20x35,          /* 11 - Corbin-Russwin ML20735/ML20835 mortise, no cylinder (K) */
719   MORTISETYPE_CRML20x34,          /* 12 - Corbin-Russwin ML20734/ML20834 mortise, no deadbolt (L) */
720   MORTISETYPE_CRML20x33,          /* 13 - Corbin-Russwin ML20733/ML20833 mortise, no cylinder or deadbolt (M) */
721   MORTISETYPE_CRCL33x34,          /* 14 - Corbin-Russwin CL33734/CL33834 bored lock body (N) */
722   MORTISETYPE_CR9X34,             /* 15 - Corbin-Russwin 9734/9834 bored lock body (O) */
723   MORTISETYPE_CR9X33,             /* 16 - Corbin-Russwin 9833/9833 bored lock body, no cylinder (P) */
724   MORTISETYPE_CR9MX34,            /* 17 - Corbin-Russwin 9M734/9M834 bored lock body (Q) */
725   MORTISETYPE_CR9MX33,            /* 18 - Corbin-Russwin 9M733/9M833 bored lock body, no cylinder (R) */
726   MORTISETYPE_LAST
727 }
728 mortiseType_e;
729 
730 #if 0
731 typedef enum
732 {
733   NVRAMCLEAROPTIONS_NONE            = 0x0000,   /* Place holder */
734   NVRAMCLEAROPTIONS_CFGINSTALLER    = 0x0001,   /* Options settable by the installer (lock type, etc) */
735   NVRAMCLEAROPTIONS_CFGADMIN        = 0x0002,   /* Options settable by the lock administrator (time, date, etc) */
736   NVRAMCLEAROPTIONS_EXCEPTIONS      = 0x0004,   /* The exceptions definitions */
737   NVRAMCLEAROPTIONS_EXCEPTIONGROUPS = 0x0008,   /* The exception group definitions */
738   NVRAMCLEAROPTIONS_CALENDARS       = 0x0010,   /* The timezones calendar definitions */
739   NVRAMCLEAROPTIONS_TIMEZONES       = 0x0020,   /* The timezones definitions */
740   NVRAMCLEAROPTIONS_FILTERS         = 0x0040,   /* Recording filters */
741   NVRAMCLEAROPTIONS_EVENTLOG        = 0x0080,   /* The event log */
742   NVRAMCLEAROPTIONS_USERDATA        = 0x0100,   /* The actual user database */
743   NVRAMCLEAROPTIONS_DECLINEDLOG     = 0x0200,   /* Declined credentials log */
744   NVRAMCLEAROPTIONS_ALARMLOG        = 0x0400,   /* Alarm log */
745   NVRAMCLEAROPTIONS_LRUCACHE        = 0x0800,   /* LRU cache for remote authorization (status, user doesn't clear explicitly) */
746   NVRAMCLEAROPTIONS_DBHASH          = 0x1000,   /* User database hash (status, user doesn't clear explicitly) */
747   NVRAMCLEAROPTIONS_CFGSYSTEM       = 0x2000,   /* Factory settable options, system variables (status, user doesn't clear explicitly) */
748   NVRAMCLEAROPTIONS_AVAIL4000       = 0x4000,   /* Unused */
749   NVRAMCLEAROPTIONS_ALL             = 0x7fff,   /* All of the above */
750   NVRAMCLEAROPTIONS_USEBACKUP       = 0x8000    /* If set, installer and admin options are set according from NVRAM backup (if valid) */
751 }
752 nvramClearOptions_e;
753 #endif
754 
755 #if 0
756 typedef enum
757 {
758   NVRAMCOMMAND_BACKUP = 0,  /* 0 - Backup NVRAM to backup region */
759   NVRAMCOMMAND_ERASE,       /* 1 - Erase backup region */
760   NVRAMCOMMAND_RESTORE,     /* 2 - Restore NVRAM from backup region */
761   NVRAMCOMMAND_LAST
762 }
763 nvramCommand_e;
764 #endif
765 
766 #if 0
767 typedef enum
768 {
769   NVRAMDUMPSELECT_ALL = 0,  /* 0 - Dump all */
770   NVRAMDUMPSELECT_PIC,      /* 1 - Dump NVRAM on PIC */
771   NVRAMDUMPSELECT_USER,     /* 2 - Dump I2C NVRAM containing user data, exceptions, exception groups, calendars, timezones */
772   NVRAMDUMPSELECT_EVENT,    /* 3 - Dump I2C NVRAM containing event log, declined log, alarm log, LRU cache */
773   NVRAMDUMPSELECT_LAST
774 }
775 nvramDumpSelect_e;
776 #endif
777 
778 typedef enum
779 {
780   PEEKPOKE_READU8 = 0,      /* 0 - Read 8 bit value */
781   PEEKPOKE_READU16,         /* 1 - Read 16 bit value */
782   PEEKPOKE_READU24,         /* 2 - Read 24 bit value */
783   PEEKPOKE_READU32,         /* 3 - Read 32 bit value */
784   PEEKPOKE_READSTRING,      /* 4 - Read 'n' 8 bit values */
785   PEEKPOKE_WRITEU8,         /* 5 - Write 8 bit value */
786   PEEKPOKE_WRITEU16,        /* 6 - Write 16 bit value */
787   PEEKPOKE_WRITEU24,        /* 7 - Write 24 bit value */
788   PEEKPOKE_WRITEU32,        /* 8 - Write 32 bit value */
789   PEEKPOKE_WRITESTRING,     /* 9 - Write 'n' 8 bit values */
790   PEEKPOKE_LAST
791 }
792 peekPoke_e;
793 
794 typedef enum
795 {
796   PPMISOURCE_NONE = 0,     /* 0 - PPMI came from nowhere (not set) */
797   PPMISOURCE_PIN,          /* 1 - PPMI came from PIN */
798   PPMISOURCE_PROX,         /* 2 - PPMI came from Prox */
799   PPMISOURCE_MAGCARD,      /* 3 - PPMI came from mag card */
800   PPMISOURCE_LAST
801 }
802 ppmiSource_e;
803 
804 #if 0
805 typedef enum
806 {
807   RADIOMODE_HOSTINITIATED = 0,  /* 0 - DPAC in listen mode (default) */
808   RADIOMODE_LOCKINITIATED,      /* 1 - DPAC in pass-through mode */
809   RADIOMODE_LAST
810 }
811 radioMode_e;
812 #endif
813 
814 #if 0
815 typedef enum
816 {
817   RADIOTYPE_NONE = 0,     /* 0 - No radio present */
818   RADIOTYPE_WIPORTNR,     /* 1 - WiPortNR */
819   RADIOTYPE_DPAC80211B,   /* 2 - DPAC 802.11b */
820   RADIOTYPE_DPAC80211BG,  /* 3 - DPAC 802.11bg */
821   RADIOTYPE_LAST
822 }
823 radioType_e;
824 #endif
825 
826 typedef enum
827 {
828   RESPONSETYPE_OK = 0,                /*  0 - All is well */
829   RESPONSETYPE_ERROR,                 /*  1 - Generic error */
830   RESPONSETYPE_HASDATA,               /*  2 - Response has data */
831   RESPONSETYPE_NOHANDLER,             /*  3 - Command requested with no handler (internal error) */
832   RESPONSETYPE_NOSESSION,             /*  4 - No session established */
833   RESPONSETYPE_BADCOMMAND,            /*  5 - Bad command value */
834   RESPONSETYPE_BADPARAMETER,          /*  6 - Bad parameter (can mean a lot of things) */
835   RESPONSETYPE_BADPARAMETERLEN,       /*  7 - Bad parameter length (too short, too long) */
836   RESPONSETYPE_MISSINGPARAMETER,      /*  8 - Missing parameter (something was required, what'd you forget?) */
837   RESPONSETYPE_DUPLICATEPARAMETER,    /*  9 - Parameter supplied more than once (D'oh!) */
838   RESPONSETYPE_PARAMETERCONFLICT,     /* 10 - Parameters conflict (usually mutually exclusive items) */
839   RESPONSETYPE_BADDEVICE,             /* 11 - Bad device (command came from a device that's not allowed) */
840   RESPONSETYPE_NVRAMERROR,            /* 12 - Hardware problem... */
841   RESPONSETYPE_NVRAMERRORNOACK,       /* 13 - Hardware problem... */
842   RESPONSETYPE_NVRAMERRORNOACK32,     /* 14 - Hardware problem... */
843   RESPONSETYPE_NOTI2CADDRESS,         /* 15 - Illegal I2C address in i2cStart */
844   RESPONSETYPE_FIRMWAREERROR,         /* 16 - Generic firmware upload error (can mean lots of things) */
845   RESPONSETYPE_DUMPINPROGRESS,        /* 17 - Can't do something, a dump is in progress */
846   RESPONSETYPE_INTERNALERROR,         /* 18 - Something Bad Happened(tm) */
847   RESPONSETYPE_NOTIMPLEMENTED,        /* 19 - Command or function not implemented */
848   RESPONSETYPE_PINFORMATERROR,        /* 20 - Error in formatting of PIN (non hex character) */
849   RESPONSETYPE_PINEXISTS,             /* 21 - PIN already exists in database */
850   RESPONSETYPE_PINNOTFOUND,           /* 22 - PIN wasn't found (actionManageUsers) */
851   RESPONSETYPE_USERACTIVE,            /* 23 - The record for this user is active (not deleted or free) */
852   RESPONSETYPE_USERINACTIVE,          /* 24 - The record for this user is inactive (not in use) */
853   RESPONSETYPE_PARENTNOTFOUND,        /* 25 - Users parent couldn't be found (used internally by dbmgr.c) */
854   RESPONSETYPE_NOCHAIN,               /* 26 - No users in chain (used internally by dbmgr.c) */
855   RESPONSETYPE_CAUGHTINLOOP,          /* 27 - Caught in a loop somewhere */
856   RESPONSETYPE_EVENTFILTERED,         /* 28 - Event record was filtered (eventlog.c) */
857   RESPONSETYPE_PAYLOADTOOLARGE,       /* 29 - Message payload too large (protocol.c) */
858   RESPONSETYPE_ENDOFDATA,             /* 30 - No more data (used internally by eventlog.c) */
859   RESPONSETYPE_RMTAUTHREJECTED,       /* 31 - Remote authorization rejected (lockmgr.c) */
860   RESPONSETYPE_NVRAMVERSIONERROR,     /* 32 - NVRAM version doesn't match expected value */
861   RESPONSETYPE_NOHARDWARE,            /* 33 - Operation requested for unsupported hardware */
862   RESPONSETYPE_SCHEDULERCONFLICT,     /* 34 - Scheduler not in correct mode for this operation */
863   RESPONSETYPE_NVRAMWRITEERROR,       /* 35 - NVRAM write compare error */
864   RESPONSETYPE_DECLINEDFILTERED,      /* 36 - Declined record was filtered (declinedlog.c) */
865   RESPONSETYPE_NECONFIGPARM,          /* 37 - Non-existent configuration parameter */
866   RESPONSETYPE_FLASHERASEERROR,       /* 38 - Error erasing FLASH */
867   RESPONSETYPE_FLASHWRITEERROR,       /* 39 - Error writing FLASH */
868   RESPONSETYPE_BADNVBACKUP,           /* 40 - NVBackup length doesn't match sizeof (configParametersNV_t) */
869   RESPONSETYPE_EARLYACK,              /* 41 - Sent prior to long commands if CONFIGITEM_EARLYACK set */
870   RESPONSETYPE_ALARMFILTERED,         /* 42 - Alarm record was filtered (alarm.c) */
871   RESPONSETYPE_ACVFAILURE,            /* 43 - Auxiliary controller version request failure */
872   RESPONSETYPE_USERCHECKSUMERROR,     /* 44 - User checksum value error */
873   RESPONSETYPE_CHECKSUMERROR,         /* 45 - Generic checksum error  */
874   RESPONSETYPE_RTCSQWFAILURE,         /* 46 - RTC isn't generating square wave */
875   RESPONSETYPE_PRIORITYSHUTDOWN,      /* 47 - Session terminated early because lock has priority over communications */
876   RESPONSETYPE_NOTMODIFIABLE,         /* 48 - Configuration parameter is not user modifiable */
877   RESPONSETYPE_CANTPRESERVE,          /* 49 - Can't preserve configuration (config.c, not enough space) */
878   RESPONSETYPE_INPASSAGEMODE,         /* 50 - Lock is in passage mode, can't do remote unlock */
879   RESPONSETYPE_LAST
880 #if 0
881   ,
882   /*
883    *  These should not be exposed to the user
884    */
885   RESPONSETYPE_NOREPLY,               /* 51 - Do not send a reply, subroutine is posting its own */
886   RESPONSETYPE_TAKEABREAK,            /* 52 - Intermediate return result, when log searches taking too long */
887   RESPONSETYPE_DPACBLOCKS,            /* 53 - PWM lock, battery powered, DPAC takes priority */
888   RESPONSETYPE_ACKNAKTIMEOUT,         /* 54 - Added for console.c, not used in lock firmware */
889   RESPONSETYPE_UNKNOWNCPUSPEED        /* 55 - Unknown CPU speed (utils.c, utilCalculateClockRate()) */
890 #endif
891 }
892 responseType_e;
893 
894 #if 0
895 typedef enum
896 {
897   SCHEDULERTYPE_HARDON = 0,   /* 0 - Radio is always on */
898   SCHEDULERTYPE_SIMPLE,       /* 1 - Simple 'x' minutes off, 'y' seconds on scheduler */
899   SCHEDULERTYPE_DOM,          /* 2 - Day of month scheduling  */
900   SCHEDULERTYPE_DOW,          /* 3 - Day of week scheduling  */
901   SCHEDULERTYPE_COMMUSER,     /* 4 - Only a comm user triggers power on */
902   SCHEDULERTYPE_HOD,          /* 5 - Hour of day scheduling */
903   SCHEDULERTYPE_OFF,          /* 6 - Nothing wakes up radio */
904   SCHEDULERTYPE_LAST
905 }
906 schedulerType_e;
907 #endif
908 
909 typedef enum
910 {
911   TIMEZONEMODE_NORMAL = 0,  /* 0 - Timezone is applied to user, no auto unlocking */
912   TIMEZONEMODE_EXCLUSION,   /* 1 - User NOT permitted access if in this zone at this time */
913   TIMEZONEMODE_AUTOTIME,    /* 2 - Auto unlock at the start of the TZ, lock at end */
914   TIMEZONEMODE_AUTOFPT,     /* 3 - Unlock on first person through, lock at end */
915   TIMEZONEMODE_UAPM,        /* 4 - Permits user activated passage mode when active */
916   TIMEZONEMODE_LAST
917 }
918 timeZoneMode_e;
919 
920 #if 0
921 typedef enum
922 {
923   UNLOCKMODE_NORMAL = 0,  /* 0 - Normal unlock (CONFIGITEM_UNLOCK_TIME duration) */
924   UNLOCKMODE_UNLOCK,      /* 1 - Unlock, switching to passage mode */
925   UNLOCKMODE_LOCK,        /* 2 - Lock, regardless of mode */
926   UNLOCKMODE_LAST
927 }
928 unlockMode_e;
929 #endif
930 
931 /* XXX: enum vals don't all match vals in comments ??? */
932 typedef enum
933 {
934   UPSTREAMCOMMAND_RESERVED = 0,       /*  0 - Not used */
935   UPSTREAMCOMMAND_DEBUGMSG,           /*  1 - Debug message (zero terminated) */
936   UPSTREAMCOMMAND_QUERYVERSION,       /*  2 - Version string (zero terminated) */
937   UPSTREAMCOMMAND_QUERYDATETIME,      /*  3 - Current date/time */
938   UPSTREAMCOMMAND_QUERYSERIALNUMBER,  /*  5 - Serial number (MAX_SERIALNUM_LENGTH bytes) */
939   UPSTREAMCOMMAND_DUMPEVENTLOG,       /*  6 - Event log record */
940   UPSTREAMCOMMAND_DUMPNVRAM,          /*  7 - NVRAM dump record */
941   UPSTREAMCOMMAND_RMTAUTHREQUEST,     /*  8 - Remote authorization request */
942   UPSTREAMCOMMAND_RETRIEVEUSER,       /*  9 - Retrieve user record */
943   UPSTREAMCOMMAND_QUERYCONFIG,        /* 10 - Query configuration */
944   UPSTREAMCOMMAND_RMTEVENTLOGRECORD,  /* 11 - Remote event log record */
945   UPSTREAMCOMMAND_DPAC,               /* 12 - DPAC related message */
946   UPSTREAMCOMMAND_NOTIFY,             /* 14 - Notify user message */
947   UPSTREAMCOMMAND_MFG,                /* 15 - Manufacturing data */
948   UPSTREAMCOMMAND_EVENTLOGWARNING,    /* 16 - Event log warning level message */
949   UPSTREAMCOMMAND_DUMPNVRAMRLE,       /* 17 - Run Length Encoded (RLE) NVRAM dump record */
950   UPSTREAMCOMMAND_RMTDECLINEDRECORD,  /* 18 - Remote declined log record */
951   UPSTREAMCOMMAND_DECLINEDWARNING,    /* 19 - Declined log warning level message */
952   UPSTREAMCOMMAND_DUMPDECLINEDLOG,    /* 20 - Declined log record dump */
953   UPSTREAMCOMMAND_RMTALARMRECORD,     /* 21 - Remote alarm log record */
954   UPSTREAMCOMMAND_ALARMWARNING,       /* 22 - Alarm log warning level message */
955   UPSTREAMCOMMAND_DUMPALARMLOG,       /* 23 - Alarm log record dump */
956   UPSTREAMCOMMAND_CONNECTSCHEDULER,   /* 24 - Connection because of scheduler, contains serial number */
957   UPSTREAMCOMMAND_CONNECTCOMMUSER,    /* 25 - Connection because of comm user, contains serial number */
958   UPSTREAMCOMMAND_CONNECTALARM,       /* 26 - Connection because of alarm event, contains serial number */
959   UPSTREAMCOMMAND_DUMPDEBUGLOG,       /* 27 - Debug log dump record */
960   UPSTREAMCOMMAND_LAST
961 }
962 upstreamCommand_e;
963 
964 /* XXX: enum vals don't all match vals in comments ??? */
965 typedef enum
966 {
967   UPSTREAMFIELD_NOTUSED = 0,          /*  0 - Not used */
968   UPSTREAMFIELD_SERIALNUMBER,         /*  1 - Contains unit serial number */
969   UPSTREAMFIELD_NAR,                  /*  2 - Contains 16 bit Next Available Record */
970   UPSTREAMFIELD_ENTRYDEVICE,          /*  3 - Contains a ppmSource_e */
971   UPSTREAMFIELD_PPMIFIELDTYPE,        /*  4 - Contains a type of _PIN (auxFieldType_e) */
972   UPSTREAMFIELD_PIN,                  /*  5 - Contains a PIN, Prox, mag key  */
973   UPSTREAMFIELD_SEQUENCENUMBER,       /*  6 - Contains 16 bit sequence number */
974   UPSTREAMFIELD_RESPONSEWINDOW,       /*  7 - Contains 8 bit response window (number of seconds) */
975   UPSTREAMFIELD_USERNUMBER,           /*  8 - Contains 16 bit user number */
976   UPSTREAMFIELD_VERSION,              /*  9 - Contains version string */
977   UPSTREAMFIELD_EVENTLOGRECORD,       /* 10 - Contains eventLog_e event log record */
978   UPSTREAMFIELD_DATETIME,             /* 11 - Contains 8 byte date/time data */
979   UPSTREAMFIELD_EVENTLOGRECORDCOUNT,  /* 17 - Contains number of event log records */
980   UPSTREAMFIELD_DECLINEDRECORDCOUNT,  /* 20 - Contains number of declined log records */
981   UPSTREAMFIELD_DECLINEDRECORD,       /* 21 - Contains declinedLog_t declined log record */
982   UPSTREAMFIELD_USERTYPE,             /* 23 - Contains the user type (master, emergency, normal, etc) */
983   UPSTREAMFIELD_ACCESSALWAYS,         /* 24 - Contains the access always mode (true, false) */
984   UPSTREAMFIELD_CACHED,               /* 25 - Contains the cached flag (true, false) */
985   UPSTREAMFIELD_PRIMARYFIELDTYPE,     /* 26 - Contains the primary field type (pin, prox, mag) */
986   UPSTREAMFIELD_AUXFIELDTYPE,         /* 27 - Contains the aux field type (pin, prox, mag) */
987   UPSTREAMFIELD_ACCESSMODE,           /* 28 - Contains the access mode (aux only, aux + pin, aux or pin, etc) */
988   UPSTREAMFIELD_EXPIREON,             /* 29 - Contains the date the user expires on (00/00/00 if not set) */
989   UPSTREAMFIELD_USECOUNT,             /* 30 - Contains the use count (if user type is ONE_TIME) */
990   UPSTREAMFIELD_TIMEZONE,             /* 31 - Contains the timezone bit map */
991   UPSTREAMFIELD_EXCEPTIONGROUP,       /* 32 - Contains the exception group */
992   UPSTREAMFIELD_PRIMARYPIN,           /* 33 - Contains the primary PPMI (ASCII, 0 terminated) */
993   UPSTREAMFIELD_AUXPIN,               /* 34 - Contains the aux PPMI (ASCII, 0 terminated) */
994   UPSTREAMFIELD_ALARMRECORDCOUNT,     /* 35 - Contains number of alarm log records */
995   UPSTREAMFIELD_ALARMRECORD,          /* 36 - Contains alarmLog_t alarm log record */
996   UPSTREAMFIELD_AUXCTLRVERSION,       /* 37 - Contains the version number of the auxiliary controller */
997   UPSTREAMFIELD_LAST
998 }
999 upstreamField_e;
1000 
1001 typedef enum
1002 {
1003   USERTYPE_NONE = 0,    /*  0 - No user */
1004   USERTYPE_MASTER,      /*  1 - Master user (clears panic, relock, lockout and auto open) */
1005   USERTYPE_EMERGENCY,   /*  2 - Opens door regardless of state */
1006   USERTYPE_SUPERVISOR,  /*  3 - Like emergency user, except won't unlock when in panic mode */
1007   USERTYPE_USER,        /*  4 - Generic user */
1008   USERTYPE_EXTENDED,    /*  5 - Same as _USER, but strike can be kept open longer */
1009   USERTYPE_PASSAGE,     /*  6 - Toggles strike between passage and non-passage modes */
1010   USERTYPE_ONETIME,     /*  7 - User may be used one time */
1011   USERTYPE_PANIC,       /*  8 - Locks down locks, no user except master valid */
1012   USERTYPE_LOCKOUT,     /*  9 - Locks out regular, extended, passage, one time, and notify users */
1013   USERTYPE_RELOCK,      /* 10 - Relock cancels passage mode, but can't unlock */
1014   USERTYPE_NOTIFY,      /* 11 - Same as _USER, only sends unsolicited message to server */
1015   USERTYPE_COMM,        /* 12 - Kicks a communications sessions off if not running _HARDON scheduler */
1016   USERTYPE_SUSPENDED,   /* 13 - User is suspended */
1017   USERTYPE_LAST
1018 }
1019 userType_e;
1020 
1021 
1022 #define ASSA_R3_PORT_RANGE "2571,8023" /* Neither are IANA registered */
1023 
1024 /*
1025  *  Wireshark ID of the R3 protocol
1026  */
1027 static gint proto_r3 = -1;
1028 
1029 /*
1030  *  Packet variables
1031  */
1032 static gint hf_r3_tildex3ds = -1;           /* Got ~~~ds */
1033 
1034 static gint hf_r3_header = -1;              /* Packet header */
1035 static gint hf_r3_payload = -1;             /* Packet payload */
1036 static gint hf_r3_tail = -1;                /* Packet tail */
1037 
1038 static gint hf_r3_sigil = -1;               /* Packet sigil */
1039 static gint hf_r3_address = -1;             /* Packet address */
1040 static gint hf_r3_packetnumber = -1;        /* Packet number */
1041 static gint hf_r3_packetlength = -1;        /* Packet length */
1042 static gint hf_r3_encryption = -1;          /* Packet encryption scheme */
1043 static gint hf_r3_crc = -1;                 /* Packet CRC */
1044 static gint hf_r3_crc_bad = -1;             /* Packet CRC bad (for filtering) */
1045 static gint hf_r3_xor = -1;                 /* Packet Xor */
1046 static gint hf_r3_xor_bad = -1;             /* Packet Xor bad (for filtering) */
1047 
1048 static gint hf_r3_commandlength = -1;       /* Command length */
1049 static gint hf_r3_command = -1;             /* Command (cmdCommand_e) */
1050 static gint hf_r3_commanddata = -1;         /* Command data (not always present) */
1051 
1052 static gint hf_r3_commandmfglength = -1;    /* Mfg Command length */
1053 static gint hf_r3_commandmfg = -1;          /* Mfg Command (cmdCommand_e) */
1054 /*static gint hf_r3_commandmfgdata = -1;*/    /* Mfg Command data (not always present) */
1055 
1056 static gint hf_r3_responselength = -1;      /* Response length */
1057 static gint hf_r3_responsecommand = -1;     /* Response command */
1058 static gint hf_r3_responsetype = -1;        /* Response type (responseType_e) */
1059 static gint hf_r3_responsetocommand = -1;   /* Response to command (cmdCommand_e) */
1060 /*static gint hf_r3_responsedata = -1;*/       /* Response data (not always present) */
1061 
1062 static gint hf_r3_upstreamcommand = -1;
1063 
1064 static gint hf_r3_upstreamfield = -1;       /* Upstream field (length + type + data) */
1065 static gint hf_r3_upstreamfieldlength = -1; /* Upstream field length */
1066 static gint hf_r3_upstreamfieldtype = -1;   /* Upstream field type (upstreamField_e) */
1067 /*static gint hf_r3_upstreamfielddatalen = -1;*/         /* Upstream field data length */
1068 static gint hf_r3_upstreamfielderror = -1;  /* Upstream field is unknown type */
1069 static gint hf_r3_upstreamfieldarray[UPSTREAMFIELD_LAST];
1070 
1071 static gint hf_r3_configitems = -1;
1072 static gint hf_r3_configitem = -1;
1073 /*static gint hf_r3_configfield = -1;*/
1074 static gint hf_r3_configitemlength = -1;
1075 static gint hf_r3_configitemtype = -1;
1076 static gint hf_r3_configitemdata = -1;
1077 static gint hf_r3_configitemdata_bool = -1;
1078 static gint hf_r3_configitemdata_8 = -1;
1079 static gint hf_r3_configitemdata_16 = -1;
1080 static gint hf_r3_configitemdata_32 = -1;
1081 static gint hf_r3_configitemdata_string = -1;
1082 
1083 static gint hf_r3_timezonearray0 = -1;
1084 static gint hf_r3_timezonearray1 = -1;
1085 static gint hf_r3_timezonearray2 = -1;
1086 static gint hf_r3_timezonearray3 = -1;
1087 static gint hf_r3_timezonearray4 = -1;
1088 static gint hf_r3_timezonearray5 = -1;
1089 static gint hf_r3_timezonearray6 = -1;
1090 static gint hf_r3_timezonearray7 = -1;
1091 static gint hf_r3_timezonearray8 = -1;
1092 static gint hf_r3_timezonearray9 = -1;
1093 static gint hf_r3_timezonearray10 = -1;
1094 static gint hf_r3_timezonearray11 = -1;
1095 static gint hf_r3_timezonearray12 = -1;
1096 static gint hf_r3_timezonearray13 = -1;
1097 static gint hf_r3_timezonearray14 = -1;
1098 static gint hf_r3_timezonearray15 = -1;
1099 static gint hf_r3_timezonearray16 = -1;
1100 static gint hf_r3_timezonearray17 = -1;
1101 static gint hf_r3_timezonearray18 = -1;
1102 static gint hf_r3_timezonearray19 = -1;
1103 static gint hf_r3_timezonearray20 = -1;
1104 static gint hf_r3_timezonearray21 = -1;
1105 static gint hf_r3_timezonearray22 = -1;
1106 static gint hf_r3_timezonearray23 = -1;
1107 static gint hf_r3_timezonearray24 = -1;
1108 static gint hf_r3_timezonearray25 = -1;
1109 static gint hf_r3_timezonearray26 = -1;
1110 static gint hf_r3_timezonearray27 = -1;
1111 static gint hf_r3_timezonearray28 = -1;
1112 static gint hf_r3_timezonearray29 = -1;
1113 static gint hf_r3_timezonearray30 = -1;
1114 static gint hf_r3_timezonearray31 = -1;
1115 
1116 static gint hf_r3_expireon_year = -1;
1117 static gint hf_r3_expireon_month = -1;
1118 static gint hf_r3_expireon_day = -1;
1119 
1120 static gint hf_r3_datetime_year = -1;
1121 static gint hf_r3_datetime_month = -1;
1122 static gint hf_r3_datetime_day = -1;
1123 static gint hf_r3_datetime_dow = -1;
1124 static gint hf_r3_datetime_hours = -1;
1125 static gint hf_r3_datetime_minutes = -1;
1126 static gint hf_r3_datetime_seconds = -1;
1127 static gint hf_r3_datetime_dst = -1;
1128 
1129 static gint hf_r3_eventlog_recordnumber = -1;
1130 static gint hf_r3_eventlog_year = -1;
1131 static gint hf_r3_eventlog_month = -1;
1132 static gint hf_r3_eventlog_day = -1;
1133 static gint hf_r3_eventlog_hour = -1;
1134 static gint hf_r3_eventlog_minute = -1;
1135 static gint hf_r3_eventlog_second = -1;
1136 static gint hf_r3_eventlog_usernumber = -1;
1137 static gint hf_r3_eventlog_event = -1;
1138 
1139 static gint hf_r3_declinedlog_recordnumber = -1;
1140 static gint hf_r3_declinedlog_year = -1;
1141 static gint hf_r3_declinedlog_month = -1;
1142 static gint hf_r3_declinedlog_day = -1;
1143 static gint hf_r3_declinedlog_hour = -1;
1144 static gint hf_r3_declinedlog_minute = -1;
1145 static gint hf_r3_declinedlog_second = -1;
1146 static gint hf_r3_declinedlog_usernumber = -1;
1147 static gint hf_r3_declinedlog_cred1type = -1;
1148 static gint hf_r3_declinedlog_cred2type = -1;
1149 static gint hf_r3_declinedlog_cred1 = -1;
1150 static gint hf_r3_declinedlog_cred2 = -1;
1151 
1152 static gint hf_r3_alarmlog_recordnumber = -1;
1153 static gint hf_r3_alarmlog_year = -1;
1154 static gint hf_r3_alarmlog_month = -1;
1155 static gint hf_r3_alarmlog_day = -1;
1156 static gint hf_r3_alarmlog_hour = -1;
1157 static gint hf_r3_alarmlog_minute = -1;
1158 static gint hf_r3_alarmlog_second = -1;
1159 static gint hf_r3_alarmlog_id = -1;
1160 static gint hf_r3_alarmlog_usernumber = -1;
1161 
1162 static gint hf_r3_debugmsg = -1;
1163 
1164 static gint hf_r3_setdate_year = -1;
1165 static gint hf_r3_setdate_month = -1;
1166 static gint hf_r3_setdate_day = -1;
1167 static gint hf_r3_setdate_dow = -1;
1168 static gint hf_r3_setdate_hours = -1;
1169 static gint hf_r3_setdate_minutes = -1;
1170 static gint hf_r3_setdate_seconds = -1;
1171 
1172 static gint hf_r3_deleteusers = -1;
1173 
1174 static gint hf_r3_defineexception_number = -1;
1175 static gint hf_r3_defineexception_startdate_month = -1;
1176 static gint hf_r3_defineexception_startdate_day = -1;
1177 static gint hf_r3_defineexception_startdate_hours = -1;
1178 static gint hf_r3_defineexception_startdate_minutes = -1;
1179 static gint hf_r3_defineexception_enddate_month = -1;
1180 static gint hf_r3_defineexception_enddate_day = -1;
1181 static gint hf_r3_defineexception_enddate_hours = -1;
1182 static gint hf_r3_defineexception_enddate_minutes = -1;
1183 
1184 static gint hf_r3_defineexceptiongroup_number = -1;
1185 static gint hf_r3_defineexceptiongroup_bits = -1;
1186 
1187 static gint hf_r3_definecalendar_number = -1;
1188 static gint hf_r3_definecalendar_bits = -1;
1189 
1190 static gint hf_r3_definetimezone_number = -1;
1191 static gint hf_r3_definetimezone_starttime_hours = -1;
1192 static gint hf_r3_definetimezone_starttime_minutes = -1;
1193 static gint hf_r3_definetimezone_endtime_hours = -1;
1194 static gint hf_r3_definetimezone_endtime_minutes = -1;
1195 static gint hf_r3_definetimezone_daymap = -1;
1196 static gint hf_r3_definetimezone_daymap0 = -1;
1197 static gint hf_r3_definetimezone_daymap1 = -1;
1198 static gint hf_r3_definetimezone_daymap2 = -1;
1199 static gint hf_r3_definetimezone_daymap3 = -1;
1200 static gint hf_r3_definetimezone_daymap4 = -1;
1201 static gint hf_r3_definetimezone_daymap5 = -1;
1202 static gint hf_r3_definetimezone_daymap6 = -1;
1203 static gint hf_r3_definetimezone_exceptiongroup = -1;
1204 static gint hf_r3_definetimezone_mode = -1;
1205 static gint hf_r3_definetimezone_calendar = -1;
1206 
1207 static gint hf_r3_rmtauthretry_sequence = -1;
1208 static gint hf_r3_rmtauthretry_retry = -1;
1209 
1210 static gint hf_r3_eventlogdump_starttime_year = -1;
1211 static gint hf_r3_eventlogdump_starttime_month = -1;
1212 static gint hf_r3_eventlogdump_starttime_day = -1;
1213 static gint hf_r3_eventlogdump_starttime_hours = -1;
1214 static gint hf_r3_eventlogdump_starttime_minutes = -1;
1215 static gint hf_r3_eventlogdump_endtime_year = -1;
1216 static gint hf_r3_eventlogdump_endtime_month = -1;
1217 static gint hf_r3_eventlogdump_endtime_day = -1;
1218 static gint hf_r3_eventlogdump_endtime_hours = -1;
1219 static gint hf_r3_eventlogdump_endtime_minutes = -1;
1220 static gint hf_r3_eventlogdump_user = -1;
1221 
1222 static gint hf_r3_declinedlogdump_starttime_year = -1;
1223 static gint hf_r3_declinedlogdump_starttime_month = -1;
1224 static gint hf_r3_declinedlogdump_starttime_day = -1;
1225 static gint hf_r3_declinedlogdump_starttime_hours = -1;
1226 static gint hf_r3_declinedlogdump_starttime_minutes = -1;
1227 static gint hf_r3_declinedlogdump_endtime_year = -1;
1228 static gint hf_r3_declinedlogdump_endtime_month = -1;
1229 static gint hf_r3_declinedlogdump_endtime_day = -1;
1230 static gint hf_r3_declinedlogdump_endtime_hours = -1;
1231 static gint hf_r3_declinedlogdump_endtime_minutes = -1;
1232 
1233 static gint hf_r3_alarmlogdump_starttime_year = -1;
1234 static gint hf_r3_alarmlogdump_starttime_month = -1;
1235 static gint hf_r3_alarmlogdump_starttime_day = -1;
1236 static gint hf_r3_alarmlogdump_starttime_hours = -1;
1237 static gint hf_r3_alarmlogdump_starttime_minutes = -1;
1238 static gint hf_r3_alarmlogdump_endtime_year = -1;
1239 static gint hf_r3_alarmlogdump_endtime_month = -1;
1240 static gint hf_r3_alarmlogdump_endtime_day = -1;
1241 static gint hf_r3_alarmlogdump_endtime_hours = -1;
1242 static gint hf_r3_alarmlogdump_endtime_minutes = -1;
1243 
1244 static gint hf_r3_nvramclearoptions = -1;
1245 static gint hf_r3_nvramclearoptions0 = -1;
1246 static gint hf_r3_nvramclearoptions1 = -1;
1247 static gint hf_r3_nvramclearoptions2 = -1;
1248 static gint hf_r3_nvramclearoptions3 = -1;
1249 static gint hf_r3_nvramclearoptions4 = -1;
1250 static gint hf_r3_nvramclearoptions5 = -1;
1251 static gint hf_r3_nvramclearoptions6 = -1;
1252 static gint hf_r3_nvramclearoptions7 = -1;
1253 static gint hf_r3_nvramclearoptions8 = -1;
1254 static gint hf_r3_nvramclearoptions9 = -1;
1255 static gint hf_r3_nvramclearoptions10 = -1;
1256 static gint hf_r3_nvramclearoptions11 = -1;
1257 static gint hf_r3_nvramclearoptions12 = -1;
1258 static gint hf_r3_nvramclearoptions13 = -1;
1259 static gint hf_r3_nvramclearoptions14 = -1;
1260 static gint hf_r3_nvramclearoptions15 = -1;
1261 
1262 static gint hf_r3_writeeventlog_user = -1;
1263 static gint hf_r3_writeeventlog_event = -1;
1264 
1265 static gint hf_r3_powertableselection = -1;
1266 
1267 static gint hf_r3_filter_type = -1;
1268 static gint hf_r3_filter_list = -1;
1269 
1270 static gint hf_r3_alarm_length = -1;
1271 static gint hf_r3_alarm_id = -1;
1272 static gint hf_r3_alarm_state = -1;
1273 
1274 static gint hf_r3_dpac_action = -1;
1275 static gint hf_r3_dpac_waittime = -1;
1276 static gint hf_r3_dpac_command = -1;
1277 
1278 static gint hf_r3_dpacreply_stuff = -1;
1279 static gint hf_r3_dpacreply_length = -1;
1280 static gint hf_r3_dpacreply_reply = -1;
1281 
1282 static gint hf_r3_mfgfield_length = -1;
1283 static gint hf_r3_mfgfield = -1;
1284 /*static gint hf_r3_mfgfield_data = -1;*/
1285 
1286 static gint hf_r3_mfgsetserialnumber = -1;
1287 static gint hf_r3_mfgsetcryptkey = -1;
1288 static gint hf_r3_mfgdumpnvram = -1;
1289 static gint hf_r3_mfgremoteunlock = -1;
1290 static gint hf_r3_mfgtestpreserve = -1;
1291 
1292 static gint hf_r3_adc [8];
1293 
1294 static gint hf_r3_hardwareid_board = -1;
1295 static gint hf_r3_hardwareid_cpuid = -1;
1296 static gint hf_r3_hardwareid_cpurev = -1;
1297 
1298 static gint hf_r3_testkeypad = -1;
1299 static gint hf_r3_testmagcard = -1;
1300 static gint hf_r3_testproxcard = -1;
1301 
1302 static gint hf_r3_nvramdump_record = -1;
1303 static gint hf_r3_nvramdump_length = -1;
1304 static gint hf_r3_nvramdump_data = -1;
1305 
1306 static gint hf_r3_nvramdumprle_record = -1;
1307 static gint hf_r3_nvramdumprle_length = -1;
1308 static gint hf_r3_nvramdumprle_data = -1;
1309 
1310 static gint hf_r3_iopins_lat = -1;
1311 static gint hf_r3_iopins_port = -1;
1312 static gint hf_r3_iopins_tris = -1;
1313 
1314 static gint hf_r3_mortisepins_s1 = -1;
1315 static gint hf_r3_mortisepins_s2 = -1;
1316 static gint hf_r3_mortisepins_s3 = -1;
1317 static gint hf_r3_mortisepins_s4 = -1;
1318 
1319 static gint hf_r3_checksumresults = -1;
1320 static gint hf_r3_checksumresults_field = -1;
1321 static gint hf_r3_checksumresults_length = -1;
1322 static gint hf_r3_checksumresults_state = -1;
1323 
1324 static gint hf_r3_forceoptions_length = -1;
1325 static gint hf_r3_forceoptions_item = -1;
1326 static gint hf_r3_forceoptions_state_8= -1;
1327 static gint hf_r3_forceoptions_state_16 = -1;
1328 static gint hf_r3_forceoptions_state_24 = -1;
1329 static gint hf_r3_forceoptions_state_32 = -1;
1330 
1331 static gint hf_r3_peekpoke_operation = -1;
1332 static gint hf_r3_peekpoke_address = -1;
1333 static gint hf_r3_peekpoke_length = -1;
1334 static gint hf_r3_peekpoke_poke8 = -1;
1335 static gint hf_r3_peekpoke_poke16 = -1;
1336 static gint hf_r3_peekpoke_poke24 = -1;
1337 static gint hf_r3_peekpoke_poke32 = -1;
1338 static gint hf_r3_peekpoke_pokestring = -1;
1339 
1340 static gint hf_r3_firmwaredownload_length = -1;
1341 static gint hf_r3_firmwaredownload_record = -1;
1342 static gint hf_r3_firmwaredownload_action = -1;
1343 static gint hf_r3_firmwaredownload_timeout = -1;
1344 static gint hf_r3_firmwaredownload_nvram = -1;
1345 static gint hf_r3_firmwaredownload_address = -1;
1346 static gint hf_r3_firmwaredownload_bytes = -1;
1347 static gint hf_r3_firmwaredownload_data = -1;
1348 static gint hf_r3_firmwaredownload_crc = -1;
1349 static gint hf_r3_firmwaredownload_crc_bad = -1;
1350 
1351 static gint hf_r3_nvramchecksumvalue = -1;
1352 static gint hf_r3_nvramchecksumvalue_fixup = -1;
1353 
1354 static gint hf_r3_capabilities = -1;
1355 static gint hf_r3_capabilities_length = -1;
1356 static gint hf_r3_capabilities_type = -1;
1357 static gint hf_r3_capabilities_value = -1;
1358 
1359 static gint hf_r3_lockstate = -1;
1360 static gint hf_r3_lockstate_passage = -1;
1361 static gint hf_r3_lockstate_panic = -1;
1362 static gint hf_r3_lockstate_lockout = -1;
1363 static gint hf_r3_lockstate_relock = -1;
1364 static gint hf_r3_lockstate_autoopen = -1;
1365 static gint hf_r3_lockstate_nextauto = -1;
1366 static gint hf_r3_lockstate_lockstate = -1;
1367 static gint hf_r3_lockstate_wantstate = -1;
1368 static gint hf_r3_lockstate_remote = -1;
1369 static gint hf_r3_lockstate_update = -1;
1370 static gint hf_r3_lockstate_exceptionspresent = -1;
1371 static gint hf_r3_lockstate_exceptionsactive = -1;
1372 static gint hf_r3_lockstate_timezonespresent = -1;
1373 static gint hf_r3_lockstate_timezonesactive = -1;
1374 static gint hf_r3_lockstate_autounlockspresent = -1;
1375 static gint hf_r3_lockstate_autounlocksactive = -1;
1376 static gint hf_r3_lockstate_uapmspresent = -1;
1377 static gint hf_r3_lockstate_uapmsactive = -1;
1378 static gint hf_r3_lockstate_uapmrelockspresent = -1;
1379 static gint hf_r3_lockstate_uapmreslocksactive = -1;
1380 static gint hf_r3_lockstate_nvramprotect = -1;
1381 static gint hf_r3_lockstate_nvramchecksum = -1;
1382 
1383 /*static gint hf_r3_mortisestatelog = -1;*/
1384 static gint hf_r3_mortisestatelog_pointer = -1;
1385 static gint hf_r3_mortisestatelog_mortisetype = -1;
1386 static gint hf_r3_mortisestatelog_waiting = -1;
1387 static gint hf_r3_mortisestatelog_state = -1;
1388 static gint hf_r3_mortisestatelog_last = -1;
1389 static gint hf_r3_mortisestatelog_event = -1;
1390 
1391 static gint hf_r3_timerchain_newtick = -1;
1392 static gint hf_r3_timerchain_currentboundary = -1;
1393 static gint hf_r3_timerchain_tasktag = -1;
1394 static gint hf_r3_timerchain_address = -1;
1395 static gint hf_r3_timerchain_reload = -1;
1396 static gint hf_r3_timerchain_boundary = -1;
1397 static gint hf_r3_timerchain_count = -1;
1398 static gint hf_r3_timerchain_flags = -1;
1399 
1400 static gint hf_r3_taskflags_taskid = -1;
1401 static gint hf_r3_taskflags_flags = -1;
1402 
1403 static gint hf_r3_checkpointlog_entryptr = -1;
1404 static gint hf_r3_checkpointlog_rcon = -1;
1405 static gint hf_r3_checkpointlog_checkpoint = -1;
1406 
1407 static gint hf_r3_cpuregisters_intcon = -1;
1408 static gint hf_r3_cpuregisters_intcon2 = -1;
1409 static gint hf_r3_cpuregisters_intcon3 = -1;
1410 static gint hf_r3_cpuregisters_pir1 = -1;
1411 static gint hf_r3_cpuregisters_pir2 = -1;
1412 static gint hf_r3_cpuregisters_pir3 = -1;
1413 static gint hf_r3_cpuregisters_pie1 = -1;
1414 static gint hf_r3_cpuregisters_pie2 = -1;
1415 static gint hf_r3_cpuregisters_pie3 = -1;
1416 static gint hf_r3_cpuregisters_ipr1 = -1;
1417 static gint hf_r3_cpuregisters_ipr2 = -1;
1418 static gint hf_r3_cpuregisters_ipr3 = -1;
1419 static gint hf_r3_cpuregisters_rcon = -1;
1420 static gint hf_r3_cpuregisters_osccon = -1;
1421 static gint hf_r3_cpuregisters_rcsta = -1;
1422 static gint hf_r3_cpuregisters_txsta = -1;
1423 static gint hf_r3_cpuregisters_rcsta2 = -1;
1424 static gint hf_r3_cpuregisters_txsta2 = -1;
1425 static gint hf_r3_cpuregisters_wdtcon = -1;
1426 
1427 static gint hf_r3_cpuregisters_intcon_rbif = -1;
1428 static gint hf_r3_cpuregisters_intcon_int0if = -1;
1429 static gint hf_r3_cpuregisters_intcon_tmr0if = -1;
1430 static gint hf_r3_cpuregisters_intcon_rbie = -1;
1431 static gint hf_r3_cpuregisters_intcon_int0ie = -1;
1432 static gint hf_r3_cpuregisters_intcon_tmr0ie = -1;
1433 static gint hf_r3_cpuregisters_intcon_giel = -1;
1434 static gint hf_r3_cpuregisters_intcon_gieh = -1;
1435 static gint hf_r3_cpuregisters_intcon2_rbip = -1;
1436 static gint hf_r3_cpuregisters_intcon2_int3ip = -1;
1437 static gint hf_r3_cpuregisters_intcon2_tmr0ip = -1;
1438 static gint hf_r3_cpuregisters_intcon2_intedg3 = -1;
1439 static gint hf_r3_cpuregisters_intcon2_intedg2 = -1;
1440 static gint hf_r3_cpuregisters_intcon2_intedg1 = -1;
1441 static gint hf_r3_cpuregisters_intcon2_intedg0 = -1;
1442 static gint hf_r3_cpuregisters_intcon2_rbpu = -1;
1443 static gint hf_r3_cpuregisters_intcon3_int1if = -1;
1444 static gint hf_r3_cpuregisters_intcon3_int2if = -1;
1445 static gint hf_r3_cpuregisters_intcon3_int3if = -1;
1446 static gint hf_r3_cpuregisters_intcon3_int1ie = -1;
1447 static gint hf_r3_cpuregisters_intcon3_int2ie = -1;
1448 static gint hf_r3_cpuregisters_intcon3_int3ie = -1;
1449 static gint hf_r3_cpuregisters_intcon3_int1ip = -1;
1450 static gint hf_r3_cpuregisters_intcon3_int2ip = -1;
1451 static gint hf_r3_cpuregisters_pir1_tmr1if = -1;
1452 static gint hf_r3_cpuregisters_pir1_tmr2if = -1;
1453 static gint hf_r3_cpuregisters_pir1_ccp1if = -1;
1454 static gint hf_r3_cpuregisters_pir1_ssp1if = -1;
1455 static gint hf_r3_cpuregisters_pir1_tx1if = -1;
1456 static gint hf_r3_cpuregisters_pir1_rc1if = -1;
1457 static gint hf_r3_cpuregisters_pir1_adif = -1;
1458 static gint hf_r3_cpuregisters_pir1_pspif = -1;
1459 static gint hf_r3_cpuregisters_pir2_ccp2if = -1;
1460 static gint hf_r3_cpuregisters_pir2_tmr3if = -1;
1461 static gint hf_r3_cpuregisters_pir2_hlvdif = -1;
1462 static gint hf_r3_cpuregisters_pir2_bcl1if = -1;
1463 static gint hf_r3_cpuregisters_pir2_eeif = -1;
1464 static gint hf_r3_cpuregisters_pir2_unused5 = -1;
1465 static gint hf_r3_cpuregisters_pir2_cmif = -1;
1466 static gint hf_r3_cpuregisters_pir2_oscfif = -1;
1467 static gint hf_r3_cpuregisters_pir3_ccp3if = -1;
1468 static gint hf_r3_cpuregisters_pir3_ccp4if = -1;
1469 static gint hf_r3_cpuregisters_pir3_ccp5if = -1;
1470 static gint hf_r3_cpuregisters_pir3_tmr4if = -1;
1471 static gint hf_r3_cpuregisters_pir3_tx2if = -1;
1472 static gint hf_r3_cpuregisters_pir3_rc2if = -1;
1473 static gint hf_r3_cpuregisters_pir3_bcl2if = -1;
1474 static gint hf_r3_cpuregisters_pir3_ssp2if = -1;
1475 static gint hf_r3_cpuregisters_pie1_tmr1ie = -1;
1476 static gint hf_r3_cpuregisters_pie1_tmr2ie = -1;
1477 static gint hf_r3_cpuregisters_pie1_ccp1ie = -1;
1478 static gint hf_r3_cpuregisters_pie1_ssp1ie = -1;
1479 static gint hf_r3_cpuregisters_pie1_tx1ie = -1;
1480 static gint hf_r3_cpuregisters_pie1_rc1ie = -1;
1481 static gint hf_r3_cpuregisters_pie1_adie = -1;
1482 static gint hf_r3_cpuregisters_pie1_pspie = -1;
1483 static gint hf_r3_cpuregisters_pie2_oscfie = -1;
1484 static gint hf_r3_cpuregisters_pie2_cmie = -1;
1485 static gint hf_r3_cpuregisters_pie2_unused2 = -1;
1486 static gint hf_r3_cpuregisters_pie2_eeie = -1;
1487 static gint hf_r3_cpuregisters_pie2_bcl1ie = -1;
1488 static gint hf_r3_cpuregisters_pie2_hlvdie = -1;
1489 static gint hf_r3_cpuregisters_pie2_tmr3ie = -1;
1490 static gint hf_r3_cpuregisters_pie2_ccp2ie = -1;
1491 static gint hf_r3_cpuregisters_pie3_ccp3ie = -1;
1492 static gint hf_r3_cpuregisters_pie3_ccp4ie = -1;
1493 static gint hf_r3_cpuregisters_pie3_ccp5ie = -1;
1494 static gint hf_r3_cpuregisters_pie3_tmr4ie = -1;
1495 static gint hf_r3_cpuregisters_pie3_tx2ie = -1;
1496 static gint hf_r3_cpuregisters_pie3_rc2ie = -1;
1497 static gint hf_r3_cpuregisters_pie3_bcl2ie = -1;
1498 static gint hf_r3_cpuregisters_pie3_ssp2ie = -1;
1499 static gint hf_r3_cpuregisters_ipr1_tmr1ip = -1;
1500 static gint hf_r3_cpuregisters_ipr1_tmr2ip = -1;
1501 static gint hf_r3_cpuregisters_ipr1_ccp1ip = -1;
1502 static gint hf_r3_cpuregisters_ipr1_ssp1ip = -1;
1503 static gint hf_r3_cpuregisters_ipr1_tx1ip = -1;
1504 static gint hf_r3_cpuregisters_ipr1_rc1ip = -1;
1505 static gint hf_r3_cpuregisters_ipr1_adip = -1;
1506 static gint hf_r3_cpuregisters_ipr1_pspip = -1;
1507 static gint hf_r3_cpuregisters_ipr2_ccp2ip = -1;
1508 static gint hf_r3_cpuregisters_ipr2_tmr3ip = -1;
1509 static gint hf_r3_cpuregisters_ipr2_hlvdip = -1;
1510 static gint hf_r3_cpuregisters_ipr2_bcl1ip = -1;
1511 static gint hf_r3_cpuregisters_ipr2_eeip = -1;
1512 static gint hf_r3_cpuregisters_ipr2_unused5 = -1;
1513 static gint hf_r3_cpuregisters_ipr2_cmip = -1;
1514 static gint hf_r3_cpuregisters_ipr2_oscfip = -1;
1515 static gint hf_r3_cpuregisters_ipr3_ccp2ip = -1;
1516 static gint hf_r3_cpuregisters_ipr3_ccp4ip = -1;
1517 static gint hf_r3_cpuregisters_ipr3_ccp5ip = -1;
1518 static gint hf_r3_cpuregisters_ipr3_tmr4ip = -1;
1519 static gint hf_r3_cpuregisters_ipr3_tx2ip = -1;
1520 static gint hf_r3_cpuregisters_ipr3_rc2ip = -1;
1521 static gint hf_r3_cpuregisters_ipr3_bcl2ip = -1;
1522 static gint hf_r3_cpuregisters_ipr3_ssp2ip = -1;
1523 static gint hf_r3_cpuregisters_rcon_bor = -1;
1524 static gint hf_r3_cpuregisters_rcon_por = -1;
1525 static gint hf_r3_cpuregisters_rcon_pd = -1;
1526 static gint hf_r3_cpuregisters_rcon_to = -1;
1527 static gint hf_r3_cpuregisters_rcon_unused4 = -1;
1528 static gint hf_r3_cpuregisters_rcon_ri = -1;
1529 static gint hf_r3_cpuregisters_rcon_sboren = -1;
1530 static gint hf_r3_cpuregisters_rcon_ipen = -1;
1531 static gint hf_r3_cpuregisters_osccon_scs0 = -1;
1532 static gint hf_r3_cpuregisters_osccon_scs1 = -1;
1533 static gint hf_r3_cpuregisters_osccon_iofs = -1;
1534 static gint hf_r3_cpuregisters_osccon_osts = -1;
1535 static gint hf_r3_cpuregisters_osccon_ircf0 = -1;
1536 static gint hf_r3_cpuregisters_osccon_ircf1 = -1;
1537 static gint hf_r3_cpuregisters_osccon_ircf2 = -1;
1538 static gint hf_r3_cpuregisters_osccon_idlen = -1;
1539 static gint hf_r3_cpuregisters_rcsta_rx9d = -1;
1540 static gint hf_r3_cpuregisters_rcsta_oerr = -1;
1541 static gint hf_r3_cpuregisters_rcsta_ferr = -1;
1542 static gint hf_r3_cpuregisters_rcsta_adden = -1;
1543 static gint hf_r3_cpuregisters_rcsta_cren = -1;
1544 static gint hf_r3_cpuregisters_rcsta_sren = -1;
1545 static gint hf_r3_cpuregisters_rcsta_rx9 = -1;
1546 static gint hf_r3_cpuregisters_rcsta_spen = -1;
1547 static gint hf_r3_cpuregisters_txsta_tx9d = -1;
1548 static gint hf_r3_cpuregisters_txsta_trmt = -1;
1549 static gint hf_r3_cpuregisters_txsta_brgh = -1;
1550 static gint hf_r3_cpuregisters_txsta_sendb = -1;
1551 static gint hf_r3_cpuregisters_txsta_sync = -1;
1552 static gint hf_r3_cpuregisters_txsta_txen = -1;
1553 static gint hf_r3_cpuregisters_txsta_tx9 = -1;
1554 static gint hf_r3_cpuregisters_txsta_csrc = -1;
1555 static gint hf_r3_cpuregisters_rcsta2_rx9d = -1;
1556 static gint hf_r3_cpuregisters_rcsta2_oerr = -1;
1557 static gint hf_r3_cpuregisters_rcsta2_ferr = -1;
1558 static gint hf_r3_cpuregisters_rcsta2_adden = -1;
1559 static gint hf_r3_cpuregisters_rcsta2_cren = -1;
1560 static gint hf_r3_cpuregisters_rcsta2_sren = -1;
1561 static gint hf_r3_cpuregisters_rcsta2_rx9 = -1;
1562 static gint hf_r3_cpuregisters_rcsta2_spen = -1;
1563 static gint hf_r3_cpuregisters_txsta2_tx9d = -1;
1564 static gint hf_r3_cpuregisters_txsta2_trmt = -1;
1565 static gint hf_r3_cpuregisters_txsta2_brgh = -1;
1566 static gint hf_r3_cpuregisters_txsta2_sendb = -1;
1567 static gint hf_r3_cpuregisters_txsta2_sync = -1;
1568 static gint hf_r3_cpuregisters_txsta2_txen = -1;
1569 static gint hf_r3_cpuregisters_txsta2_tx9 = -1;
1570 static gint hf_r3_cpuregisters_txsta2_csrc = -1;
1571 static gint hf_r3_cpuregisters_wdtcon_swdten = -1;
1572 static gint hf_r3_cpuregisters_wdtcon_unused1 = -1;
1573 static gint hf_r3_cpuregisters_wdtcon_unused2 = -1;
1574 static gint hf_r3_cpuregisters_wdtcon_unused3 = -1;
1575 static gint hf_r3_cpuregisters_wdtcon_unused4 = -1;
1576 static gint hf_r3_cpuregisters_wdtcon_unused5 = -1;
1577 static gint hf_r3_cpuregisters_wdtcon_unused6 = -1;
1578 static gint hf_r3_cpuregisters_wdtcon_unused7 = -1;
1579 
1580 static gint hf_r3_dumpm41t81_reg00 = -1;
1581 static gint hf_r3_dumpm41t81_reg01 = -1;
1582 static gint hf_r3_dumpm41t81_reg02 = -1;
1583 static gint hf_r3_dumpm41t81_reg03 = -1;
1584 static gint hf_r3_dumpm41t81_reg04 = -1;
1585 static gint hf_r3_dumpm41t81_reg05 = -1;
1586 static gint hf_r3_dumpm41t81_reg06 = -1;
1587 static gint hf_r3_dumpm41t81_reg07 = -1;
1588 static gint hf_r3_dumpm41t81_reg08 = -1;
1589 static gint hf_r3_dumpm41t81_reg09 = -1;
1590 static gint hf_r3_dumpm41t81_reg0a = -1;
1591 static gint hf_r3_dumpm41t81_reg0b = -1;
1592 static gint hf_r3_dumpm41t81_reg0c = -1;
1593 static gint hf_r3_dumpm41t81_reg0d = -1;
1594 static gint hf_r3_dumpm41t81_reg0e = -1;
1595 static gint hf_r3_dumpm41t81_reg0f = -1;
1596 static gint hf_r3_dumpm41t81_reg10 = -1;
1597 static gint hf_r3_dumpm41t81_reg11 = -1;
1598 static gint hf_r3_dumpm41t81_reg12 = -1;
1599 static gint hf_r3_dumpm41t81_reg13 = -1;
1600 
1601 static gint hf_r3_dumpm41t81_reg00_sec1 = -1;
1602 static gint hf_r3_dumpm41t81_reg00_sec01 = -1;
1603 static gint hf_r3_dumpm41t81_reg01_st = -1;
1604 static gint hf_r3_dumpm41t81_reg01_10sec = -1;
1605 static gint hf_r3_dumpm41t81_reg01_1sec = -1;
1606 static gint hf_r3_dumpm41t81_reg02_notused = -1;
1607 static gint hf_r3_dumpm41t81_reg02_10min = -1;
1608 static gint hf_r3_dumpm41t81_reg02_1min = -1;
1609 static gint hf_r3_dumpm41t81_reg03_cbe = -1;
1610 static gint hf_r3_dumpm41t81_reg03_cb = -1;
1611 static gint hf_r3_dumpm41t81_reg03_10hour = -1;
1612 static gint hf_r3_dumpm41t81_reg03_1hour = -1;
1613 static gint hf_r3_dumpm41t81_reg04_notused = -1;
1614 static gint hf_r3_dumpm41t81_reg04_dow = -1;
1615 static gint hf_r3_dumpm41t81_reg05_notused = -1;
1616 static gint hf_r3_dumpm41t81_reg05_10day = -1;
1617 static gint hf_r3_dumpm41t81_reg05_1day = -1;
1618 static gint hf_r3_dumpm41t81_reg06_notused = -1;
1619 static gint hf_r3_dumpm41t81_reg06_10month = -1;
1620 static gint hf_r3_dumpm41t81_reg06_1month = -1;
1621 static gint hf_r3_dumpm41t81_reg07_10year = -1;
1622 static gint hf_r3_dumpm41t81_reg07_1year = -1;
1623 static gint hf_r3_dumpm41t81_reg08_out = -1;
1624 static gint hf_r3_dumpm41t81_reg08_ft = -1;
1625 static gint hf_r3_dumpm41t81_reg08_s = -1;
1626 static gint hf_r3_dumpm41t81_reg08_cal = -1;
1627 static gint hf_r3_dumpm41t81_reg09_notused = -1;
1628 static gint hf_r3_dumpm41t81_reg09_bmb = -1;
1629 static gint hf_r3_dumpm41t81_reg09_rb = -1;
1630 static gint hf_r3_dumpm41t81_reg0a_afe = -1;
1631 static gint hf_r3_dumpm41t81_reg0a_sqwe = -1;
1632 static gint hf_r3_dumpm41t81_reg0a_abe = -1;
1633 static gint hf_r3_dumpm41t81_reg0a_10monthalm = -1;
1634 static gint hf_r3_dumpm41t81_reg0a_1monthalm = -1;
1635 static gint hf_r3_dumpm41t81_reg0b_rpt5 = -1;
1636 static gint hf_r3_dumpm41t81_reg0b_rpt4 = -1;
1637 static gint hf_r3_dumpm41t81_reg0b_10dayalm = -1;
1638 static gint hf_r3_dumpm41t81_reg0b_1dayalm = -1;
1639 static gint hf_r3_dumpm41t81_reg0c_rpt3 = -1;
1640 static gint hf_r3_dumpm41t81_reg0c_ht = -1;
1641 static gint hf_r3_dumpm41t81_reg0c_10houralm = -1;
1642 static gint hf_r3_dumpm41t81_reg0c_1houralm = -1;
1643 static gint hf_r3_dumpm41t81_reg0d_rpt2 = -1;
1644 static gint hf_r3_dumpm41t81_reg0d_10minalm = -1;
1645 static gint hf_r3_dumpm41t81_reg0d_1minalm = -1;
1646 static gint hf_r3_dumpm41t81_reg0e_rpt1 = -1;
1647 static gint hf_r3_dumpm41t81_reg0e_10secalm = -1;
1648 static gint hf_r3_dumpm41t81_reg0e_1secalm = -1;
1649 static gint hf_r3_dumpm41t81_reg0f_wdf = -1;
1650 static gint hf_r3_dumpm41t81_reg0f_af = -1;
1651 static gint hf_r3_dumpm41t81_reg0f_notused = -1;
1652 static gint hf_r3_dumpm41t81_reg10_notused = -1;
1653 static gint hf_r3_dumpm41t81_reg11_notused = -1;
1654 static gint hf_r3_dumpm41t81_reg12_notused = -1;
1655 static gint hf_r3_dumpm41t81_reg13_rs = -1;
1656 static gint hf_r3_dumpm41t81_reg13_notused = -1;
1657 
1658 static gint hf_r3_sn_manufacturer = -1;
1659 static gint hf_r3_sn_year = -1;
1660 static gint hf_r3_sn_week = -1;
1661 static gint hf_r3_sn_model = -1;
1662 static gint hf_r3_sn_sequence = -1;
1663 static gint hf_r3_sn_group = -1;
1664 static gint hf_r3_sn_nid = -1;
1665 static gint hf_r3_sn_hid = -1;
1666 static gint hf_r3_sn_power_supply = -1;
1667 static gint hf_r3_sn_mortise = -1;
1668 
1669 static gint hf_r3_debuglog_recordnumber = -1;
1670 static gint hf_r3_debuglog_flags = -1;
1671 static gint hf_r3_debuglog_tick = -1;
1672 
1673 static gint hf_r3_adduserparamtype = -1;
1674 static gint hf_r3_adduserparamtypelength = -1;
1675 static gint hf_r3_adduserparamtypetype = -1;
1676 /*static gint hf_r3_adduserparamtypedatalen = -1;*/
1677 /*static gint hf_r3_adduserparamtypeerror = -1;*/
1678 static gint hf_r3_adduserparamtypearray [ADDUSERPARAMTYPE_LAST];
1679 
1680 static gint ett_r3 = -1;
1681 static gint ett_r3header = -1;
1682 static gint ett_r3tail = -1;
1683 static gint ett_r3payload = -1;
1684 static gint ett_r3cmd = -1;
1685 static gint ett_r3configitem = -1;
1686 static gint ett_r3upstreamcommand = -1;
1687 static gint ett_r3upstreamfield = -1;
1688 static gint ett_r3timezone = -1;
1689 static gint ett_r3expireon = -1;
1690 static gint ett_r3datetime = -1;
1691 static gint ett_r3eventlogrecord = -1;
1692 static gint ett_r3declinedlogrecord = -1;
1693 static gint ett_r3alarmlogrecord = -1;
1694 static gint ett_r3debugmsg = -1;
1695 static gint ett_r3defineexceptionstartdate = -1;
1696 static gint ett_r3defineexceptionenddate = -1;
1697 static gint ett_r3defineexceptiongroupbits = -1;
1698 static gint ett_r3definecalendarmonth [13] = {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
1699 static gint ett_r3definetimezonestarttime = -1;
1700 static gint ett_r3definetimezoneendtime = -1;
1701 static gint ett_r3definetimezonedaymap = -1;
1702 static gint ett_r3eventlogdumpstarttime = -1;
1703 static gint ett_r3eventlogdumpendtime = -1;
1704 static gint ett_r3declinedlogdumpstarttime = -1;
1705 static gint ett_r3declinedlogdumpendtime = -1;
1706 static gint ett_r3alarmlogdumpstarttime = -1;
1707 static gint ett_r3alarmlogdumpendtime = -1;
1708 static gint ett_r3clearnvram = -1;
1709 static gint ett_r3filters = -1;
1710 static gint ett_r3alarmlist = -1;
1711 static gint ett_r3alarmcfg = -1;
1712 static gint ett_r3commandmfg = -1;
1713 static gint ett_r3serialnumber = -1;
1714 static gint ett_r3iopins = -1;
1715 static gint ett_r3checksumresults = -1;
1716 static gint ett_r3checksumresultsfield = -1;
1717 static gint ett_r3forceoptions = -1;
1718 static gint ett_r3peekpoke = -1;
1719 static gint ett_r3downloadfirmware = -1;
1720 static gint ett_r3capabilities = -1;
1721 static gint ett_r3lockstate = -1;
1722 static gint ett_r3mortisestatelog = -1;
1723 static gint ett_r3timerchain = -1;
1724 static gint ett_r3taskflags = -1;
1725 static gint ett_r3taskflagsentry = -1;
1726 static gint ett_r3checkpointlog = -1;
1727 static gint ett_r3checkpointlogentry = -1;
1728 static gint ett_r3cpuregisters = -1;
1729 static gint ett_r3cpuregister = -1;
1730 static gint ett_r3m41t81registers = -1;
1731 static gint ett_r3m41t81register = -1;
1732 static gint ett_r3debuglogrecord = -1;
1733 static gint ett_r3setdatetime = -1;
1734 static gint ett_r3manageuser = -1;
1735 
1736 static expert_field ei_r3_response_hasdata_octet_2 = EI_INIT;
1737 static expert_field ei_r3_mfgfield_too_many_adc_values = EI_INIT;
1738 static expert_field ei_r3_peekpoke_operation = EI_INIT;
1739 static expert_field ei_r3_response_hasdata_octet_1 = EI_INIT;
1740 static expert_field ei_r3_reserved_upstream_command_value = EI_INIT;
1741 static expert_field ei_r3_firmwaredownload_action = EI_INIT;
1742 static expert_field ei_r3_malformed_length = EI_INIT;
1743 static expert_field ei_r3_mfgfield = EI_INIT;
1744 static expert_field ei_r3_unknown_command_value = EI_INIT;
1745 static expert_field ei_r3_response_hasdata_octet_3 = EI_INIT;
1746 static expert_field ei_r3_cmd_downloadfirmwaretimeout = EI_INIT;
1747 
1748 static dissector_handle_t r3_handle = NULL;
1749 
1750 /*
1751  *  Indicates next command to be processed as a manufacturing command
1752  */
1753 static gint mfgCommandFlag = FALSE;
1754 
1755 /*
1756  *  Some enums that don't exist in public.h and should
1757  */
1758 typedef enum
1759 {
1760   CHECKPOINT_NONE = 0,
1761   CHECKPOINT_ADC,
1762   CHECKPOINT_DPAC1,
1763   CHECKPOINT_DPAC2,
1764   CHECKPOINT_I2C1,
1765   CHECKPOINT_I2C2,
1766   CHECKPOINT_I2C3,
1767   CHECKPOINT_I2C4,
1768   CHECKPOINT_I2C5,
1769   CHECKPOINT_I2C6,
1770   CHECKPOINT_I2C7,
1771   CHECKPOINT_I2C8,
1772   CHECKPOINT_I2C9,
1773   CHECKPOINT_I2C10,
1774   CHECKPOINT_I2C11,
1775   CHECKPOINT_I2C12,
1776   CHECKPOINT_I2C13,
1777   CHECKPOINT_I2C14,
1778   CHECKPOINT_I2C15,
1779   CHECKPOINT_I2C16,
1780   CHECKPOINT_I2C17,
1781   CHECKPOINT_I2C18,
1782   CHECKPOINT_I2C19,
1783   CHECKPOINT_I2C20,
1784   CHECKPOINT_I2C21,
1785   CHECKPOINT_I2C22,
1786   CHECKPOINT_I2C23,
1787   CHECKPOINT_I2C24,
1788   CHECKPOINT_I2C25,
1789   CHECKPOINT_I2C26,
1790   CHECKPOINT_I2C27,
1791   CHECKPOINT_I2C28,
1792   CHECKPOINT_I2C29,
1793   CHECKPOINT_I2C30,
1794   CHECKPOINT_I2C31,
1795   CHECKPOINT_I2C32,
1796   CHECKPOINT_I2C33,
1797   CHECKPOINT_I2C34,
1798   CHECKPOINT_I2C35,
1799   CHECKPOINT_I2C36,
1800   CHECKPOINT_I2C37,
1801   CHECKPOINT_I2C38,
1802   CHECKPOINT_I2C39,
1803   CHECKPOINT_I2C40,
1804   CHECKPOINT_I2C41,
1805   CHECKPOINT_I2C42,
1806   CHECKPOINT_I2C43,
1807   CHECKPOINT_I2C44,
1808   CHECKPOINT_I2C45,
1809   CHECKPOINT_NVRAM,
1810   CHECKPOINT_SERIAL1,
1811   CHECKPOINT_SERIAL2,
1812   CHECKPOINT_SERIAL3,
1813   CHECKPOINT_WANDERING,
1814   CHECKPOINT_STRAYHPINT,
1815   CHECKPOINT_STRAYLPINT,
1816   CHECKPOINT_TESTWDT,
1817   CHECKPOINT_DPACDEBUG,
1818   CHECKPOINT_LAST
1819 }
1820 checkPoint_e;
1821 
1822 typedef enum
1823 {
1824   CONFIGTYPE_NONE = 0,
1825   CONFIGTYPE_BOOL,
1826   CONFIGTYPE_8,
1827   CONFIGTYPE_16,
1828   CONFIGTYPE_32,
1829   CONFIGTYPE_STRING,
1830   CONFIGTYPE_LAST
1831 }
1832 configType_e;
1833 
1834 typedef enum
1835 {
1836   DOWNLOADFIRMWARE_START = 0,
1837   DOWNLOADFIRMWARE_DATA,
1838   DOWNLOADFIRMWARE_COMPLETE,
1839   DOWNLOADFIRMWARE_ABORT,
1840   DOWNLOADFIRMWARE_RESET,
1841   DOWNLOADFIRMWARE_LAST
1842 }
1843 downloadFirmware_e;
1844 
1845 typedef enum
1846 {
1847   MORTISEEVENT_DX_THROWN = 0,
1848   MORTISEEVENT_DX_RETRACTED,
1849   MORTISEEVENT_LX_RETRACTED,
1850   MORTISEEVENT_LX_EXTENDED,
1851   MORTISEEVENT_AX_EXTENDED,
1852   MORTISEEVENT_AX_RETRACTED,
1853   MORTISEEVENT_RX_DEPRESSED,
1854   MORTISEEVENT_RX_RELEASED,
1855   MORTISEEVENT_PX_OPEN,
1856   MORTISEEVENT_PX_CLOSED,
1857   MORTISEEVENT_MX_UNLOCKED,
1858   MORTISEEVENT_MX_LOCKED,
1859   MORTISEEVENT_LAST,
1860   MORTISEEVENT_IGNORE
1861 }
1862 mortiseEvent_e;
1863 
1864 /*
1865  *  Print things with nice textual names
1866  */
1867 static const value_string r3_accessmodenames [] =
1868 {
1869   { ACCESSMODE_NONE,            "ACCESMODE_NONE" },
1870   { ACCESSMODE_PRIMARYONLY,     "ACCESSMODE_PRIMARYONLY" },
1871   { ACCESSMODE_PRIMARYORAUX,    "ACCESSMODE_PRIMARYORAUX" },
1872   { ACCESSMODE_PRIMARYANDAUX,   "ACCESSMODE_PRIMARYANDAUX" },
1873   { ACCESSMODE_PRIMARYTHENAUX,  "ACCESSMODE_PRIMARYTHENAUX" },
1874   { 0,                          NULL }
1875 };
1876 static value_string_ext r3_accessmodenames_ext = VALUE_STRING_EXT_INIT(r3_accessmodenames);
1877 
1878 static const value_string r3_adduserparamtypenames [] =
1879 {
1880   { ADDUSERPARAMTYPE_DISPOSITION,      "ADDUSERPARAMTYPE_DISPOSITION" },
1881   { ADDUSERPARAMTYPE_USERNO,           "ADDUSERPARAMTYPE_USERNO" },
1882   { ADDUSERPARAMTYPE_ACCESSALWAYS,     "ADDUSERPARAMTYPE_ACCESSALWAYS" },
1883   { ADDUSERPARAMTYPE_ACCESSMODE,       "ADDUSERPARAMTYPE_ACCESSMODE" },
1884   { ADDUSERPARAMTYPE_CACHED,           "ADDUSERPARAMTYPE_CACHED" },
1885   { ADDUSERPARAMTYPE_USERTYPE,         "ADDUSERPARAMTYPE_USERTYPE" },
1886   { ADDUSERPARAMTYPE_PRIMARYFIELD,     "ADDUSERPARAMTYPE_PRIMARYFIELD" },
1887   { ADDUSERPARAMTYPE_PRIMARYFIELDTYPE, "ADDUSERPARAMTYPE_PRIMARYFIELDTYPE" },
1888   { ADDUSERPARAMTYPE_AUXFIELD,         "ADDUSERPARAMTYPE_AUXFIELD" },
1889   { ADDUSERPARAMTYPE_AUXFIELDTYPE,     "ADDUSERPARAMTYPE_AUXFIELDTYPE" },
1890   { ADDUSERPARAMTYPE_TIMEZONE,         "ADDUSERPARAMTYPE_TIMEZONE" },
1891   { ADDUSERPARAMTYPE_EXPIREON,         "ADDUSERPARAMTYPE_EXPIREON" },
1892   { ADDUSERPARAMTYPE_USECOUNT,         "ADDUSERPARAMTYPE_USECOUNT" },
1893   { ADDUSERPARAMTYPE_EXCEPTIONGROUP,   "ADDUSERPARAMTYPE_EXCEPTIONGROUP" },
1894   { 0,                                 NULL }
1895 };
1896 static value_string_ext r3_adduserparamtypenames_ext = VALUE_STRING_EXT_INIT(r3_adduserparamtypenames);
1897 
1898 static const value_string r3_alarmidnames [] =
1899 {
1900   { ALARMID_NONE,         "ALARMID_NONE" },
1901   { ALARMID_VALIDIN,      "ALARMID_VALIDIN" },
1902   { ALARMID_DENIEDACCESS, "ALARMID_DENIEDACCESS" },
1903   { ALARMID_SECURED,      "ALARMID_SECURED" },
1904   { ALARMID_DOORFORCED,   "ALARMID_DOORFORCED" },
1905   { ALARMID_KEYOVERRIDE,  "ALARMID_KEYOVERRIDE" },
1906   { ALARMID_INVALIDENTRY, "ALARMID_INVALIDENTRY" },
1907   { ALARMID_DOORAJAR,     "ALARMID_DOORAJAR" },
1908   { ALARMID_LOWBATTERY,   "ALARMID_LOWBATTERY" },
1909   { ALARMID_RXHELD,       "ALARMID_RXHELD" },
1910   { 0,                    NULL }
1911 };
1912 static value_string_ext r3_alarmidnames_ext = VALUE_STRING_EXT_INIT(r3_alarmidnames);
1913 
1914 static const value_string r3_capabilitiesnames [] =
1915 {
1916   { CAPABILITIES_USERS,           "CAPABILITIES_USERS" },
1917   { CAPABILITIES_TIMEZONES,       "CAPABILITIES_TIMEZONES" },
1918   { CAPABILITIES_EXCEPTIONS,      "CAPABILITIES_EXCEPTIONS" },
1919   { CAPABILITIES_EXCEPTIONGROUPS, "CAPABILITIES_EXCEPTIONGROUPS" },
1920   { CAPABILITIES_EVENTLOG,        "CAPABILITIES_EVENTLOG" },
1921   { CAPABILITIES_DECLINEDLOG,     "CAPABILITIES_DECLINEDLOG" },
1922   { CAPABILITIES_ALARMLOG,        "CAPABILITIES_ALARMLOG" },
1923   { CAPABILITIES_TOTALEVENTS,     "CAPABILITIES_TOTALEVENTS" },
1924   { 0,                            NULL }
1925 };
1926 static value_string_ext r3_capabilitiesnames_ext = VALUE_STRING_EXT_INIT(r3_capabilitiesnames);
1927 
1928 static const value_string r3_checkpointnames [] =
1929 {
1930   { CHECKPOINT_NONE,       "CHECKPOINT_NONE" },
1931   { CHECKPOINT_ADC,        "CHECKPOINT_ADC" },
1932   { CHECKPOINT_DPAC1,      "CHECKPOINT_DPAC1" },
1933   { CHECKPOINT_DPAC2,      "CHECKPOINT_DPAC2" },
1934   { CHECKPOINT_I2C1,       "CHECKPOINT_I2C1" },
1935   { CHECKPOINT_I2C2,       "CHECKPOINT_I2C2" },
1936   { CHECKPOINT_I2C3,       "CHECKPOINT_I2C3" },
1937   { CHECKPOINT_I2C4,       "CHECKPOINT_I2C4" },
1938   { CHECKPOINT_I2C5,       "CHECKPOINT_I2C5" },
1939   { CHECKPOINT_I2C6,       "CHECKPOINT_I2C6" },
1940   { CHECKPOINT_I2C7,       "CHECKPOINT_I2C7" },
1941   { CHECKPOINT_I2C8,       "CHECKPOINT_I2C8" },
1942   { CHECKPOINT_I2C9,       "CHECKPOINT_I2C9" },
1943   { CHECKPOINT_I2C10,      "CHECKPOINT_I2C10" },
1944   { CHECKPOINT_I2C11,      "CHECKPOINT_I2C11" },
1945   { CHECKPOINT_I2C12,      "CHECKPOINT_I2C12" },
1946   { CHECKPOINT_I2C13,      "CHECKPOINT_I2C13" },
1947   { CHECKPOINT_I2C14,      "CHECKPOINT_I2C14" },
1948   { CHECKPOINT_I2C15,      "CHECKPOINT_I2C15" },
1949   { CHECKPOINT_I2C16,      "CHECKPOINT_I2C16" },
1950   { CHECKPOINT_I2C17,      "CHECKPOINT_I2C17" },
1951   { CHECKPOINT_I2C18,      "CHECKPOINT_I2C18" },
1952   { CHECKPOINT_I2C19,      "CHECKPOINT_I2C19" },
1953   { CHECKPOINT_I2C20,      "CHECKPOINT_I2C20" },
1954   { CHECKPOINT_I2C21,      "CHECKPOINT_I2C21" },
1955   { CHECKPOINT_I2C22,      "CHECKPOINT_I2C22" },
1956   { CHECKPOINT_I2C23,      "CHECKPOINT_I2C23" },
1957   { CHECKPOINT_I2C24,      "CHECKPOINT_I2C24" },
1958   { CHECKPOINT_I2C25,      "CHECKPOINT_I2C25" },
1959   { CHECKPOINT_I2C26,      "CHECKPOINT_I2C26" },
1960   { CHECKPOINT_I2C27,      "CHECKPOINT_I2C27" },
1961   { CHECKPOINT_I2C28,      "CHECKPOINT_I2C28" },
1962   { CHECKPOINT_I2C29,      "CHECKPOINT_I2C29" },
1963   { CHECKPOINT_I2C30,      "CHECKPOINT_I2C30" },
1964   { CHECKPOINT_I2C31,      "CHECKPOINT_I2C31" },
1965   { CHECKPOINT_I2C32,      "CHECKPOINT_I2C32" },
1966   { CHECKPOINT_I2C33,      "CHECKPOINT_I2C33" },
1967   { CHECKPOINT_I2C34,      "CHECKPOINT_I2C34" },
1968   { CHECKPOINT_I2C35,      "CHECKPOINT_I2C35" },
1969   { CHECKPOINT_I2C36,      "CHECKPOINT_I2C36" },
1970   { CHECKPOINT_I2C37,      "CHECKPOINT_I2C37" },
1971   { CHECKPOINT_I2C38,      "CHECKPOINT_I2C38" },
1972   { CHECKPOINT_I2C39,      "CHECKPOINT_I2C39" },
1973   { CHECKPOINT_I2C40,      "CHECKPOINT_I2C40" },
1974   { CHECKPOINT_I2C41,      "CHECKPOINT_I2C41" },
1975   { CHECKPOINT_I2C42,      "CHECKPOINT_I2C42" },
1976   { CHECKPOINT_I2C43,      "CHECKPOINT_I2C43" },
1977   { CHECKPOINT_I2C44,      "CHECKPOINT_I2C44" },
1978   { CHECKPOINT_I2C45,      "CHECKPOINT_I2C45" },
1979   { CHECKPOINT_NVRAM,      "CHECKPOINT_NVRAM" },
1980   { CHECKPOINT_SERIAL1,    "CHECKPOINT_SERIAL1" },
1981   { CHECKPOINT_SERIAL2,    "CHECKPOINT_SERIAL2" },
1982   { CHECKPOINT_SERIAL3,    "CHECKPOINT_SERIAL3" },
1983   { CHECKPOINT_WANDERING,  "CHECKPOINT_WANDERING" },
1984   { CHECKPOINT_STRAYHPINT, "CHECKPOINT_STRAYHPINT" },
1985   { CHECKPOINT_STRAYLPINT, "CHECKPOINT_STRAYLPINT" },
1986   { CHECKPOINT_TESTWDT,    "CHECKPOINT_TESTWDT" },
1987   { CHECKPOINT_DPACDEBUG,  "CHECKPOINT_DPACDEBUG" },
1988   { 0,                     NULL }
1989 };
1990 static value_string_ext r3_checkpointnames_ext = VALUE_STRING_EXT_INIT(r3_checkpointnames);
1991 
1992 static const value_string r3_checksumresultnames [] =
1993 {
1994   { CHECKSUMRESULT_CONFIGURATIONNVRAM,  "CHECKSUMRESULT_CONFIGURATIONNVRAM" },
1995   { CHECKSUMRESULT_EXCEPTIONS,          "CHECKSUMRESULT_EXCEPTIONS" },
1996   { CHECKSUMRESULT_EXCEPTIONGROUPS,     "CHECKSUMRESULT_EXCEPTIONGROUPS" },
1997   { CHECKSUMRESULT_TZCALENDARS,         "CHECKSUMRESULT_TZCALENDARS" },
1998   { CHECKSUMRESULT_TIMEZONES,           "CHECKSUMRESULT_TIMEZONES" },
1999   { CHECKSUMRESULT_USERS,               "CHECKSUMRESULT_USERS" },
2000   { CHECKSUMRESULT_CACHELRU,            "CHECKSUMRESULT_CACHELRU" },
2001   { 0,                                  NULL }
2002 };
2003 static value_string_ext r3_checksumresultnames_ext = VALUE_STRING_EXT_INIT(r3_checksumresultnames);
2004 
2005 static const value_string r3_cmdnames [] =
2006 {
2007   { CMD_RESPONSE,                  "CMD_RESPONSE" },
2008   { CMD_HANDSHAKE,                 "CMD_HANDSHAKE" },
2009   { CMD_KILLSESSION,               "CMD_KILLSESSION" },
2010   { CMD_QUERYSERIALNUMBER,         "CMD_QUERYSERIALNUMBER" },
2011   { CMD_QUERYVERSION,              "CMD_QUERYVERSION" },
2012   { CMD_SETDATETIME,               "CMD_SETDATETIME" },
2013   { CMD_QUERYDATETIME,             "CMD_QUERYDATETIME" },
2014   { CMD_SETCONFIG,                 "CMD_SETCONFIG" },
2015   { CMD_GETCONFIG,                 "CMD_GETCONFIG" },
2016   { CMD_MANAGEUSER,                "CMD_MANAGEUSER" },
2017   { CMD_DELETEUSERS,               "CMD_DELETEUSERS" },
2018   { CMD_DEFINEEXCEPTION,           "CMD_DEFINEEXCEPTION" },
2019   { CMD_DEFINEEXCEPTIONGROUP,      "CMD_DEFINEEXCEPTIONGROUP" },
2020   { CMD_DEFINECALENDAR,            "CMD_DEFINECALENDAR" },
2021   { CMD_DEFINETIMEZONE,            "CMD_DEFINETIMEZONE" },
2022   { CMD_RMTAUTHRETRY,              "CMD_RMTAUTHRETRY" },
2023   { CMD_FILTERS,                   "CMD_FILTERS" },
2024   { CMD_ALARMCONFIGURE,            "CMD_ALARMCONFIGURE" },
2025   { CMD_EVENTLOGDUMP,              "CMD_EVENTLOGDUMP" },
2026   { CMD_DECLINEDLOGDUMP,           "CMD_DECLINEDLOGDUMP" },
2027   { CMD_ALARMLOGDUMP,              "CMD_ALARMLOGDUMP" },
2028   { CMD_DOWNLOADFIRMWARE,          "CMD_DOWNLOADFIRMWARE" },
2029   { CMD_DOWNLOADFIRMWARETIMEOUT,   "CMD_DOWNLOADFIRMWARETIMEOUT" },
2030   { CMD_POWERTABLESELECTION,       "CMD_POWERTABLESELECTION" },
2031   { CMD_CLEARNVRAM,                "CMD_CLEARNVRAM" },
2032   { CMD_DPAC,                      "CMD_DPAC" },
2033   { CMD_SELFTEST,                  "CMD_SELFTEST" },
2034   { CMD_RESET,                     "CMD_RESET" },
2035   { CMD_LOGWRITE,                  "CMD_LOGWRITE" },
2036   { CMD_MFGCOMMAND,                "CMD_MFGCOMMAND" },
2037   { CMD_NVRAMBACKUP,               "CMD_NVRAMBACKUP" },
2038   { CMD_EXTENDEDRESPONSE,          "CMD_EXTENDEDRESPONSE" },
2039   { 0,                             NULL }
2040 };
2041 static value_string_ext r3_cmdnames_ext = VALUE_STRING_EXT_INIT(r3_cmdnames);
2042 
2043 static const value_string r3_cmdmfgnames [] =
2044 {
2045   { CMDMFG_SETSERIALNUMBER,       "CMDMFG_SETSERIALNUMBER" },
2046   { CMDMFG_SETCRYPTKEY,           "CMDMFG_SETCRYPTKEY" },
2047   { CMDMFG_DUMPNVRAM,             "CMDMFG_DUMPNVRAM" },
2048   { CMDMFG_TERMINAL,              "CMDMFG_TERMINAL" },
2049   { CMDMFG_REMOTEUNLOCK,          "CMDMFG_REMOTEUNLOCK" },
2050   { CMDMFG_AUXCTLRVERSION,        "CMDMFG_AUXCTLRVERSION" },
2051   { CMDMFG_IOPINS,                "CMDMFG_IOPINS" },
2052   { CMDMFG_ADCS,                  "CMDMFG_ADCS" },
2053   { CMDMFG_HARDWAREID,            "CMDMFG_HARDWAREID" },
2054   { CMDMFG_CHECKPOINTLOGDUMP,     "CMDMFG_CHECKPOINTLOGDUMP" },
2055   { CMDMFG_CHECKPOINTLOGCLEAR,    "CMDMFG_CHECKPOINTLOGCLEAR" },
2056   { CMDMFG_READREGISTERS,         "CMDMFG_READREGISTERS" },
2057   { CMDMFG_FORCEOPTIONS,          "CMDMFG_FORCEOPTIONS" },
2058   { CMDMFG_COMMUSER,              "CMDMFG_COMMUSER" },
2059   { CMDMFG_DUMPKEYPAD,            "CMDMFG_DUMPKEYPAD" },
2060   { CMDMFG_BATTERYCHECK,          "CMDMFG_BATTERYCHECK" },
2061   { CMDMFG_RAMREFRESH,            "CMDMFG_RAMREFRESH" },
2062   { CMDMFG_TASKFLAGS,             "CMDMFG_TASKFLAGS" },
2063   { CMDMFG_TIMERCHAIN,            "CMDMFG_TIMERCHAIN" },
2064   { CMDMFG_PEEKPOKE,              "CMDMFG_PEEKPOKE" },
2065   { CMDMFG_LOCKSTATE,             "CMDMFG_LOCKSTATE" },
2066   { CMDMFG_CAPABILITIES,          "CMDMFG_CAPABILITIES" },
2067   { CMDMFG_DUMPM41T81,            "CMDMFG_DUMPM41T81" },
2068   { CMDMFG_DEBUGLOGDUMP,          "CMDMFG_DEBUGLOGDUMP" },
2069   { CMDMFG_DEBUGLOGCLEAR,         "CMDMFG_DEBUGLOGCLEAR" },
2070   { CMDMFG_TESTWDT,               "CMDMFG_TESTWDT" },
2071   { CMDMFG_QUERYCKSUM,            "CMDMFG_QUERYCKSUM" },
2072   { CMDMFG_VALIDATECHECKSUMS,     "CMDMFG_VALIDATECHECKSUMS" },
2073   { CMDMFG_REBUILDLRUCACHE,       "CMDMFG_REBUILDLRUCACHE" },
2074   { CMDMFG_TZUPDATE,              "CMDMFG_TZUPDATE" },
2075   { CMDMFG_TESTPRESERVE,          "CMDMFG_TESTPRESERVE" },
2076   { CMDMFG_MORTISESTATELOGDUMP,   "CMDMFG_MORTISESTATELOGDUMP" },
2077   { CMDMFG_MORTISESTATELOGCLEAR,  "CMDMFG_MORTISESTATELOGCLEAR" },
2078   { CMDMFG_MORTISEPINS,           "CMDMFG_MORTISEPINS" },
2079   { CMDMFG_HALTANDCATCHFIRE,      "CMDMFG_HALTANDCATCHFIRE" },
2080   { 0,                            NULL }
2081 };
2082 static value_string_ext r3_cmdmfgnames_ext = VALUE_STRING_EXT_INIT(r3_cmdmfgnames);
2083 
2084 static const value_string r3_configitemnames [] =
2085 {
2086   { CONFIGITEM_SERIAL_NUMBER,               "CONFIGITEM_SERIAL_NUMBER" },
2087   { CONFIGITEM_CRYPT_KEY,                   "CONFIGITEM_CRYPT_KEY" },
2088   { CONFIGITEM_HARDWARE_OPTIONS_MFG,        "CONFIGITEM_HARDWARE_OPTIONS_MFG" },
2089   { CONFIGITEM_HARDWARE_OPTIONS,            "CONFIGITEM_HARDWARE_OPTIONS" },
2090   { CONFIGITEM_NVRAM_CHANGES,               "CONFIGITEM_NVRAM_CHANGES" },
2091   { CONFIGITEM_NVRAMDIRTY,                  "CONFIGITEM_NVRAMDIRTY" },
2092   { CONFIGITEM_NVRAM_WV,                    "CONFIGITEM_NVRAM_WV" },
2093   { CONFIGITEM_ENABLE_WDT,                  "CONFIGITEM_ENABLE_WDT" },
2094   { CONFIGITEM_EARLY_ACK,                   "CONFIGITEM_EARLY_ACK" },
2095   { CONFIGITEM_CONSOLE_AES_ONLY,            "CONFIGITEM_CONSOLE_AES_ONLY" },
2096   { CONFIGITEM_RADIO_AES_ONLY,              "CONFIGITEM_RADIO_AES_ONLY" },
2097   { CONFIGITEM_NDRLE,                       "CONFIGITEM_NDRLE" },
2098   { CONFIGITEM_SOMF,                        "CONFIGITEM_SOMF" },
2099   { CONFIGITEM_NOGAF,                       "CONFIGITEM_NOGAF" },
2100   { CONFIGITEM_CARD_READER_POWER,           "CONFIGITEM_CARD_READER_POWER" },
2101   { CONFIGITEM_PROX_ENABLE,                 "CONFIGITEM_PROX_ENABLE" },
2102   { CONFIGITEM_CKSUMCONFIG,                 "CONFIGITEM_CKSUMCONFIG" },
2103   { CONFIGITEM_DAILY_BATTERY_CHECK,         "CONFIGITEM_DAILY_BATTERY_CHECK" },
2104   { CONFIGITEM_DAILY_BATTERY_CHECK_HOUR,    "CONFIGITEM_DAILY_BATTERY_CHECK_HOUR" },
2105   { CONFIGITEM_BATTERY_LOW,                 "CONFIGITEM_BATTERY_LOW" },
2106   { CONFIGITEM_LRU_HEAD,                    "CONFIGITEM_LRU_HEAD" },
2107   { CONFIGITEM_LRU_TAIL,                    "CONFIGITEM_LRU_TAIL" },
2108   { CONFIGITEM_RTC_CALIBRATION,             "CONFIGITEM_RTC_CALIBRATION" },
2109   { CONFIGITEM_ACVREQUESTER,                "CONFIGITEM_ACVREQUESTER" },
2110   { CONFIGITEM_LOCAL_LED,                   "CONFIGITEM_LOCAL_LED" },
2111   { CONFIGITEM_ERRCNT_XORLEN,               "CONFIGITEM_ERRCNT_XORLEN" },
2112   { CONFIGITEM_ERRCNT_CRC,                  "CONFIGITEM_ERRCNT_CRC" },
2113   { CONFIGITEM_ERRCNT_NOTSIGIL,             "CONFIGITEM_ERRCNT_NOTSIGIL" },
2114   { CONFIGITEM_ERRCNT_TIMEOUT,              "CONFIGITEM_ERRCNT_TIMEOUT" },
2115   { CONFIGITEM_ERRCNT_TOOLONG,              "CONFIGITEM_ERRCNT_TOOLONG" },
2116   { CONFIGITEM_ERRCNT_TOOSHORT,             "CONFIGITEM_ERRCNT_TOOSHORT" },
2117   { CONFIGITEM_ERRCNT_HITDEFAULT,           "CONFIGITEM_ERRCNT_HITDEFAULT" },
2118   { CONFIGITEM_ERRCNT_OVERRUN,              "CONFIGITEM_ERRCNT_OVERRUN" },
2119   { CONFIGITEM_ERRCNT_UARTFE,               "CONFIGITEM_ERRCNT_UARTFE" },
2120   { CONFIGITEM_ERRCNT_UARTOE,               "CONFIGITEM_ERRCNT_UARTOE" },
2121   { CONFIGITEM_DST_SET,                     "CONFIGITEM_DST_SET" },
2122   { CONFIGITEM_DST_MODE,                    "CONFIGITEM_DST_MODE" },
2123   { CONFIGITEM_DST_FORWARD_MONTH,           "CONFIGITEM_DST_FORWARD_MONTH" },
2124   { CONFIGITEM_DST_FORWARD_DOM,             "CONFIGITEM_DST_FORWARD_DOM" },
2125   { CONFIGITEM_DST_FORWARD_OOD,             "CONFIGITEM_DST_FORWARD_OOD" },
2126   { CONFIGITEM_DST_FORWARD_DOW,             "CONFIGITEM_DST_FORWARD_DOW" },
2127   { CONFIGITEM_DST_FORWARD_HOUR,            "CONFIGITEM_DST_FORWARD_HOUR" },
2128   { CONFIGITEM_DST_FORWARD_MINUTE,          "CONFIGITEM_DST_FORWARD_MINUTE" },
2129   { CONFIGITEM_DST_FORWARD_ADJUST,          "CONFIGITEM_DST_FORWARD_ADJUST" },
2130   { CONFIGITEM_DST_BACK_MONTH,              "CONFIGITEM_DST_BACK_MONTH" },
2131   { CONFIGITEM_DST_BACK_DOM,                "CONFIGITEM_DST_BACK_DOM" },
2132   { CONFIGITEM_DST_BACK_OOD,                "CONFIGITEM_DST_BACK_OOD" },
2133   { CONFIGITEM_DST_BACK_DOW,                "CONFIGITEM_DST_BACK_DOW" },
2134   { CONFIGITEM_DST_BACK_HOUR,               "CONFIGITEM_DST_BACK_HOUR" },
2135   { CONFIGITEM_DST_BACK_MINUTE,             "CONFIGITEM_DST_BACK_MINUTE" },
2136   { CONFIGITEM_DST_BACK_ADJUST,             "CONFIGITEM_DST_BACK_ADJUST" },
2137   { CONFIGITEM_EVENTLOG_ZEROMEM,            "CONFIGITEM_EVENTLOG_ZEROMEM" },
2138   { CONFIGITEM_EVENTLOG_BEGIN,              "CONFIGITEM_EVENTLOG_BEGIN" },
2139   { CONFIGITEM_EVENTLOG_RECORD,             "CONFIGITEM_EVENTLOG_RECORD" },
2140   { CONFIGITEM_EVENTLOG_ENTRIES,            "CONFIGITEM_EVENTLOG_ENTRIES" },
2141   { CONFIGITEM_EVENTLOG_WARNDEVICE,         "CONFIGITEM_EVENTLOG_WARNDEVICE" },
2142   { CONFIGITEM_EVENTLOG_WARNEVERY,          "CONFIGITEM_EVENTLOG_WARNEVERY" },
2143   { CONFIGITEM_EVENTLOG_RMTDEVICE,          "CONFIGITEM_EVENTLOG_RMTDEVICE" },
2144   { CONFIGITEM_DECLINEDLOG_ZEROMEM,         "CONFIGITEM_DECLINEDLOG_ZEROMEM" },
2145   { CONFIGITEM_DECLINEDLOG_BEGIN,           "CONFIGITEM_DECLINEDLOG_BEGIN" },
2146   { CONFIGITEM_DECLINEDLOG_RECORD,          "CONFIGITEM_DECLINEDLOG_RECORD" },
2147   { CONFIGITEM_DECLINEDLOG_ENTRIES,         "CONFIGITEM_DECLINEDLOG_ENTRIES" },
2148   { CONFIGITEM_DECLINEDLOG_WARNDEVICE,      "CONFIGITEM_DECLINEDLOG_WARNDEVICE" },
2149   { CONFIGITEM_DECLINEDLOG_WARNEVERY,       "CONFIGITEM_DECLINEDLOG_WARNEVERY" },
2150   { CONFIGITEM_DECLINEDLOG_RMTDEVICE,       "CONFIGITEM_DECLINEDLOG_RMTDEVICE" },
2151   { CONFIGITEM_ALARMLOG_ZEROMEM,            "CONFIGITEM_ALARMLOG_ZEROMEM" },
2152   { CONFIGITEM_ALARMLOG_BEGIN,              "CONFIGITEM_ALARMLOG_BEGIN" },
2153   { CONFIGITEM_ALARMLOG_RECORD,             "CONFIGITEM_ALARMLOG_RECORD" },
2154   { CONFIGITEM_ALARMLOG_ENTRIES,            "CONFIGITEM_ALARMLOG_ENTRIES" },
2155   { CONFIGITEM_ALARMLOG_WARNDEVICE,         "CONFIGITEM_ALARMLOG_WARNDEVICE" },
2156   { CONFIGITEM_ALARMLOG_WARNEVERY,          "CONFIGITEM_ALARMLOG_WARNEVERY" },
2157   { CONFIGITEM_ALARMLOG_RMTDEVICE,          "CONFIGITEM_ALARMLOG_RMTDEVICE" },
2158   { CONFIGITEM_VISIBLE_FEEDBACK,            "CONFIGITEM_VISIBLE_FEEDBACK" },
2159   { CONFIGITEM_AUDIBLE_FEEDBACK,            "CONFIGITEM_AUDIBLE_FEEDBACK" },
2160   { CONFIGITEM_VISIBLE_INDICATORS,          "CONFIGITEM_VISIBLE_INDICATORS" },
2161   { CONFIGITEM_AUDIBLE_INDICATORS,          "CONFIGITEM_AUDIBLE_INDICATORS" },
2162   { CONFIGITEM_2NDPINDURATION,              "CONFIGITEM_2NDPINDURATION" },
2163   { CONFIGITEM_LOCKOUT_ATTEMPTS,            "CONFIGITEM_LOCKOUT_ATTEMPTS" },
2164   { CONFIGITEM_LOCKOUT_DURATION,            "CONFIGITEM_LOCKOUT_DURATION" },
2165   { CONFIGITEM_KEYPAD_INACTIVITY,           "CONFIGITEM_KEYPAD_INACTIVITY" },
2166   { CONFIGITEM_ICIDLE_DURATION,             "CONFIGITEM_ICIDLE_DURATION" },
2167   { CONFIGITEM_WRITE_DECLINED_LOG,          "CONFIGITEM_WRITE_DECLINED_LOG" },
2168   { CONFIGITEM_LOW_BATTERY_INDICATOR,       "CONFIGITEM_LOW_BATTERY_INDICATOR" },
2169   { CONFIGITEM_PANIC_MODE,                  "CONFIGITEM_PANIC_MODE" },
2170   { CONFIGITEM_TIMEZONE_ENABLE,             "CONFIGITEM_TIMEZONE_ENABLE" },
2171   { CONFIGITEM_EXCEPTION_ENABLE,            "CONFIGITEM_EXCEPTION_ENABLE" },
2172   { CONFIGITEM_AUTOUNLOCK_ENABLE,           "CONFIGITEM_AUTOUNLOCK_ENABLE" },
2173   { CONFIGITEM_LOCK_PRIORITY_EMERGENCY,     "CONFIGITEM_LOCK_PRIORITY_EMERGENCY" },
2174   { CONFIGITEM_LOCK_PRIORITY_SUPERVISOR,    "CONFIGITEM_LOCK_PRIORITY_SUPERVISOR" },
2175   { CONFIGITEM_LOCK_PRIORITY_USER,          "CONFIGITEM_LOCK_PRIORITY_USER" },
2176   { CONFIGITEM_LOCK_PRIORITY_PASSAGE,       "CONFIGITEM_LOCK_PRIORITY_PASSAGE" },
2177   { CONFIGITEM_LOCK_PRIORITY_PANIC,         "CONFIGITEM_LOCK_PRIORITY_PANIC" },
2178   { CONFIGITEM_LOCK_PRIORITY_LOCKOUT,       "CONFIGITEM_LOCK_PRIORITY_LOCKOUT" },
2179   { CONFIGITEM_LOCK_PRIORITY_RELOCK,        "CONFIGITEM_LOCK_PRIORITY_RELOCK" },
2180   { CONFIGITEM_LOCK_PRIORITY_BOLTTHROWN,    "CONFIGITEM_LOCK_PRIORITY_BOLTTHROWN" },
2181   { CONFIGITEM_LOCK_PRIORITY_CONFIGCHANGE,  "CONFIGITEM_LOCK_PRIORITY_CONFIGCHANGE" },
2182   { CONFIGITEM_LOCK_PRIORITY_REMOTE,        "CONFIGITEM_LOCK_PRIORITY_REMOTE" },
2183   { CONFIGITEM_LOCK_TYPE,                   "CONFIGITEM_LOCK_TYPE" },
2184   { CONFIGITEM_DOUBLE_PULSE,                "CONFIGITEM_DOUBLE_PULSE" },
2185   { CONFIGITEM_DOUBLE_DELAY,                "CONFIGITEM_DOUBLE_DELAY" },
2186   { CONFIGITEM_MOTOR_DURATION,              "CONFIGITEM_MOTOR_DURATION" },
2187   { CONFIGITEM_MORTISE_TYPE,                "CONFIGITEM_MORTISE_TYPE" },
2188   { CONFIGITEM_UNLOCK_TIME,                 "CONFIGITEM_UNLOCK_TIME" },
2189   { CONFIGITEM_EXT_UNLOCK_TIME,             "CONFIGITEM_EXT_UNLOCK_TIME" },
2190   { CONFIGITEM_DOOR_AJAR_TIME,              "CONFIGITEM_DOOR_AJAR_TIME" },
2191   { CONFIGITEM_SESSION_TIMEOUT,             "CONFIGITEM_SESSION_TIMEOUT" },
2192   { CONFIGITEM_RETRY_ON_TIMEOUT,            "CONFIGITEM_RETRY_ON_TIMEOUT" },
2193   { CONFIGITEM_UNSOLICITED_ENCRYPT,         "CONFIGITEM_UNSOLICITED_ENCRYPT" },
2194   { CONFIGITEM_RMT_AUTH_TIMEOUT,            "CONFIGITEM_RMT_AUTH_TIMEOUT" },
2195   { CONFIGITEM_RMT_AUTH_DEVICE,             "CONFIGITEM_RMT_AUTH_DEVICE" },
2196   { CONFIGITEM_ALARM_DEVICE,                "CONFIGITEM_ALARM_DEVICE" },
2197   { CONFIGITEM_NOTIFY_DEVICE,               "CONFIGITEM_NOTIFY_DEVICE" },
2198   { CONFIGITEM_COMMUSER_DEVICE,             "CONFIGITEM_COMMUSER_DEVICE" },
2199   { CONFIGITEM_SCHEDULER_DEVICE,            "CONFIGITEM_SCHEDULER_DEVICE" },
2200   { CONFIGITEM_SCHEDULER_TYPE,              "CONFIGITEM_SCHEDULER_TYPE" },
2201   { CONFIGITEM_SCHEDULER_AWAKE,             "CONFIGITEM_SCHEDULER_AWAKE" },
2202   { CONFIGITEM_SCHEDULER_PERIOD,            "CONFIGITEM_SCHEDULER_PERIOD" },
2203   { CONFIGITEM_SCHEDULER_HOD,               "CONFIGITEM_SCHEDULER_HOD" },
2204   { CONFIGITEM_SCHEDULER_DOW,               "CONFIGITEM_SCHEDULER_DOW" },
2205   { CONFIGITEM_SCHEDULER_DOM,               "CONFIGITEM_SCHEDULER_DOM" },
2206   { CONFIGITEM_SCHEDULER_HM1,               "CONFIGITEM_SCHEDULER_HM1" },
2207   { CONFIGITEM_SCHEDULER_HM2,               "CONFIGITEM_SCHEDULER_HM2" },
2208   { CONFIGITEM_SCHEDULER_HM3,               "CONFIGITEM_SCHEDULER_HM3" },
2209   { CONFIGITEM_SCHEDULER_HM4,               "CONFIGITEM_SCHEDULER_HM4" },
2210   { CONFIGITEM_RADIO_TYPE,                  "CONFIGITEM_RADIO_TYPE" },
2211   { CONFIGITEM_RADIO_MODE,                  "CONFIGITEM_RADIO_MODE" },
2212   { CONFIGITEM_RADIO_TIMEOUT,               "CONFIGITEM_RADIO_TIMEOUT" },
2213   { CONFIGITEM_RADIO_ATTEMPTS,              "CONFIGITEM_RADIO_ATTEMPTS" },
2214   { CONFIGITEM_RADIO_HOUSEKEEPING,          "CONFIGITEM_RADIO_HOUSEKEEPING" },
2215   { CONFIGITEM_RADIO_LEAPUSERNAME,          "CONFIGITEM_RADIO_LEAPUSERNAME" },
2216   { CONFIGITEM_RADIO_LEAPPASSWORD,          "CONFIGITEM_RADIO_LEAPPASSWORD" },
2217   { CONFIGITEM_INHIBIT_VOLTAGE,             "CONFIGITEM_INHIBIT_VOLTAGE" },
2218   { CONFIGITEM_LOW_VOLTAGE,                 "CONFIGITEM_LOW_VOLTAGE" },
2219   { CONFIGITEM_PT_RANGE_1,                  "CONFIGITEM_PT_RANGE_1" },
2220   { CONFIGITEM_PT_RANGE_2,                  "CONFIGITEM_PT_RANGE_2" },
2221   { CONFIGITEM_PT_RANGE_3,                  "CONFIGITEM_PT_RANGE_3" },
2222   { CONFIGITEM_PT_RANGE_4,                  "CONFIGITEM_PT_RANGE_4" },
2223   { CONFIGITEM_PT_RANGE_5,                  "CONFIGITEM_PT_RANGE_5" },
2224   { CONFIGITEM_PT_RANGE_6,                  "CONFIGITEM_PT_RANGE_6" },
2225   { CONFIGITEM_PT_RANGE_7,                  "CONFIGITEM_PT_RANGE_7" },
2226   { CONFIGITEM_PT_RANGE_8,                  "CONFIGITEM_PT_RANGE_8" },
2227   { CONFIGITEM_MAGCARD_IFS,                 "CONFIGITEM_MAGCARD_IFS" },
2228   { CONFIGITEM_MAGCARD_FIELDS,              "CONFIGITEM_MAGCARD_FIELDS" },
2229   { CONFIGITEM_MAGCARD_OFFSET,              "CONFIGITEM_MAGCARD_OFFSET" },
2230   { CONFIGITEM_MAGCARD_DIGITS,              "CONFIGITEM_MAGCARD_DIGITS" },
2231   { CONFIGITEM_ALARMS,                      "CONFIGITEM_ALARMS" },
2232   { CONFIGITEM_FILTERS,                     "CONFIGITEM_FILTERS" },
2233   { CONFIGITEM_ALARMSTATE,                  "CONFIGITEM_ALARMSTATE" },
2234   { CONFIGITEM_DOORSTATE,                   "CONFIGITEM_DOORSTATE" },
2235   { CONFIGITEM_DPACDEBUG,                   "CONFIGITEM_DPACDEBUG" },
2236   { CONFIGITEM_FAILOPENSECURE,              "CONFIGITEM_FAILOPENSECURE" },
2237   { CONFIGITEM_REPLACED_VOLTAGE,            "CONFIGITEM_REPLACED_VOLTAGE" },
2238   { CONFIGITEM_RX_HELD_TIME,                "CONFIGITEM_RX_HELD_TIME" },
2239   { CONFIGITEM_PACKET_TIMEOUT,              "CONFIGITEM_PACKET_TIMEOUT" },
2240   { CONFIGITEM_EXTENDEDRESPONSE,            "CONFIGITEM_EXTENDEDRESPONSE" },
2241   { CONFIGITEM_PASSAGEMODEINDICATOR,        "CONFIGITEM_PASSAGEMODEINDICATOR" },
2242   { CONFIGITEM_PFMRETURNTIME,               "CONFIGITEM_PFMRETURNTIME" },
2243   { 0,                                      NULL }
2244 };
2245 static value_string_ext r3_configitemnames_ext = VALUE_STRING_EXT_INIT(r3_configitemnames);
2246 
2247 static const value_string r3_configtypenames [] =
2248 {
2249   { CONFIGTYPE_NONE,    "CONFIGTYPE_NONE" },
2250   { CONFIGTYPE_BOOL,    "CONFIGTYPE_BOOL" },
2251   { CONFIGTYPE_8,       "CONFIGTYPE_8" },
2252   { CONFIGTYPE_16,      "CONFIGTYPE_16" },
2253   { CONFIGTYPE_32,      "CONFIGTYPE_32" },
2254   { CONFIGTYPE_STRING,  "CONFIGTYPE_STRING" },
2255   { 0,                  NULL }
2256 };
2257 static value_string_ext r3_configtypenames_ext = VALUE_STRING_EXT_INIT(r3_configtypenames);
2258 
2259 static const value_string r3_dispositionnames [] =
2260 {
2261   { DISPOSITION_ADD,      "DISPOSITION_ADD" },
2262   { DISPOSITION_REPLACE,  "DISPOSITION_REPLACE" },
2263   { DISPOSITION_UPDATE,   "DISPOSITION_UPDATE" },
2264   { DISPOSITION_DELETE,   "DISPOSITION_DELETE" },
2265   { DISPOSITION_RETRIEVE, "DISPOSITION_RETRIEVE" },
2266   { 0,                    NULL }
2267 };
2268 static value_string_ext r3_dispositionnames_ext = VALUE_STRING_EXT_INIT(r3_dispositionnames);
2269 
2270 static const value_string r3_deleteusersnames [] =
2271 {
2272   { DELETEUSERS_ALL,    "DELETEUSER_ALL" },
2273   { DELETEUSERS_CACHED, "DELETEUSER_CACHED" },
2274   { 0,                  NULL }
2275 };
2276 static value_string_ext r3_deleteusersnames_ext = VALUE_STRING_EXT_INIT(r3_deleteusersnames);
2277 
2278 static const value_string r3_downloadfirmwarenames [] =
2279 {
2280   { DOWNLOADFIRMWARE_START,    "DOWNLOADFIRMWARE_START" },
2281   { DOWNLOADFIRMWARE_DATA,     "DOWNLOADFIRMWARE_DATA" },
2282   { DOWNLOADFIRMWARE_COMPLETE, "DOWNLOADFIRMWARE_COMPLETE" },
2283   { DOWNLOADFIRMWARE_ABORT,    "DOWNLOADFIRMWARE_ABORT" },
2284   { DOWNLOADFIRMWARE_RESET,    "DOWNLOADFIRMWARE_RESET" },
2285   { 0,                         NULL }
2286 };
2287 static value_string_ext r3_downloadfirmwarenames_ext = VALUE_STRING_EXT_INIT(r3_downloadfirmwarenames);
2288 
2289 static const value_string r3_encryptionschemenames [] =
2290 {
2291   { ENCRYPTIONSCHEME_NONE,    "ENCRYPTIONSCHEME_NONE" },
2292   { ENCRYPTIONSCHEME_ROLLING, "ENCRYPTIONSCHEME_ROLLING" },
2293   { ENCRYPTIONSCHEME_SN,      "ENCRYPTIONSCHEME_SN" },
2294   { ENCRYPTIONSCHEME_AESIV,   "ENCRYPTIONSCHEME_AESIV" },
2295   { ENCRYPTIONSCHEME_AES,     "ENCRYPTIONSCHEME_AES" },
2296   { 0,                        NULL }
2297 };
2298 static value_string_ext r3_encryptionschemenames_ext = VALUE_STRING_EXT_INIT(r3_encryptionschemenames);
2299 
2300 static const value_string r3_eventnames [] =
2301 {
2302   { EVENT_INVALIDPIN,           "EVENT_INVALIDPIN" },
2303   { EVENT_USER,                 "EVENT_USER" },
2304   { EVENT_ONETIME,              "EVENT_ONETIME" },
2305   { EVENT_PASSAGEBEGIN,         "EVENT_PASSAGEBEGIN" },
2306   { EVENT_PASSAGEEND,           "EVENT_PASSAGEEND" },
2307   { EVENT_BADTIME,              "EVENT_BADTIME" },
2308   { EVENT_LOCKEDOUT,            "EVENT_LOCKEDOUT" },
2309   { EVENT_LOWBATTERY,           "EVENT_LOWBATTERY" },
2310   { EVENT_DEADBATTERY,          "EVENT_DEADBATTERY" },
2311   { EVENT_BATTERYREPLACED,      "EVENT_BATTERYREPLACED" },
2312   { EVENT_USERADDED,            "EVENT_USERADDED" },
2313   { EVENT_USERDELETED,          "EVENT_USERDELETED" },
2314   { EVENT_EMERGENCY,            "EVENT_EMERGENCY" },
2315   { EVENT_PANIC,                "EVENT_PANIC" },
2316   { EVENT_RELOCK,               "EVENT_RELOCK" },
2317   { EVENT_LOCKOUTBEGIN,         "EVENT_LOCKOUTBEGIN" },
2318   { EVENT_LOCKOUTEND,           "EVENT_LOCKOUTEND" },
2319   { EVENT_RESET,                "EVENT_RESET" },
2320   { EVENT_DATETIMESET,          "EVENT_DATETIMESET" },
2321   { EVENT_LOGCLEARED,           "EVENT_LOGCLEARED" },
2322   { EVENT_DBRESET,              "EVENT_DBRESET" },
2323   { EVENT_COMMSTARTED,          "EVENT_COMMSTARTED" },
2324   { EVENT_COMMENDED,            "EVENT_COMMENDED" },
2325   { EVENT_FIRMWAREABORT,        "EVENT_FIRMWAREABORT" },
2326   { EVENT_FIRMWAREERROR,        "EVENT_FIRMWAREERROR" },
2327   { EVENT_FIRMWARETIMEOUT,      "EVENT_FIRMWARETIMEOUT" },
2328   { EVENT_DSTFALLBACK,          "EVENT_DSTFALLBACK" },
2329   { EVENT_DSTSPRINGFORWARD,     "EVENT_DSTSPRINGFORWARD" },
2330   { EVENT_BOLTTHROWN,           "EVENT_BOLTTHROWN" },
2331   { EVENT_BOLTRETRACTED,        "EVENT_BOLTRETRACTED" },
2332   { EVENT_MASTERCODE,           "EVENT_MASTERCODE" },
2333   { EVENT_COMMUSER,             "EVENT_COMMUSER" },
2334   { EVENT_DPACDISABLED,         "EVENT_DPACDISABLED" },
2335   { EVENT_NOTIFY,               "EVENT_NOTIFY" },
2336   { EVENT_EXPIRED,              "EVENT_EXPIRED" },
2337   { EVENT_SUPERVISOR,           "EVENT_SUPERVISOR" },
2338   { EVENT_MCCENTER,             "EVENT_MCCENTER" },
2339   { EVENT_MCCEXIT,              "EVENT_MCCEXIT" },
2340   { EVENT_SERIALRXOVERRUN,      "EVENT_SERIALRXOVERRUN" },
2341   { EVENT_DPACRXOVERRUN,        "EVENT_DPACRXOVERRUN" },
2342   { EVENT_NVRAMPBCLEAR,         "EVENT_NVRAMPBCLEAR" },
2343   { EVENT_NVRAMLAYOUTCHANGE,    "EVENT_NVRAMLAYOUTCHANGE" },
2344   { EVENT_NVRAMOK,              "EVENT_NVRAMOK" },
2345   { EVENT_USERREPLACED,         "EVENT_USERREPLACED" },
2346   { EVENT_RADIOTIMEOUT,         "EVENT_RADIOTIMEOUT" },
2347   { EVENT_SUSPENDEDUSER,        "EVENT_SUSPENDEDUSER" },
2348   { EVENT_USERUPDATED,          "EVENT_USERUPDATED" },
2349   { EVENT_DOORBOLTED,           "EVENT_DOORBOLTED" },
2350   { EVENT_PANICACTIVE,          "EVENT_PANICACTIVE" },
2351   { EVENT_PASSAGEACTIVE,        "EVENT_PASSAGEACTIVE" },
2352   { EVENT_PASSAGEINACTIVE,      "EVENT_PASSAGEINACTIVE" },
2353   { EVENT_BADACCESSMODE,        "EVENT_BADACCESSMODE" },
2354   { EVENT_CLOCKERR,             "EVENT_CLOCKERR" },
2355   { EVENT_REMOTEUNLOCK,         "EVENT_REMOTEUNLOCK" },
2356   { EVENT_TZHAUDISABLED,        "EVENT_TZHAUDISABLED" },
2357   { EVENT_EVENTLOGWRAPPED,      "EVENT_EVENTLOGWRAPPED" },
2358   { EVENT_DECLINEDLOGWRAPPED,   "EVENT_DECLINEDLOGWRAPPED" },
2359   { EVENT_ALARMLOGWRAPPED,      "EVENT_ALARMLOGWRAPPED" },
2360   { EVENT_RADIOBUSYEMERGENCY,   "EVENT_RADIOBUSYEMERGENCY" },
2361   { EVENT_RADIOBUSYSUPERVISOR,  "EVENT_RADIOBUSYSUPERVISOR" },
2362   { EVENT_RADIOBUSYONETIME,     "EVENT_RADIOBUSYONETIME" },
2363   { EVENT_RADIOBUSYUSER,        "EVENT_RADIOBUSYUSER" },
2364   { EVENT_RADIOBUSYPANIC,       "EVENT_RADIOBUSYPANIC" },
2365   { EVENT_RADIOBUSYREX,         "EVENT_RADIOBUSYREX" },
2366   { EVENT_RADIOBUSYLOCKOUT,     "EVENT_RADIOBUSYLOCKOUT" },
2367   { EVENT_RADIOBUSYRELOCK,      "EVENT_RADIOBUSYRELOCK" },
2368   { EVENT_BATTERYCHECKHELDOFF,  "EVENT_BATTERYCHECKHELDOFF" },
2369   { EVENT_RMTAUTHREQUEST,       "EVENT_RMTAUTHREQUEST" },
2370   { EVENT_FIRMWAREUPDATE,       "EVENT_FIRMWAREUPDATE" },
2371   { EVENT_FIRMWAREUPDATEFAILED, "EVENT_FIRMWAREUPDATEFAILED" },
2372   { EVENT_MSMFAILURE,           "EVENT_MSMFAILURE" },
2373   { EVENT_CLOCKRESET,           "EVENT_CLOCKRESET" },
2374   { EVENT_POWERFAIL,            "EVENT_POWERFAIL" },
2375   { EVENT_DPAC501WENTSTUPID,    "EVENT_DPAC501WENTSTUPID" },
2376   { EVENT_CHECKSUMCONFIG,       "EVENT_CHECKSUMCONFIG" },
2377   { EVENT_CHECKSUMTZ,           "EVENT_CHECKSUMTZ" },
2378   { EVENT_DEBUG,                "EVENT_DEBUG" },
2379   { 0,                          NULL }
2380 };
2381 static value_string_ext r3_eventnames_ext = VALUE_STRING_EXT_INIT(r3_eventnames);
2382 
2383 static const value_string r3_fieldtypenames [] =
2384 {
2385   { FIELDTYPE_NONE,     "FIELDTYPE_NONE" },
2386   { FIELDTYPE_PIN,      "FIELDTYPE_PIN" },
2387   { FIELDTYPE_PROX,     "FIELDTYPE_PROX" },
2388   { FIELDTYPE_MAGCARD,  "FIELDTYPE_MAGCARD" },
2389   { 0,                  NULL }
2390 };
2391 static value_string_ext r3_fieldtypenames_ext = VALUE_STRING_EXT_INIT(r3_fieldtypenames);
2392 
2393 static const value_string r3_filtereventnames [] =
2394 {
2395   { EVENT_INVALIDPIN,           "EVENT_INVALIDPIN" },
2396   { EVENT_USER,                 "EVENT_USER" },
2397   { EVENT_ONETIME,              "EVENT_ONETIME" },
2398   { EVENT_PASSAGEBEGIN,         "EVENT_PASSAGEBEGIN" },
2399   { EVENT_PASSAGEEND,           "EVENT_PASSAGEEND" },
2400   { EVENT_BADTIME,              "EVENT_BADTIME" },
2401   { EVENT_LOCKEDOUT,            "EVENT_LOCKEDOUT" },
2402   { EVENT_LOWBATTERY,           "EVENT_LOWBATTERY" },
2403   { EVENT_DEADBATTERY,          "EVENT_DEADBATTERY" },
2404   { EVENT_BATTERYREPLACED,      "EVENT_BATTERYREPLACED" },
2405   { EVENT_USERADDED,            "EVENT_USERADDED" },
2406   { EVENT_USERDELETED,          "EVENT_USERDELETED" },
2407   { EVENT_EMERGENCY,            "EVENT_EMERGENCY" },
2408   { EVENT_PANIC,                "EVENT_PANIC" },
2409   { EVENT_RELOCK,               "EVENT_RELOCK" },
2410   { EVENT_LOCKOUTBEGIN,         "EVENT_LOCKOUTBEGIN" },
2411   { EVENT_LOCKOUTEND,           "EVENT_LOCKOUTEND" },
2412   { EVENT_RESET,                "EVENT_RESET" },
2413   { EVENT_DATETIMESET,          "EVENT_DATETIMESET" },
2414   { EVENT_LOGCLEARED,           "EVENT_LOGCLEARED" },
2415   { EVENT_DBRESET,              "EVENT_DBRESET" },
2416   { EVENT_COMMSTARTED,          "EVENT_COMMSTARTED" },
2417   { EVENT_COMMENDED,            "EVENT_COMMENDED" },
2418   { EVENT_FIRMWAREABORT,        "EVENT_FIRMWAREABORT" },
2419   { EVENT_FIRMWAREERROR,        "EVENT_FIRMWAREERROR" },
2420   { EVENT_FIRMWARETIMEOUT,      "EVENT_FIRMWARETIMEOUT" },
2421   { EVENT_DSTFALLBACK,          "EVENT_DSTFALLBACK" },
2422   { EVENT_DSTSPRINGFORWARD,     "EVENT_DSTSPRINGFORWARD" },
2423   { EVENT_BOLTTHROWN,           "EVENT_BOLTTHROWN" },
2424   { EVENT_BOLTRETRACTED,        "EVENT_BOLTRETRACTED" },
2425   { EVENT_MASTERCODE,           "EVENT_MASTERCODE" },
2426   { EVENT_COMMUSER,             "EVENT_COMMUSER" },
2427   { EVENT_DPACDISABLED,         "EVENT_DPACDISABLED" },
2428   { EVENT_NOTIFY,               "EVENT_NOTIFY" },
2429   { EVENT_EXPIRED,              "EVENT_EXPIRED" },
2430   { EVENT_SUPERVISOR,           "EVENT_SUPERVISOR" },
2431   { EVENT_MCCENTER,             "EVENT_MCCENTER" },
2432   { EVENT_MCCEXIT,              "EVENT_MCCEXIT" },
2433   { EVENT_SERIALRXOVERRUN,      "EVENT_SERIALRXOVERRUN" },
2434   { EVENT_DPACRXOVERRUN,        "EVENT_DPACRXOVERRUN" },
2435   { EVENT_NVRAMPBCLEAR,         "EVENT_NVRAMPBCLEAR" },
2436   { EVENT_NVRAMLAYOUTCHANGE,    "EVENT_NVRAMLAYOUTCHANGE" },
2437   { EVENT_NVRAMOK,              "EVENT_NVRAMOK" },
2438   { EVENT_USERREPLACED,         "EVENT_USERREPLACED" },
2439   { EVENT_RADIOTIMEOUT,         "EVENT_RADIOTIMEOUT" },
2440   { EVENT_SUSPENDEDUSER,        "EVENT_SUSPENDEDUSER" },
2441   { EVENT_USERUPDATED,          "EVENT_USERUPDATED" },
2442   { EVENT_DOORBOLTED,           "EVENT_DOORBOLTED" },
2443   { EVENT_PANICACTIVE,          "EVENT_PANICACTIVE" },
2444   { EVENT_PASSAGEACTIVE,        "EVENT_PASSAGEACTIVE" },
2445   { EVENT_PASSAGEINACTIVE,      "EVENT_PASSAGEINACTIVE" },
2446   { EVENT_BADACCESSMODE,        "EVENT_BADACCESSMODE" },
2447   { EVENT_CLOCKERR,             "EVENT_CLOCKERR" },
2448   { EVENT_REMOTEUNLOCK,         "EVENT_REMOTEUNLOCK" },
2449   { EVENT_TZHAUDISABLED,        "EVENT_TZHAUDISABLED" },
2450   { EVENT_EVENTLOGWRAPPED,      "EVENT_EVENTLOGWRAPPED" },
2451   { EVENT_DECLINEDLOGWRAPPED,   "EVENT_DECLINEDLOGWRAPPED" },
2452   { EVENT_ALARMLOGWRAPPED,      "EVENT_ALARMLOGWRAPPED" },
2453   { EVENT_RADIOBUSYEMERGENCY,   "EVENT_RADIOBUSYEMERGENCY" },
2454   { EVENT_RADIOBUSYSUPERVISOR,  "EVENT_RADIOBUSYSUPERVISOR" },
2455   { EVENT_RADIOBUSYONETIME,     "EVENT_RADIOBUSYONETIME" },
2456   { EVENT_RADIOBUSYUSER,        "EVENT_RADIOBUSYUSER" },
2457   { EVENT_RADIOBUSYPANIC,       "EVENT_RADIOBUSYPANIC" },
2458   { EVENT_RADIOBUSYREX,         "EVENT_RADIOBUSYREX" },
2459   { EVENT_RADIOBUSYLOCKOUT,     "EVENT_RADIOBUSYLOCKOUT" },
2460   { EVENT_RADIOBUSYRELOCK,      "EVENT_RADIOBUSYRELOCK" },
2461   { EVENT_BATTERYCHECKHELDOFF,  "EVENT_BATTERYCHECKHELDOFF" },
2462   { EVENT_RMTAUTHREQUEST,       "EVENT_RMTAUTHREQUEST" },
2463   { EVENT_FIRMWAREUPDATE,       "EVENT_FIRMWAREUPDATE" },
2464   { EVENT_FIRMWAREUPDATEFAILED, "EVENT_FIRMWAREUPDATEFAILED" },
2465   { EVENT_MSMFAILURE,           "EVENT_MSMFAILURE" },
2466   { EVENT_CLOCKRESET,           "EVENT_CLOCKRESET" },
2467   { EVENT_POWERFAIL,            "EVENT_POWERFAIL" },
2468   { EVENT_DPAC501WENTSTUPID,    "EVENT_DPAC501WENTSTUPID" },
2469   { EVENT_CHECKSUMCONFIG,       "EVENT_CHECKSUMCONFIG" },
2470   { EVENT_CHECKSUMTZ,           "EVENT_CHECKSUMTZ" },
2471   { EVENT_DEBUG,                "EVENT_DEBUG" },
2472   { 0xfe,                       "(Enable All Filters)" },
2473   { 0xff,                       "(Disable All Filters)" },
2474   { 0,                          NULL }
2475 };
2476 static value_string_ext r3_filtereventnames_ext = VALUE_STRING_EXT_INIT(r3_filtereventnames);
2477 
2478 static const value_string r3_filtertypenames [] =
2479 {
2480   { FILTERSELECT_RECORDING, "FILTERSELECT_RECORDING" },
2481   { FILTERSELECT_REPORTING, "FILTERSELECT_REPORTING" },
2482   { 0,                      NULL }
2483 };
2484 static value_string_ext r3_filtertypenames_ext = VALUE_STRING_EXT_INIT(r3_filtertypenames);
2485 
2486 static const value_string r3_forceitemnames [] =
2487 {
2488   { FORCEITEM_RADIOPOWER,  "FORCEITEM_RADIOPOWER" },
2489   { FORCEITEM_RADIOENABLE, "FORCEITEM_RADIOENABLE" },
2490   { FORCEITEM_LEDRED,      "FORCEITEM_LEDRED" },
2491   { FORCEITEM_LEDGREEN,    "FORCEITEM_LEDGREEN" },
2492   { FORCEITEM_LEDYELLOW,   "FORCEITEM_LEDYELLOW" },
2493   { FORCEITEM_PIEZO,       "FORCEITEM_PIEZO" },
2494   { FORCEITEM_MAGPOWER,    "FORCEITEM_MAGPOWER" },
2495   { FORCEITEM_MAGLEDA,     "FORCEITEM_MAGLEDA" },
2496   { FORCEITEM_MAGLEDB,     "FORCEITEM_MAGLEDB" },
2497   { FORCEITEM_PROXPOWER,   "FORCEITEM_PROXPOWER" },
2498   { FORCEITEM_PROXPING,    "FORCEITEM_PROXPING" },
2499   { FORCEITEM_PROXMODE,    "FORCEITEM_PROXMODE" },
2500   { FORCEITEM_I2CPOWER,    "FORCEITEM_I2CPOWER" },
2501   { FORCEITEM_MOTORARUN,   "FORCEITEM_MOTORARUN" },
2502   { FORCEITEM_MOTORBRUN,   "FORCEITEM_MOTORBRUN" },
2503   { FORCEITEM_VMON,        "FORCEITEM_VMON" },
2504   { FORCEITEM_PROX,        "FORCEITEM_PROX" },
2505   { FORCEITEM_MORTISETEST, "FORCEITEM_MORTISETEST" },
2506   { FORCEITEM_KEYPADTEST,  "FORCEITEM_KEYPADTEST" },
2507   { FORCEITEM_MAGTEST,     "FORCEITEM_MAGTEST" },
2508   { FORCEITEM_PROXTEST,    "FORCEITEM_PROXTEST" },
2509   { 0,                     NULL }
2510 };
2511 static value_string_ext r3_forceitemnames_ext = VALUE_STRING_EXT_INIT(r3_forceitemnames);
2512 
2513 static const value_string r3_mfgfieldnames [] =
2514 {
2515   { MFGFIELD_IOPINS,              "MFGFIELD_IOPINS" },
2516   { MFGFIELD_ADCS,                "MFGFIELD_ADCS" },
2517   { MFGFIELD_HARDWAREID,          "MFGFIELD_HARDWAREID" },
2518   { MFGFIELD_CHECKPOINTLOG,       "MFGFIELD_CHECKPOINTLOG" },
2519   { MFGFIELD_CPUREGISTERS,        "MFGFIELD_CPUREGISTERS" },
2520   { MFGFIELD_TASKFLAGS,           "MFGFIELD_TASKFLAGS" },
2521   { MFGFIELD_TIMERCHAIN,          "MFGFIELD_TIMERCHAIN" },
2522   { MFGFIELD_PEEKPOKE,            "MFGFIELD_PEEKPOKE" },
2523   { MFGFIELD_LOCKSTATE,           "MFGFIELD_LOCKSTATE" },
2524   { MFGFIELD_CAPABILITIES,        "MFGFIELD_CAPABILITIES" },
2525   { MFGFIELD_DUMPM41T81,          "MFGFIELD_DUMPM41T81" },
2526   { MFGFIELD_NVRAMCHECKSUMVALUE,  "MFGFIELD_NVRAMCHECKSUMVALUE" },
2527   { MFGFIELD_CHECKSUMRESULTS,     "MFGFIELD_CHECKSUMRESULTS" },
2528   { MFGFIELD_MORTISESTATELOG,     "MFGFIELD_MORTISESTATELOG" },
2529   { MFGFIELD_MORTISEPINS,         "MFGFIELD_MORTISEPINS" },
2530   { MFGFIELD_KEYPADCHAR,          "MFGFIELD_KEYPADCHAR" },
2531   { MFGFIELD_MAGCARD,             "MFGFIELD_MAGCARD" },
2532   { MFGFIELD_PROXCARD,            "MFGFIELD_PROXCARD" },
2533   { 0,                            NULL }
2534 };
2535 static value_string_ext r3_mfgfieldnames_ext = VALUE_STRING_EXT_INIT(r3_mfgfieldnames);
2536 
2537 static const value_string r3_mortiseeventnames [] =
2538 {
2539   { MORTISEEVENT_DX_THROWN,    "MORTISEEVENT_DX_THROWN" },
2540   { MORTISEEVENT_DX_RETRACTED, "MORTISEEVENT_DX_RETRACTED" },
2541   { MORTISEEVENT_LX_RETRACTED, "MORTISEEVENT_LX_RETRACTED" },
2542   { MORTISEEVENT_LX_EXTENDED,  "MORTISEEVENT_LX_EXTENDED" },
2543   { MORTISEEVENT_AX_EXTENDED,  "MORTISEEVENT_AX_EXTENDED" },
2544   { MORTISEEVENT_AX_RETRACTED, "MORTISEEVENT_AX_RETRACTED" },
2545   { MORTISEEVENT_RX_DEPRESSED, "MORTISEEVENT_RX_DEPRESSED" },
2546   { MORTISEEVENT_RX_RELEASED,  "MORTISEEVENT_RX_RELEASED" },
2547   { MORTISEEVENT_PX_OPEN,      "MORTISEEVENT_PX_OPEN" },
2548   { MORTISEEVENT_PX_CLOSED,    "MORTISEEVENT_PX_CLOSED" },
2549   { MORTISEEVENT_MX_UNLOCKED,  "MORTISEEVENT_MX_UNLOCKED" },
2550   { MORTISEEVENT_MX_LOCKED,    "MORTISEEVENT_MX_LOCKED" },
2551   { MORTISEEVENT_LAST,         "MORTISEEVENT_LAST" },
2552   { MORTISEEVENT_IGNORE,       "MORTISEEVENT_IGNORE" },
2553   { 0,                         NULL }
2554 };
2555 static value_string_ext r3_mortiseeventnames_ext = VALUE_STRING_EXT_INIT(r3_mortiseeventnames);
2556 
2557 static const value_string r3_mortisetypenames [] =
2558 {
2559   { MORTISETYPE_NONE,      "MORTISETYPE_NONE" },
2560   { MORTISETYPE_S82276,    "MORTISETYPE_S82276" },
2561   { MORTISETYPE_S82277,    "MORTISETYPE_S82277" },
2562   { MORTISETYPE_S82278,    "MORTISETYPE_S82278" },
2563   { MORTISETYPE_S82279,    "MORTISETYPE_S82279" },
2564   { MORTISETYPE_S10G77,    "MORTISETYPE_S10G77" },
2565   { MORTISETYPE_S8877,     "MORTISETYPE_S8877" },
2566   { MORTISETYPE_S8878,     "MORTISETYPE_S8878" },
2567   { MORTISETYPE_S8977,     "MORTISETYPE_S8977" },
2568   { MORTISETYPE_S8978,     "MORTISETYPE_S8978" },
2569   { MORTISETYPE_CRML20x36, "MORTISETYPE_CRML20x36" },
2570   { MORTISETYPE_CRML20x35, "MORTISETYPE_CRML20x35" },
2571   { MORTISETYPE_CRML20x34, "MORTISETYPE_CRML20x34" },
2572   { MORTISETYPE_CRML20x33, "MORTISETYPE_CRML20x33" },
2573   { MORTISETYPE_CRCL33x34, "MORTISETYPE_CRCL33x34" },
2574   { MORTISETYPE_CR9X34,    "MORTISETYPE_CR9X34" },
2575   { MORTISETYPE_CR9X33,    "MORTISETYPE_CR9X33" },
2576   { MORTISETYPE_CR9MX34,   "MORTISETYPE_CR9MX34" },
2577   { MORTISETYPE_CR9MX33,   "MORTISETYPE_CR9MX33" },
2578   { 0,                     NULL }
2579 };
2580 static value_string_ext r3_mortisetypenames_ext = VALUE_STRING_EXT_INIT(r3_mortisetypenames);
2581 
2582 static const value_string r3_peekpokenames [] =
2583 {
2584   { PEEKPOKE_READU8,      "PEEKPOKE_READU8" },
2585   { PEEKPOKE_READU16,     "PEEKPOKE_READU16" },
2586   { PEEKPOKE_READU24,     "PEEKPOKE_READU24" },
2587   { PEEKPOKE_READU32,     "PEEKPOKE_READU32" },
2588   { PEEKPOKE_READSTRING,  "PEEKPOKE_READSTRING" },
2589   { PEEKPOKE_WRITEU8,     "PEEKPOKE_WRITEU8" },
2590   { PEEKPOKE_WRITEU16,    "PEEKPOKE_WRITEU16" },
2591   { PEEKPOKE_WRITEU24,    "PEEKPOKE_WRITEU24" },
2592   { PEEKPOKE_WRITEU32,    "PEEKPOKE_WRITEU32" },
2593   { PEEKPOKE_WRITESTRING, "PEEKPOKE_WRITESTRING" },
2594   { 0,                    NULL }
2595 };
2596 static value_string_ext r3_peekpokenames_ext = VALUE_STRING_EXT_INIT(r3_peekpokenames);
2597 
2598 static const value_string r3_ppmisourcenames [] =
2599 {
2600   { PPMISOURCE_NONE,    "PPMISOURCE_NONE" },
2601   { PPMISOURCE_PIN,     "PPMISOURCE_PIN" },
2602   { PPMISOURCE_PROX,    "PPMISOURCE_PROX" },
2603   { PPMISOURCE_MAGCARD, "PPMISOURCE_MAGCARD" },
2604   { 0,                  NULL }
2605 };
2606 static value_string_ext r3_ppmisourcenames_ext = VALUE_STRING_EXT_INIT(r3_ppmisourcenames);
2607 
2608 static const value_string r3_responsetypenames [] =
2609 {
2610   { RESPONSETYPE_OK,                  "RESPONSETYPE_OK" },
2611   { RESPONSETYPE_ERROR,               "RESPONSETYPE_ERROR" },
2612   { RESPONSETYPE_HASDATA,             "RESPONSETYPE_HASDATA" },
2613   { RESPONSETYPE_NOHANDLER,           "RESPONSETYPE_NOHANDLER" },
2614   { RESPONSETYPE_NOSESSION,           "RESPONSETYPE_NOSESSION" },
2615   { RESPONSETYPE_BADCOMMAND,          "RESPONSETYPE_BADCOMMAND" },
2616   { RESPONSETYPE_BADPARAMETER,        "RESPONSETYPE_BADPARAMETER" },
2617   { RESPONSETYPE_BADPARAMETERLEN,     "RESPONSETYPE_BADPARAMETERLEN" },
2618   { RESPONSETYPE_MISSINGPARAMETER,    "RESPONSETYPE_MISSINGPARAMETER" },
2619   { RESPONSETYPE_DUPLICATEPARAMETER,  "RESPONSETYPE_DUPLICATEPARAMETER" },
2620   { RESPONSETYPE_PARAMETERCONFLICT,   "RESPONSETYPE_PARAMETERCONFLICT" },
2621   { RESPONSETYPE_BADDEVICE,           "RESPONSETYPE_BADDEVICE" },
2622   { RESPONSETYPE_NVRAMERROR,          "RESPONSETYPE_NVRAMERROR" },
2623   { RESPONSETYPE_NVRAMERRORNOACK,     "RESPONSETYPE_NVRAMERRORNOACK" },
2624   { RESPONSETYPE_NVRAMERRORNOACK32,   "RESPONSETYPE_NVRAMERRORNOACK32" },
2625   { RESPONSETYPE_NOTI2CADDRESS,       "RESPONSETYPE_NOTI2CADDRESS" },
2626   { RESPONSETYPE_FIRMWAREERROR,       "RESPONSETYPE_FIRMWAREERROR" },
2627   { RESPONSETYPE_DUMPINPROGRESS,      "RESPONSETYPE_DUMPINPROGRESS" },
2628   { RESPONSETYPE_INTERNALERROR,       "RESPONSETYPE_INTERNALERROR" },
2629   { RESPONSETYPE_NOTIMPLEMENTED,      "RESPONSETYPE_NOTIMPLEMENTED" },
2630   { RESPONSETYPE_PINFORMATERROR,      "RESPONSETYPE_PINFORMATERROR" },
2631   { RESPONSETYPE_PINEXISTS,           "RESPONSETYPE_PINEXISTS" },
2632   { RESPONSETYPE_PINNOTFOUND,         "RESPONSETYPE_PINNOTFOUND" },
2633   { RESPONSETYPE_USERACTIVE,          "RESPONSETYPE_USERACTIVE" },
2634   { RESPONSETYPE_USERINACTIVE,        "RESPONSETYPE_USERINACTIVE" },
2635   { RESPONSETYPE_PARENTNOTFOUND,      "RESPONSETYPE_PARENTNOTFOUND" },
2636   { RESPONSETYPE_NOCHAIN,             "RESPONSETYPE_NOCHAIN" },
2637   { RESPONSETYPE_CAUGHTINLOOP,        "RESPONSETYPE_CAUGHTINLOOP" },
2638   { RESPONSETYPE_EVENTFILTERED,       "RESPONSETYPE_EVENTFILTERED" },
2639   { RESPONSETYPE_PAYLOADTOOLARGE,     "RESPONSETYPE_PAYLOADTOOLARGE" },
2640   { RESPONSETYPE_ENDOFDATA,           "RESPONSETYPE_ENDOFDATA" },
2641   { RESPONSETYPE_RMTAUTHREJECTED,     "RESPONSETYPE_RMTAUTHREJECTED" },
2642   { RESPONSETYPE_NVRAMVERSIONERROR,   "RESPONSETYPE_NVRAMVERSIONERROR" },
2643   { RESPONSETYPE_NOHARDWARE,          "RESPONSETYPE_NOHARDWARE" },
2644   { RESPONSETYPE_SCHEDULERCONFLICT,   "RESPONSETYPE_SCHEDULERCONFLICT" },
2645   { RESPONSETYPE_NVRAMWRITEERROR,     "RESPONSETYPE_NVRAMWRITEERROR" },
2646   { RESPONSETYPE_DECLINEDFILTERED,    "RESPONSETYPE_DECLINEDFILTERED" },
2647   { RESPONSETYPE_NECONFIGPARM,        "RESPONSETYPE_NECONFIGPARM" },
2648   { RESPONSETYPE_FLASHERASEERROR,     "RESPONSETYPE_FLASHERASEERROR" },
2649   { RESPONSETYPE_FLASHWRITEERROR,     "RESPONSETYPE_FLASHWRITEERROR" },
2650   { RESPONSETYPE_BADNVBACKUP,         "RESPONSETYPE_BADNVBACKUP" },
2651   { RESPONSETYPE_EARLYACK,            "RESPONSETYPE_EARLYACK" },
2652   { RESPONSETYPE_ALARMFILTERED,       "RESPONSETYPE_ALARMFILTERED" },
2653   { RESPONSETYPE_ACVFAILURE,          "RESPONSETYPE_ACVFAILURE" },
2654   { RESPONSETYPE_USERCHECKSUMERROR,   "RESPONSETYPE_USERCHECKSUMERROR" },
2655   { RESPONSETYPE_CHECKSUMERROR,       "RESPONSETYPE_CHECKSUMERROR" },
2656   { RESPONSETYPE_RTCSQWFAILURE,       "RESPONSETYPE_RTCSQWFAILURE" },
2657   { RESPONSETYPE_PRIORITYSHUTDOWN,    "RESPONSETYPE_PRIORITYSHUTDOWN" },
2658   { RESPONSETYPE_NOTMODIFIABLE,       "RESPONSETYPE_NOTMODIFIABLE" },
2659   { RESPONSETYPE_CANTPRESERVE,        "RESPONSETYPE_CANTPRESERVE" },
2660   { RESPONSETYPE_INPASSAGEMODE,       "RESPONSETYPE_INPASSAGEMODE" },
2661   { 0,                                NULL }
2662 };
2663 static value_string_ext r3_responsetypenames_ext = VALUE_STRING_EXT_INIT(r3_responsetypenames);
2664 
2665 static const value_string r3_timezonemodenames [] =
2666 {
2667   { TIMEZONEMODE_NORMAL,    "TIMEZONEMODE_NORMAL" },
2668   { TIMEZONEMODE_EXCLUSION, "TIMEZONEMODE_EXCLUSION" },
2669   { TIMEZONEMODE_AUTOTIME,  "TIMEZONEMODE_AUTOTIME" },
2670   { TIMEZONEMODE_AUTOFPT,   "TIMEZONEMODE_AUTOFPT" },
2671   { TIMEZONEMODE_UAPM,      "TIMEZONEMODE_UAPM" },
2672   { 0,                      NULL }
2673 };
2674 static value_string_ext r3_timezonemodenames_ext = VALUE_STRING_EXT_INIT(r3_timezonemodenames);
2675 
2676 static const value_string r3_upstreamcommandnames [] =
2677 {
2678   { UPSTREAMCOMMAND_RESERVED,           "UPSTREAMCOMMAND_RESERVED" },
2679   { UPSTREAMCOMMAND_DEBUGMSG,           "UPSTREAMCOMMAND_DEBUGMSG" },
2680   { UPSTREAMCOMMAND_QUERYVERSION,       "UPSTREAMCOMMAND_QUERYVERSION" },
2681   { UPSTREAMCOMMAND_QUERYDATETIME,      "UPSTREAMCOMMAND_QUERYDATETIME" },
2682   { UPSTREAMCOMMAND_QUERYSERIALNUMBER,  "UPSTREAMCOMMAND_QUERYSERIALNUMBER" },
2683   { UPSTREAMCOMMAND_DUMPEVENTLOG,       "UPSTREAMCOMMAND_DUMPEVENTLOG" },
2684   { UPSTREAMCOMMAND_DUMPNVRAM,          "UPSTREAMCOMMAND_DUMPNVRAM" },
2685   { UPSTREAMCOMMAND_RMTAUTHREQUEST,     "UPSTREAMCOMMAND_RMTAUTHREQUEST" },
2686   { UPSTREAMCOMMAND_RETRIEVEUSER,       "UPSTREAMCOMMAND_RETRIEVEUSER" },
2687   { UPSTREAMCOMMAND_QUERYCONFIG,        "UPSTREAMCOMMAND_QUERYCONFIG" },
2688   { UPSTREAMCOMMAND_RMTEVENTLOGRECORD,  "UPSTREAMCOMMAND_RMTEVENTLOGRECORD" },
2689   { UPSTREAMCOMMAND_DPAC,               "UPSTREAMCOMMAND_DPAC" },
2690   { UPSTREAMCOMMAND_NOTIFY,             "UPSTREAMCOMMAND_NOTIFY" },
2691   { UPSTREAMCOMMAND_MFG,                "UPSTREAMCOMMAND_MFG" },
2692   { UPSTREAMCOMMAND_EVENTLOGWARNING,    "UPSTREAMCOMMAND_EVENTLOGWARNING" },
2693   { UPSTREAMCOMMAND_DUMPNVRAMRLE,       "UPSTREAMCOMMAND_DUMPNVRAMRLE" },
2694   { UPSTREAMCOMMAND_RMTDECLINEDRECORD,  "UPSTREAMCOMMAND_RMTDECLINEDRECORD" },
2695   { UPSTREAMCOMMAND_DECLINEDWARNING,    "UPSTREAMCOMMAND_DECLINEDWARNING" },
2696   { UPSTREAMCOMMAND_DUMPDECLINEDLOG,    "UPSTREAMCOMMAND_DUMPDECLINEDLOG" },
2697   { UPSTREAMCOMMAND_RMTALARMRECORD,     "UPSTREAMCOMMAND_RMTALARMRECORD" },
2698   { UPSTREAMCOMMAND_ALARMWARNING,       "UPSTREAMCOMMAND_ALARMWARNING" },
2699   { UPSTREAMCOMMAND_DUMPALARMLOG,       "UPSTREAMCOMMAND_DUMPALARMLOG" },
2700   { UPSTREAMCOMMAND_CONNECTSCHEDULER,   "UPSTREAMCOMMAND_CONNECTSCHEDULER" },
2701   { UPSTREAMCOMMAND_CONNECTCOMMUSER,    "UPSTREAMCOMMAND_CONNECTCOMMUSER" },
2702   { UPSTREAMCOMMAND_CONNECTALARM,       "UPSTREAMCOMMAND_CONNECTALARM" },
2703   { UPSTREAMCOMMAND_DUMPDEBUGLOG,       "UPSTREAMCOMMAND_DUMPDEBUGLOG" },
2704   { 0,                                  NULL }
2705 };
2706 static value_string_ext r3_upstreamcommandnames_ext = VALUE_STRING_EXT_INIT(r3_upstreamcommandnames);
2707 
2708 static const value_string r3_upstreamfieldnames [] =
2709 {
2710   { UPSTREAMFIELD_NOTUSED,              "UPSTREAMFIELD_NOTUSED" },
2711   { UPSTREAMFIELD_SERIALNUMBER,         "UPSTREAMFIELD_SERIALNUMBER" },
2712   { UPSTREAMFIELD_NAR,                  "UPSTREAMFIELD_NAR" },
2713   { UPSTREAMFIELD_ENTRYDEVICE,          "UPSTREAMFIELD_ENTRYDEVICE" },
2714   { UPSTREAMFIELD_PPMIFIELDTYPE,        "UPSTREAMFIELD_PPMIFIELDTYPE" },
2715   { UPSTREAMFIELD_PIN,                  "UPSTREAMFIELD_PIN" },
2716   { UPSTREAMFIELD_SEQUENCENUMBER,       "UPSTREAMFIELD_SEQUENCENUMBER" },
2717   { UPSTREAMFIELD_RESPONSEWINDOW,       "UPSTREAMFIELD_RESPONSEWINDOW" },
2718   { UPSTREAMFIELD_USERNUMBER,           "UPSTREAMFIELD_USERNUMBER" },
2719   { UPSTREAMFIELD_VERSION,              "UPSTREAMFIELD_VERSION" },
2720   { UPSTREAMFIELD_EVENTLOGRECORD,       "UPSTREAMFIELD_EVENTLOGRECORD" },
2721   { UPSTREAMFIELD_DATETIME,             "UPSTREAMFIELD_DATETIME" },
2722   { UPSTREAMFIELD_EVENTLOGRECORDCOUNT,  "UPSTREAMFIELD_EVENTLOGRECORDCOUNT" },
2723   { UPSTREAMFIELD_DECLINEDRECORDCOUNT,  "UPSTREAMFIELD_DECLINEDRECORDCOUNT" },
2724   { UPSTREAMFIELD_DECLINEDRECORD,       "UPSTREAMFIELD_DECLINEDRECORD" },
2725   { UPSTREAMFIELD_USERTYPE,             "UPSTREAMFIELD_USERTYPE" },
2726   { UPSTREAMFIELD_ACCESSALWAYS,         "UPSTREAMFIELD_ACCESSALWAYS" },
2727   { UPSTREAMFIELD_CACHED,               "UPSTREAMFIELD_CACHED" },
2728   { UPSTREAMFIELD_PRIMARYFIELDTYPE,     "UPSTREAMFIELD_PRIMARYFIELDTYPE" },
2729   { UPSTREAMFIELD_AUXFIELDTYPE,         "UPSTREAMFIELD_AUXFIELDTYPE" },
2730   { UPSTREAMFIELD_ACCESSMODE,           "UPSTREAMFIELD_ACCESSMODE" },
2731   { UPSTREAMFIELD_EXPIREON,             "UPSTREAMFIELD_EXPIREON" },
2732   { UPSTREAMFIELD_USECOUNT,             "UPSTREAMFIELD_USECOUNT" },
2733   { UPSTREAMFIELD_TIMEZONE,             "UPSTREAMFIELD_TIMEZONE" },
2734   { UPSTREAMFIELD_EXCEPTIONGROUP,       "UPSTREAMFIELD_EXCEPTIONGROUP" },
2735   { UPSTREAMFIELD_PRIMARYPIN,           "UPSTREAMFIELD_PRIMARYPIN" },
2736   { UPSTREAMFIELD_AUXPIN,               "UPSTREAMFIELD_AUXPIN" },
2737   { UPSTREAMFIELD_ALARMRECORDCOUNT,     "UPSTREAMFIELD_ALARMRECORDCOUNT" },
2738   { UPSTREAMFIELD_ALARMRECORD,          "UPSTREAMFIELD_ALARMRECORD" },
2739   { UPSTREAMFIELD_AUXCTLRVERSION,       "UPSTREAMFIELD_AUXCTLRVERSION" },
2740   { 0,                                  NULL }
2741 };
2742 static value_string_ext r3_upstreamfieldnames_ext = VALUE_STRING_EXT_INIT(r3_upstreamfieldnames);
2743 
2744 static const value_string r3_usertypenames [] =
2745 {
2746   { USERTYPE_NONE,        "USERTYPE_NONE" },
2747   { USERTYPE_MASTER,      "USERTYPE_MASTER" },
2748   { USERTYPE_EMERGENCY,   "USERTYPE_EMERGENCY" },
2749   { USERTYPE_SUPERVISOR,  "USERTYPE_SUPERVISOR" },
2750   { USERTYPE_USER,        "USERTYPE_USER" },
2751   { USERTYPE_EXTENDED,    "USERTYPE_EXTENDED" },
2752   { USERTYPE_PASSAGE,     "USERTYPE_PASSAGE" },
2753   { USERTYPE_ONETIME,     "USERTYPE_ONETIME" },
2754   { USERTYPE_PANIC,       "USERTYPE_PANIC" },
2755   { USERTYPE_LOCKOUT,     "USERTYPE_LOCKOUT" },
2756   { USERTYPE_RELOCK,      "USERTYPE_RELOCK" },
2757   { USERTYPE_NOTIFY,      "USERTYPE_NOTIFY" },
2758   { USERTYPE_COMM,        "USERTYPE_COMM" },
2759   { USERTYPE_SUSPENDED,   "USERTYPE_SUSPENDED" },
2760   { 0,                    NULL }
2761 };
2762 static value_string_ext r3_usertypenames_ext = VALUE_STRING_EXT_INIT(r3_usertypenames);
2763 
2764 static const value_string r3_mfgnvramdumpnames [] =
2765 {
2766   {  0, "All" },
2767   {  1, "PIC" },
2768   {  2, "User" },
2769   {  3, "Event" },
2770   {  0, NULL }
2771 };
2772 static value_string_ext r3_mfgnvramdumpnames_ext = VALUE_STRING_EXT_INIT(r3_mfgnvramdumpnames);
2773 
2774 static const value_string r3_mfgremoteunlocknames [] =
2775 {
2776   {  0, "Normal" },
2777   {  1, "Unlock" },
2778   {  2, "Lock" },
2779   {  0, NULL }
2780 };
2781 static value_string_ext r3_mfgremoteunlocknames_ext = VALUE_STRING_EXT_INIT(r3_mfgremoteunlocknames);
2782 
2783 static const value_string r3_mfgtestpreservenames [] =
2784 {
2785   {  0, "Save" },
2786   {  1, "Restore" },
2787   {  0, NULL }
2788 };
2789 static value_string_ext r3_mfgtestpreservenames_ext = VALUE_STRING_EXT_INIT(r3_mfgtestpreservenames);
2790 
2791 static const value_string r3_daynames [] =
2792 {
2793   { 0,  "Sunday" },
2794   { 1,  "Monday" },
2795   { 2,  "Tuesday" },
2796   { 3,  "Wednesday" },
2797   { 4,  "Thursday" },
2798   { 5,  "Friday" },
2799   { 6,  "Saturday" },
2800   { 0,  NULL }
2801 };
2802 static value_string_ext r3_daynames_ext = VALUE_STRING_EXT_INIT(r3_daynames);
2803 
2804 static const value_string r3_monthnames [] =
2805 {
2806   {  0, "ERROR!" },
2807   {  1, "January" },
2808   {  2, "February" },
2809   {  3, "March" },
2810   {  4, "April" },
2811   {  5, "May" },
2812   {  6, "June" },
2813   {  7, "July" },
2814   {  8, "August" },
2815   {  9, "September" },
2816   { 10, "October" },
2817   { 11, "November" },
2818   { 12, "December" },
2819   {  0, NULL }
2820 };
2821 static value_string_ext r3_monthnames_ext = VALUE_STRING_EXT_INIT(r3_monthnames);
2822 
2823 static const value_string r3_monthdaynames [] =
2824 {
2825   {  0, "ERROR!" },
2826   {  1, " 1st" },
2827   {  2, " 2nd" },
2828   {  3, " 3rd" },
2829   {  4, " 4th" },
2830   {  5, " 5th" },
2831   {  6, " 6th" },
2832   {  7, " 7th" },
2833   {  8, " 8th" },
2834   {  9, " 9th" },
2835   { 10, "10th" },
2836   { 11, "11th" },
2837   { 12, "12th" },
2838   { 13, "13th" },
2839   { 14, "14th" },
2840   { 15, "15th" },
2841   { 16, "16th" },
2842   { 17, "17th" },
2843   { 18, "18th" },
2844   { 19, "19th" },
2845   { 20, "20th" },
2846   { 21, "21st" },
2847   { 22, "22nd" },
2848   { 23, "23rd" },
2849   { 24, "24th" },
2850   { 25, "25th" },
2851   { 26, "26th" },
2852   { 27, "27th" },
2853   { 28, "28th" },
2854   { 29, "29th" },
2855   { 30, "30th" },
2856   { 31, "31st" },
2857   {  0, NULL   }
2858 };
2859 static value_string_ext r3_monthdaynames_ext = VALUE_STRING_EXT_INIT(r3_monthdaynames);
2860 
2861 static const value_string r3_powertablenames [] =
2862 {
2863   {  1, "CONFIGITEM_PT_RANGE_1..CONFIGITEM_PT_RANGE_8 = {12, 11, 11, 10, 10,  9,  9,  8}" },
2864   {  2, "CONFIGITEM_PT_RANGE_1..CONFIGITEM_PT_RANGE_8 = {12, 11, 11, 10, 10,  9,  9,  8}" },
2865   {  3, "CONFIGITEM_PT_RANGE_1..CONFIGITEM_PT_RANGE_8 = {12, 11, 11, 10, 10,  9,  9,  8}" },
2866   {  4, "CONFIGITEM_PT_RANGE_1..CONFIGITEM_PT_RANGE_8 = {12, 11, 11, 10, 10,  9,  9,  8}" },
2867   {  5, "CONFIGITEM_PT_RANGE_1..CONFIGITEM_PT_RANGE_8 = {13, 12, 12, 11, 11, 10, 10,  9}" },
2868   {  6, "CONFIGITEM_PT_RANGE_1..CONFIGITEM_PT_RANGE_8 = {14, 13, 13, 12, 12, 11, 11, 10}" },
2869   {  7, "CONFIGITEM_PT_RANGE_1..CONFIGITEM_PT_RANGE_8 = {15, 14, 14, 13, 13, 12, 12, 11}" },
2870   {  8, "CONFIGITEM_PT_RANGE_1..CONFIGITEM_PT_RANGE_8 = {16, 15, 15, 14, 14, 13, 13, 12}" },
2871   {  0, NULL }
2872 };
2873 static value_string_ext r3_powertablenames_ext = VALUE_STRING_EXT_INIT(r3_powertablenames);
2874 
2875 static const true_false_string tfs_rmtauthretry_flags =
2876 {
2877   "Retry",
2878   "Deny"
2879 };
2880 
2881 static const true_false_string tfs_errornoerror_flags =
2882 {
2883   "Error",
2884   "No Error"
2885 };
2886 
2887 static const string_string r3_snmanufacturernames [] =
2888 {
2889   { "IT", "ITS" },
2890   { "KC", "Kimchuk" },
2891   { NULL, NULL }
2892 };
2893 
2894 static const string_string r3_snyearnames [] =
2895 {
2896   { "5",  "2005" },
2897   { "6",  "2006" },
2898   { "7",  "2007" },
2899   { "8",  "2008" },
2900   { "9",  "2009" },
2901   { "0",  "2010" },
2902   { "1",  "2011" },
2903   { "2",  "2012" },
2904   { "3",  "2013" },
2905   { "4",  "2014" },
2906   { NULL, NULL }
2907 };
2908 
2909 static const string_string r3_snmodelnames [] =
2910 {
2911   { "H",  "Sx controller" },
2912   { "J",  "Px controller" },
2913   { "D",  "PG offline interface board" },
2914   { "E",  "Px online interface board" },
2915   { "N",  "Ethernet-PD board" },
2916   { "O",  "CAM board" },
2917   { NULL, NULL }
2918 };
2919 
2920 static const string_string r3_sngroupnames [] =
2921 {
2922   { "S",  "Sargent" },
2923   { "P",  "Persona" },
2924   { "C",  "Corbin-Russwin" },
2925   { NULL, NULL }
2926 };
2927 
2928 static const string_string r3_snnidnames [] =
2929 {
2930   { "A",  "Ethernet" },
2931   { "B",  "DPAC 802.11b" },
2932   { "C",  "DPAC 802.11bg" },
2933   { "D",  "Zigbee" },
2934   { "E",  "GPRS" },
2935   { NULL, NULL }
2936 };
2937 
2938 static const string_string r3_snhidnames [] =
2939 {
2940   { "00", "[None]" },
2941   { "01", "Keypad" },
2942   { "02", "eProx" },
2943   { "03", "eProx, Keypad" },
2944   { "04", "iProx" },
2945   { "05", "iProx, Keypad" },
2946   { "06", "iProx, eProx" },
2947   { "07", "iProx, eProx, Keypad" },
2948   { "08", "Mag Card" },
2949   { "09", "Mag Card, Keypad" },
2950   { "0a", "Mag Card, eProx" },
2951   { "0b", "Mag Card, eProx, Keypad" },
2952   { "0c", "Mag Card, iProx" },
2953   { "0d", "Mag Card, iProx, Keypad" },
2954   { "0e", "Mag Card, iProx, eProx" },
2955   { "0f", "Mag Card, iProx, eProx, Keypad" },
2956   { "10", "Biometric" },
2957   { "11", "Biometric, Keypad" },
2958   { "12", "Biometric, eProx" },
2959   { "13", "Biometric, eProx, Keypad" },
2960   { "14", "Biometric, iProx" },
2961   { "15", "Biometric, iProx, Keypad" },
2962   { "16", "Biometric, iProx, eProx" },
2963   { "17", "Biometric, iProx, eProx, Keypad" },
2964   { "18", "Biometric, Mag Card" },
2965   { "19", "Biometric, Mag Card, Keypad" },
2966   { "1a", "Biometric, Mag Card, eProx" },
2967   { "1b", "Biometric, Mag Card, eProx, Keypad" },
2968   { "1c", "Biometric, Mag Card, iProx" },
2969   { "1d", "Biometric, Mag Card, iProx, Keypad" },
2970   { "1e", "Biometric, Mag Card, iProx, eProx" },
2971   { "1f", "Biometric, Mag Card, iProx, eProx, Keypad" },
2972   { NULL, NULL }
2973 };
2974 
2975 static const string_string r3_snpowersupplynames [] =
2976 {
2977   { "A",  "Batteries" },
2978   { "B",  "External power" },
2979   { "C",  "Power over Ethernet" },
2980   { "D",  "External power w/ backup" },
2981   { "E",  "Power over Ethernet w/ backup" },
2982   { NULL, NULL }
2983 };
2984 
2985 static const string_string r3_snmortisenames [] =
2986 {
2987   { "A",  "Sargent 82276 mortise" },
2988   { "B",  "Sargent 82277 mortise" },
2989   { "C",  "Sargent 82278 mortise" },
2990   { "D",  "Sargent 82279 mortise" },
2991   { "E",  "Sargent 10G77 bored" },
2992   { "F",  "Sargent 8877 exit" },
2993   { "G",  "Sargent 8878 exit" },
2994   { "H",  "Sargent 8977 exit" },
2995   { "I",  "Sargent 8878 exit" },
2996   { "J",  "Corbin-Russwin ML20736/ML20836 mortise" },
2997   { "K",  "Corbin-Russwin ML20735/ML20835 mortise" },
2998   { "L",  "Corbin-Russwin ML20734/ML20834 mortise" },
2999   { "M",  "Corbin-Russwin ML20733/ML20833 mortise" },
3000   { "N",  "Corbin-Russwin CL33734/CL33834 bored" },
3001   { "O",  "Corbin-Russwin 9734/9834 exit" },
3002   { "P",  "Corbin-Russwin 9733/9833 exit" },
3003   { "Q",  "Corbin-Russwin 9M734/9M834 exit" },
3004   { "R",  "Corbin-Russwin 9M733/9M833 exit" },
3005   { NULL, NULL }
3006 };
3007 
3008 static int * const r3_timezonearray[] = {
3009   &hf_r3_timezonearray0,
3010   &hf_r3_timezonearray1,
3011   &hf_r3_timezonearray2,
3012   &hf_r3_timezonearray3,
3013   &hf_r3_timezonearray4,
3014   &hf_r3_timezonearray5,
3015   &hf_r3_timezonearray6,
3016   &hf_r3_timezonearray7,
3017   &hf_r3_timezonearray8,
3018   &hf_r3_timezonearray9,
3019   &hf_r3_timezonearray10,
3020   &hf_r3_timezonearray11,
3021   &hf_r3_timezonearray12,
3022   &hf_r3_timezonearray13,
3023   &hf_r3_timezonearray14,
3024   &hf_r3_timezonearray15,
3025   &hf_r3_timezonearray16,
3026   &hf_r3_timezonearray17,
3027   &hf_r3_timezonearray18,
3028   &hf_r3_timezonearray19,
3029   &hf_r3_timezonearray20,
3030   &hf_r3_timezonearray21,
3031   &hf_r3_timezonearray22,
3032   &hf_r3_timezonearray23,
3033   &hf_r3_timezonearray24,
3034   &hf_r3_timezonearray25,
3035   &hf_r3_timezonearray26,
3036   &hf_r3_timezonearray27,
3037   &hf_r3_timezonearray28,
3038   &hf_r3_timezonearray29,
3039   &hf_r3_timezonearray30,
3040   &hf_r3_timezonearray31,
3041   NULL
3042 };
3043 
3044 static int * const r3_definetimezone_daymap[] = {
3045   &hf_r3_definetimezone_daymap0,
3046   &hf_r3_definetimezone_daymap1,
3047   &hf_r3_definetimezone_daymap2,
3048   &hf_r3_definetimezone_daymap3,
3049   &hf_r3_definetimezone_daymap4,
3050   &hf_r3_definetimezone_daymap5,
3051   &hf_r3_definetimezone_daymap6,
3052   NULL
3053 };
3054 
3055 static int * const r3_nvramclearoptions[] = {
3056   &hf_r3_nvramclearoptions0,
3057   &hf_r3_nvramclearoptions1,
3058   &hf_r3_nvramclearoptions2,
3059   &hf_r3_nvramclearoptions3,
3060   &hf_r3_nvramclearoptions4,
3061   &hf_r3_nvramclearoptions5,
3062   &hf_r3_nvramclearoptions6,
3063   &hf_r3_nvramclearoptions7,
3064   &hf_r3_nvramclearoptions8,
3065   &hf_r3_nvramclearoptions9,
3066   &hf_r3_nvramclearoptions10,
3067   &hf_r3_nvramclearoptions11,
3068   &hf_r3_nvramclearoptions12,
3069   &hf_r3_nvramclearoptions13,
3070   &hf_r3_nvramclearoptions14,
3071   &hf_r3_nvramclearoptions15,
3072   NULL
3073 };
3074 
3075 /*
3076  *  Mapping table so dissect_r3_cmd_setconfig() knows what the configuration item type is
3077  */
3078 static configType_e configMap [] =
3079 {
3080   /* CONFIGITEM_SERIAL_NUMBER */               CONFIGTYPE_STRING,
3081   /* CONFIGITEM_CRYPT_KEY */                   CONFIGTYPE_STRING,
3082   /* CONFIGITEM_HARDWARE_OPTIONS_MFG */        CONFIGTYPE_16,
3083   /* CONFIGITEM_HARDWARE_OPTIONS */            CONFIGTYPE_16,
3084   /* CONFIGITEM_NVRAM_CHANGES */               CONFIGTYPE_16,
3085   /* CONFIGITEM_NVRAMDIRTY */                  CONFIGTYPE_BOOL,
3086   /* CONFIGITEM_NVRAM_WV */                    CONFIGTYPE_BOOL,
3087   /* CONFIGITEM_ENABLE_WDT */                  CONFIGTYPE_BOOL,
3088   /* CONFIGITEM_EARLY_ACK */                   CONFIGTYPE_BOOL,
3089   /* CONFIGITEM_CONSOLE_AES_ONLY */            CONFIGTYPE_BOOL,
3090   /* CONFIGITEM_RADIO_AES_ONLY */              CONFIGTYPE_BOOL,
3091   /* CONFIGITEM_NDRLE */                       CONFIGTYPE_BOOL,
3092   /* CONFIGITEM_SOMF */                        CONFIGTYPE_BOOL,
3093   /* CONFIGITEM_NOGAF */                       CONFIGTYPE_BOOL,
3094   /* CONFIGITEM_CARD_READER_POWER */           CONFIGTYPE_BOOL,
3095   /* CONFIGITEM_PROX_ENABLE */                 CONFIGTYPE_BOOL,
3096   /* CONFIGITEM_CKSUMCONFIG */                 CONFIGTYPE_BOOL,
3097   /* CONFIGITEM_DAILY_BATTERY_CHECK */         CONFIGTYPE_BOOL,
3098   /* CONFIGITEM_DAILY_BATTERY_CHECK_HOUR */    CONFIGTYPE_8,
3099   /* CONFIGITEM_BATTERY_LOW */                 CONFIGTYPE_BOOL,
3100   /* CONFIGITEM_LRU_HEAD */                    CONFIGTYPE_16,
3101   /* CONFIGITEM_LRU_TAIL */                    CONFIGTYPE_16,
3102   /* CONFIGITEM_RTC_CALIBRATION */             CONFIGTYPE_8,
3103   /* CONFIGITEM_ACVREQUESTER */                CONFIGTYPE_8,
3104   /* CONFIGITEM_LOCAL_LED */                   CONFIGTYPE_8,
3105   /* CONFIGITEM_ERRCNT_XORLEN */               CONFIGTYPE_16,
3106   /* CONFIGITEM_ERRCNT_CRC */                  CONFIGTYPE_16,
3107   /* CONFIGITEM_ERRCNT_NOTSIGIL */             CONFIGTYPE_16,
3108   /* CONFIGITEM_ERRCNT_TIMEOUT */              CONFIGTYPE_16,
3109   /* CONFIGITEM_ERRCNT_TOOLONG */              CONFIGTYPE_16,
3110   /* CONFIGITEM_ERRCNT_TOOSHORT */             CONFIGTYPE_16,
3111   /* CONFIGITEM_ERRCNT_HITDEFAULT */           CONFIGTYPE_16,
3112   /* CONFIGITEM_ERRCNT_OVERRUN */              CONFIGTYPE_16,
3113   /* CONFIGITEM_ERRCNT_UARTFE */               CONFIGTYPE_16,
3114   /* CONFIGITEM_ERRCNT_UARTOE */               CONFIGTYPE_16,
3115   /* CONFIGITEM_DST_SET */                     CONFIGTYPE_BOOL,
3116   /* CONFIGITEM_DST_MODE */                    CONFIGTYPE_8,
3117   /* CONFIGITEM_DST_FORWARD_MONTH */           CONFIGTYPE_8,
3118   /* CONFIGITEM_DST_FORWARD_DOM */             CONFIGTYPE_8,
3119   /* CONFIGITEM_DST_FORWARD_OOD */             CONFIGTYPE_8,
3120   /* CONFIGITEM_DST_FORWARD_DOW */             CONFIGTYPE_8,
3121   /* CONFIGITEM_DST_FORWARD_HOUR */            CONFIGTYPE_8,
3122   /* CONFIGITEM_DST_FORWARD_MINUTE */          CONFIGTYPE_8,
3123   /* CONFIGITEM_DST_FORWARD_ADJUST */          CONFIGTYPE_8,
3124   /* CONFIGITEM_DST_BACK_MONTH */              CONFIGTYPE_8,
3125   /* CONFIGITEM_DST_BACK_DOM */                CONFIGTYPE_8,
3126   /* CONFIGITEM_DST_BACK_OOD */                CONFIGTYPE_8,
3127   /* CONFIGITEM_DST_BACK_DOW */                CONFIGTYPE_8,
3128   /* CONFIGITEM_DST_BACK_HOUR */               CONFIGTYPE_8,
3129   /* CONFIGITEM_DST_BACK_MINUTE */             CONFIGTYPE_8,
3130   /* CONFIGITEM_DST_BACK_ADJUST */             CONFIGTYPE_8,
3131   /* CONFIGITEM_EVENTLOG_ZEROMEM */            CONFIGTYPE_BOOL,
3132   /* CONFIGITEM_EVENTLOG_BEGIN */              CONFIGTYPE_16,
3133   /* CONFIGITEM_EVENTLOG_RECORD */             CONFIGTYPE_16,
3134   /* CONFIGITEM_EVENTLOG_ENTRIES */            CONFIGTYPE_16,
3135   /* CONFIGITEM_EVENTLOG_WARNDEVICE */         CONFIGTYPE_8,
3136   /* CONFIGITEM_EVENTLOG_WARNEVERY */          CONFIGTYPE_16,
3137   /* CONFIGITEM_EVENTLOG_RMTDEVICE */          CONFIGTYPE_8,
3138   /* CONFIGITEM_DECLINEDLOG_ZEROMEM */         CONFIGTYPE_BOOL,
3139   /* CONFIGITEM_DECLINEDLOG_BEGIN */           CONFIGTYPE_16,
3140   /* CONFIGITEM_DECLINEDLOG_RECORD */          CONFIGTYPE_16,
3141   /* CONFIGITEM_DECLINEDLOG_ENTRIES */         CONFIGTYPE_16,
3142   /* CONFIGITEM_DECLINEDLOG_WARNDEVICE */      CONFIGTYPE_8,
3143   /* CONFIGITEM_DECLINEDLOG_WARNEVERY */       CONFIGTYPE_16,
3144   /* CONFIGITEM_DECLINEDLOG_RMTDEVICE */       CONFIGTYPE_8,
3145   /* CONFIGITEM_ALARMLOG_ZEROMEM */            CONFIGTYPE_BOOL,
3146   /* CONFIGITEM_ALARMLOG_BEGIN */              CONFIGTYPE_16,
3147   /* CONFIGITEM_ALARMLOG_RECORD */             CONFIGTYPE_16,
3148   /* CONFIGITEM_ALARMLOG_ENTRIES */            CONFIGTYPE_16,
3149   /* CONFIGITEM_ALARMLOG_WARNDEVICE */         CONFIGTYPE_8,
3150   /* CONFIGITEM_ALARMLOG_WARNEVERY */          CONFIGTYPE_16,
3151   /* CONFIGITEM_ALARMLOG_RMTDEVICE */          CONFIGTYPE_8,
3152   /* CONFIGITEM_VISIBLE_FEEDBACK */            CONFIGTYPE_BOOL,
3153   /* CONFIGITEM_AUDIBLE_FEEDBACK */            CONFIGTYPE_BOOL,
3154   /* CONFIGITEM_VISIBLE_INDICATORS */          CONFIGTYPE_BOOL,
3155   /* CONFIGITEM_AUDIBLE_INDICATORS */          CONFIGTYPE_BOOL,
3156   /* CONFIGITEM_2NDPINDURATION */              CONFIGTYPE_8,
3157   /* CONFIGITEM_LOCKOUT_ATTEMPTS */            CONFIGTYPE_8,
3158   /* CONFIGITEM_LOCKOUT_DURATION */            CONFIGTYPE_8,
3159   /* CONFIGITEM_KEYPAD_INACTIVITY */           CONFIGTYPE_8,
3160   /* CONFIGITEM_ICIDLE_DURATION */             CONFIGTYPE_8,
3161   /* CONFIGITEM_WRITE_DECLINED_LOG */          CONFIGTYPE_BOOL,
3162   /* CONFIGITEM_LOW_BATTERY_INDICATOR */       CONFIGTYPE_BOOL,
3163   /* CONFIGITEM_PANIC_MODE */                  CONFIGTYPE_BOOL,
3164   /* CONFIGITEM_TIMEZONE_ENABLE */             CONFIGTYPE_BOOL,
3165   /* CONFIGITEM_EXCEPTION_ENABLE */            CONFIGTYPE_BOOL,
3166   /* CONFIGITEM_AUTOUNLOCK_ENABLE */           CONFIGTYPE_BOOL,
3167   /* CONFIGITEM_LOCK_PRIORITY_EMERGENCY */     CONFIGTYPE_8,
3168   /* CONFIGITEM_LOCK_PRIORITY_SUPERVISOR */    CONFIGTYPE_8,
3169   /* CONFIGITEM_LOCK_PRIORITY_USER */          CONFIGTYPE_8,
3170   /* CONFIGITEM_LOCK_PRIORITY_PASSAGE */       CONFIGTYPE_8,
3171   /* CONFIGITEM_LOCK_PRIORITY_PANIC */         CONFIGTYPE_8,
3172   /* CONFIGITEM_LOCK_PRIORITY_LOCKOUT */       CONFIGTYPE_8,
3173   /* CONFIGITEM_LOCK_PRIORITY_RELOCK */        CONFIGTYPE_8,
3174   /* CONFIGITEM_LOCK_PRIORITY_BOLTTHROWN */    CONFIGTYPE_8,
3175   /* CONFIGITEM_LOCK_PRIORITY_CONFIGCHANGE */  CONFIGTYPE_8,
3176   /* CONFIGITEM_LOCK_PRIORITY_REMOTE */        CONFIGTYPE_8,
3177   /* CONFIGITEM_LOCK_TYPE */                   CONFIGTYPE_8,
3178   /* CONFIGITEM_DOUBLE_PULSE */                CONFIGTYPE_BOOL,
3179   /* CONFIGITEM_DOUBLE_DELAY */                CONFIGTYPE_8,
3180   /* CONFIGITEM_MOTOR_DURATION */              CONFIGTYPE_8,
3181   /* CONFIGITEM_MORTISE_TYPE */                CONFIGTYPE_8,
3182   /* CONFIGITEM_UNLOCK_TIME */                 CONFIGTYPE_8,
3183   /* CONFIGITEM_EXT_UNLOCK_TIME */             CONFIGTYPE_8,
3184   /* CONFIGITEM_DOOR_AJAR_TIME */              CONFIGTYPE_8,
3185   /* CONFIGITEM_SESSION_TIMEOUT */             CONFIGTYPE_8,
3186   /* CONFIGITEM_RETRY_ON_TIMEOUT */            CONFIGTYPE_BOOL,
3187   /* CONFIGITEM_UNSOLICITED_ENCRYPT */         CONFIGTYPE_8,
3188   /* CONFIGITEM_RMT_AUTH_TIMEOUT */            CONFIGTYPE_8,
3189   /* CONFIGITEM_RMT_AUTH_DEVICE */             CONFIGTYPE_8,
3190   /* CONFIGITEM_ALARM_DEVICE */                CONFIGTYPE_8,
3191   /* CONFIGITEM_NOTIFY_DEVICE */               CONFIGTYPE_8,
3192   /* CONFIGITEM_COMMUSER_DEVICE */             CONFIGTYPE_8,
3193   /* CONFIGITEM_SCHEDULER_DEVICE */            CONFIGTYPE_8,
3194   /* CONFIGITEM_SCHEDULER_TYPE */              CONFIGTYPE_8,
3195   /* CONFIGITEM_SCHEDULER_AWAKE */             CONFIGTYPE_8,
3196   /* CONFIGITEM_SCHEDULER_PERIOD */            CONFIGTYPE_16,
3197   /* CONFIGITEM_SCHEDULER_HOD */               CONFIGTYPE_STRING,
3198   /* CONFIGITEM_SCHEDULER_DOW */               CONFIGTYPE_8,
3199   /* CONFIGITEM_SCHEDULER_DOM */               CONFIGTYPE_32,
3200   /* CONFIGITEM_SCHEDULER_HM1 */               CONFIGTYPE_16,
3201   /* CONFIGITEM_SCHEDULER_HM2 */               CONFIGTYPE_16,
3202   /* CONFIGITEM_SCHEDULER_HM3 */               CONFIGTYPE_16,
3203   /* CONFIGITEM_SCHEDULER_HM4 */               CONFIGTYPE_16,
3204   /* CONFIGITEM_RADIO_TYPE */                  CONFIGTYPE_8,
3205   /* CONFIGITEM_RADIO_MODE */                  CONFIGTYPE_8,
3206   /* CONFIGITEM_RADIO_TIMEOUT */               CONFIGTYPE_8,
3207   /* CONFIGITEM_RADIO_ATTEMPTS */              CONFIGTYPE_8,
3208   /* CONFIGITEM_RADIO_HOUSEKEEPING */          CONFIGTYPE_8,
3209   /* CONFIGITEM_RADIO_LEAPUSERNAME */          CONFIGTYPE_STRING,
3210   /* CONFIGITEM_RADIO_LEAPPASSWORD */          CONFIGTYPE_STRING,
3211   /* CONFIGITEM_INHIBIT_VOLTAGE */             CONFIGTYPE_8,
3212   /* CONFIGITEM_LOW_VOLTAGE */                 CONFIGTYPE_8,
3213   /* CONFIGITEM_PT_RANGE_1 */                  CONFIGTYPE_8,
3214   /* CONFIGITEM_PT_RANGE_2 */                  CONFIGTYPE_8,
3215   /* CONFIGITEM_PT_RANGE_3 */                  CONFIGTYPE_8,
3216   /* CONFIGITEM_PT_RANGE_4 */                  CONFIGTYPE_8,
3217   /* CONFIGITEM_PT_RANGE_5 */                  CONFIGTYPE_8,
3218   /* CONFIGITEM_PT_RANGE_6 */                  CONFIGTYPE_8,
3219   /* CONFIGITEM_PT_RANGE_7 */                  CONFIGTYPE_8,
3220   /* CONFIGITEM_PT_RANGE_8 */                  CONFIGTYPE_8,
3221   /* CONFIGITEM_MAGCARD_IFS */                 CONFIGTYPE_BOOL,
3222   /* CONFIGITEM_MAGCARD_FIELDS */              CONFIGTYPE_8,
3223   /* CONFIGITEM_MAGCARD_OFFSET */              CONFIGTYPE_8,
3224   /* CONFIGITEM_MAGCARD_DIGITS */              CONFIGTYPE_8,
3225   /* CONFIGITEM_ALARMS */                      CONFIGTYPE_STRING,
3226   /* CONFIGITEM_FILTERS */                     CONFIGTYPE_STRING,
3227   /* CONFIGITEM_ALARMSTATE */                  CONFIGTYPE_8,
3228   /* CONFIGITEM_DOORSTATE */                   CONFIGTYPE_8,
3229   /* CONFIGITEM_DPACDEBUG */                   CONFIGTYPE_BOOL,
3230   /* CONFIGITEM_FAILOPENSECURE */              CONFIGTYPE_BOOL,
3231   /* CONFIGITEM_REPLACED_VOLTAGE */            CONFIGTYPE_8,
3232   /* CONFIGITEM_RX_HELD_TIME */                CONFIGTYPE_8,
3233   /* CONFIGITEM_PACKET_TIMEOUT */              CONFIGTYPE_8,
3234   /* CONFIGITEM_EXTENDEDRESPONSE */            CONFIGTYPE_BOOL,
3235   /* CONFIGITEM_PASSAGEMODEINDICATOR */        CONFIGTYPE_BOOL,
3236   /* CONFIGITEM_PFMRETURNTIME */               CONFIGTYPE_8
3237 };
3238 
3239 
3240 /*
3241  *  Dissectors for each command
3242  */
3243 static void dissect_r3_cmd_response (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3244 static void dissect_r3_cmd_handshake (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3245 static void dissect_r3_cmd_killsession (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3246 static void dissect_r3_cmd_queryserialnumber (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3247 static void dissect_r3_cmd_queryversion (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3248 static void dissect_r3_cmd_setdatetime (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3249 static void dissect_r3_cmd_querydatetime (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3250 static void dissect_r3_cmd_setconfig (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3251 static void dissect_r3_cmd_getconfig (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3252 static void dissect_r3_cmd_manageuser (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3253 static void dissect_r3_cmd_deleteusers (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3254 static void dissect_r3_cmd_defineexception (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3255 static void dissect_r3_cmd_defineexceptiongroup (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3256 static void dissect_r3_cmd_definecalendar (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3257 static void dissect_r3_cmd_definetimezone (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3258 static void dissect_r3_cmd_rmtauthretry (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3259 static void dissect_r3_cmd_filters (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3260 static void dissect_r3_cmd_alarmconfigure (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3261 static void dissect_r3_cmd_eventlogdump (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3262 static void dissect_r3_cmd_declinedlogdump (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3263 static void dissect_r3_cmd_alarmlogdump (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3264 static void dissect_r3_cmd_downloadfirmware (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3265 static void dissect_r3_cmd_downloadfirmwaretimeout (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3266 static void dissect_r3_cmd_powertableselection (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3267 static void dissect_r3_cmd_clearnvram (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3268 static void dissect_r3_cmd_dpac (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3269 static void dissect_r3_cmd_selftest (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3270 static void dissect_r3_cmd_reset (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3271 static void dissect_r3_cmd_logwrite (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3272 static void dissect_r3_cmd_mfgcommand (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3273 static void dissect_r3_cmd_nvrambackup (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3274 static void dissect_r3_cmd_extendedresponse (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3275 
3276 static void (*r3command_dissect []) (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *r3_tree) =
3277 {
3278   /* CMD_RESPONSE */                dissect_r3_cmd_response,
3279   /* CMD_HANDSHAKE */               dissect_r3_cmd_handshake,
3280   /* CMD_KILLSESSION */             dissect_r3_cmd_killsession,
3281   /* CMD_QUERYSERIALNUMBER */       dissect_r3_cmd_queryserialnumber,
3282   /* CMD_QUERYVERSION */            dissect_r3_cmd_queryversion,
3283   /* CMD_SETDATETIME */             dissect_r3_cmd_setdatetime,
3284   /* CMD_QUERYDATETIME */           dissect_r3_cmd_querydatetime,
3285   /* CMD_SETCONFIG */               dissect_r3_cmd_setconfig,
3286   /* CMD_GETCONFIG */               dissect_r3_cmd_getconfig,
3287   /* CMD_MANAGEUSER */              dissect_r3_cmd_manageuser,
3288   /* CMD_DELETEUSERS */             dissect_r3_cmd_deleteusers,
3289   /* CMD_DEFINEEXCEPTION */         dissect_r3_cmd_defineexception,
3290   /* CMD_DEFINEEXCEPTIONGROUP */    dissect_r3_cmd_defineexceptiongroup,
3291   /* CMD_DEFINECALENDAR */          dissect_r3_cmd_definecalendar,
3292   /* CMD_DEFINETIMEZONE */          dissect_r3_cmd_definetimezone,
3293   /* CMD_RMTAUTHRETRY */            dissect_r3_cmd_rmtauthretry,
3294   /* CMD_FILTERS */                 dissect_r3_cmd_filters,
3295   /* CMD_ALARMCONFIGURE */          dissect_r3_cmd_alarmconfigure,
3296   /* CMD_EVENTLOGDUMP */            dissect_r3_cmd_eventlogdump,
3297   /* CMD_DECLINEDLOGDUMP */         dissect_r3_cmd_declinedlogdump,
3298   /* CMD_ALARMLOGDUMP */            dissect_r3_cmd_alarmlogdump,
3299   /* CMD_DOWNLOADFIRMWARE */        dissect_r3_cmd_downloadfirmware,
3300   /* CMD_DOWNLOADFIRMWARETIMEOUT */ dissect_r3_cmd_downloadfirmwaretimeout,
3301   /* CMD_POWERTABLESELECTION */     dissect_r3_cmd_powertableselection,
3302   /* CMD_CLEARNVRAM */              dissect_r3_cmd_clearnvram,
3303   /* CMD_DPAC */                    dissect_r3_cmd_dpac,
3304   /* CMD_SELFTEST */                dissect_r3_cmd_selftest,
3305   /* CMD_RESET */                   dissect_r3_cmd_reset,
3306   /* CMD_LOGWRITE */                dissect_r3_cmd_logwrite,
3307   /* CMD_MFGCOMMAND */              dissect_r3_cmd_mfgcommand,
3308   /* CMD_NVRAMBACKUP */             dissect_r3_cmd_nvrambackup,
3309   /* CMD_EXTENDEDRESPONSE */        dissect_r3_cmd_extendedresponse
3310 };
3311 
3312 static void dissect_r3_cmdmfg_setserialnumber (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3313 static void dissect_r3_cmdmfg_setcryptkey (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3314 static void dissect_r3_cmdmfg_dumpnvram (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3315 static void dissect_r3_cmdmfg_terminal (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3316 static void dissect_r3_cmdmfg_remoteunlock (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3317 static void dissect_r3_cmdmfg_auxctlrversion (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3318 static void dissect_r3_cmdmfg_iopins (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3319 static void dissect_r3_cmdmfg_adcs (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3320 static void dissect_r3_cmdmfg_hardwareid (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3321 static void dissect_r3_cmdmfg_checkpointlogdump (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3322 static void dissect_r3_cmdmfg_checkpointlogclear (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3323 static void dissect_r3_cmdmfg_readregisters (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3324 static void dissect_r3_cmdmfg_forceoptions (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3325 static void dissect_r3_cmdmfg_commuser (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3326 static void dissect_r3_cmdmfg_dumpkeypad (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3327 static void dissect_r3_cmdmfg_batterycheck (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3328 static void dissect_r3_cmdmfg_ramrefresh (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3329 static void dissect_r3_cmdmfg_taskflags (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3330 static void dissect_r3_cmdmfg_timerchain (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3331 static void dissect_r3_cmdmfg_peekpoke (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3332 static void dissect_r3_cmdmfg_lockstate (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3333 static void dissect_r3_cmdmfg_capabilities (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3334 static void dissect_r3_cmdmfg_dumpm41t81 (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3335 static void dissect_r3_cmdmfg_debuglogdump (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3336 static void dissect_r3_cmdmfg_debuglogclear (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3337 static void dissect_r3_cmdmfg_testwdt (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3338 static void dissect_r3_cmdmfg_querycksum (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3339 static void dissect_r3_cmdmfg_validatechecksums (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3340 static void dissect_r3_cmdmfg_rebuildlrucache (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3341 static void dissect_r3_cmdmfg_tzupdate (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3342 static void dissect_r3_cmdmfg_testpreserve (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3343 static void dissect_r3_cmdmfg_mortisestatelogdump (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3344 static void dissect_r3_cmdmfg_mortisestatelogclear (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3345 static void dissect_r3_cmdmfg_mortisepins (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3346 static void dissect_r3_cmdmfg_haltandcatchfire (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3347 
3348 static void (*r3commandmfg_dissect []) (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *r3_tree) =
3349 {
3350   /* CMDMFG_SETSERIALNUMBER */       dissect_r3_cmdmfg_setserialnumber,
3351   /* CMDMFG_SETCRYPTKEY */           dissect_r3_cmdmfg_setcryptkey,
3352   /* CMDMFG_DUMPNVRAM */             dissect_r3_cmdmfg_dumpnvram,
3353   /* CMDMFG_TERMINAL */              dissect_r3_cmdmfg_terminal,
3354   /* CMDMFG_REMOTEUNLOCK */          dissect_r3_cmdmfg_remoteunlock,
3355   /* CMDMFG_AUXCTLRVERSION */        dissect_r3_cmdmfg_auxctlrversion,
3356   /* CMDMFG_IOPINS */                dissect_r3_cmdmfg_iopins,
3357   /* CMDMFG_ADCS */                  dissect_r3_cmdmfg_adcs,
3358   /* CMDMFG_HARDWAREID */            dissect_r3_cmdmfg_hardwareid,
3359   /* CMDMFG_CHECKPOINTLOGDUMP */     dissect_r3_cmdmfg_checkpointlogdump,
3360   /* CMDMFG_CHECKPOINTLOGCLEAR */    dissect_r3_cmdmfg_checkpointlogclear,
3361   /* CMDMFG_READREGISTERS */         dissect_r3_cmdmfg_readregisters,
3362   /* CMDMFG_FORCEOPTIONS */          dissect_r3_cmdmfg_forceoptions,
3363   /* CMDMFG_COMMUSER */              dissect_r3_cmdmfg_commuser,
3364   /* CMDMFG_DUMPKEYPAD */            dissect_r3_cmdmfg_dumpkeypad,
3365   /* CMDMFG_BATTERYCHECK */          dissect_r3_cmdmfg_batterycheck,
3366   /* CMDMFG_RAMREFRESH */            dissect_r3_cmdmfg_ramrefresh,
3367   /* CMDMFG_TASKFLAGS */             dissect_r3_cmdmfg_taskflags,
3368   /* CMDMFG_TIMERCHAIN */            dissect_r3_cmdmfg_timerchain,
3369   /* CMDMFG_PEEKPOKE */              dissect_r3_cmdmfg_peekpoke,
3370   /* CMDMFG_LOCKSTATE */             dissect_r3_cmdmfg_lockstate,
3371   /* CMDMFG_CAPABILITIES */          dissect_r3_cmdmfg_capabilities,
3372   /* CMDMFG_DUMPM41T81 */            dissect_r3_cmdmfg_dumpm41t81,
3373   /* CMDMFG_DEBUGLOGDUMP */          dissect_r3_cmdmfg_debuglogdump,
3374   /* CMDMFG_DEBUGLOGCLEAR */         dissect_r3_cmdmfg_debuglogclear,
3375   /* CMDMFG_TESTWDT */               dissect_r3_cmdmfg_testwdt,
3376   /* CMDMFG_QUERYCKSUM */            dissect_r3_cmdmfg_querycksum,
3377   /* CMDMFG_VALIDATECHECKSUMS */     dissect_r3_cmdmfg_validatechecksums,
3378   /* CMDMFG_REBUILDLRUCACHE */       dissect_r3_cmdmfg_rebuildlrucache,
3379   /* CMDMFG_TZUPDATE */              dissect_r3_cmdmfg_tzupdate,
3380   /* CMDMFG_TESTPRESERVE */          dissect_r3_cmdmfg_testpreserve,
3381   /* CMDMFG_MORTISESTATELOGDUMP */   dissect_r3_cmdmfg_mortisestatelogdump,
3382   /* CMDMFG_MORTISESTATELOGCLEAR */  dissect_r3_cmdmfg_mortisestatelogclear,
3383   /* CMDMFG_MORTISEPINS */           dissect_r3_cmdmfg_mortisepins,
3384   /* CMDMFG_HALTANDCATCHFIRE */      dissect_r3_cmdmfg_haltandcatchfire
3385 };
3386 
3387 static void dissect_r3_response_singlebyte (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3388 static void dissect_r3_response_hasdata (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3389 
3390 static void (*r3response_dissect []) (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *r3_tree) =
3391 {
3392   /* RESPONSETYPE_OK */                  dissect_r3_response_singlebyte,
3393   /* RESPONSETYPE_ERROR */               dissect_r3_response_singlebyte,
3394   /* RESPONSETYPE_HASDATA */             dissect_r3_response_hasdata,
3395   /* RESPONSETYPE_NOHANDLER */           dissect_r3_response_singlebyte,
3396   /* RESPONSETYPE_NOSESSION */           dissect_r3_response_singlebyte,
3397   /* RESPONSETYPE_BADCOMMAND */          dissect_r3_response_singlebyte,
3398   /* RESPONSETYPE_BADPARAMETER */        dissect_r3_response_singlebyte,
3399   /* RESPONSETYPE_BADPARAMETERLEN */     dissect_r3_response_singlebyte,
3400   /* RESPONSETYPE_MISSINGPARAMETER */    dissect_r3_response_singlebyte,
3401   /* RESPONSETYPE_DUPLICATEPARAMETER */  dissect_r3_response_singlebyte,
3402   /* RESPONSETYPE_PARAMETERCONFLICT */   dissect_r3_response_singlebyte,
3403   /* RESPONSETYPE_BADDEVICE */           dissect_r3_response_singlebyte,
3404   /* RESPONSETYPE_NVRAMERROR */          dissect_r3_response_singlebyte,
3405   /* RESPONSETYPE_NVRAMERRORNOACK */     dissect_r3_response_singlebyte,
3406   /* RESPONSETYPE_NVRAMERRORNOACK32 */   dissect_r3_response_singlebyte,
3407   /* RESPONSETYPE_NOTI2CADDRESS */       dissect_r3_response_singlebyte,
3408   /* RESPONSETYPE_FIRMWAREERROR */       dissect_r3_response_singlebyte,
3409   /* RESPONSETYPE_DUMPINPROGRESS */      dissect_r3_response_singlebyte,
3410   /* RESPONSETYPE_INTERNALERROR */       dissect_r3_response_singlebyte,
3411   /* RESPONSETYPE_NOTIMPLEMENTED */      dissect_r3_response_singlebyte,
3412   /* RESPONSETYPE_PINFORMATERROR */      dissect_r3_response_singlebyte,
3413   /* RESPONSETYPE_PINEXISTS */           dissect_r3_response_singlebyte,
3414   /* RESPONSETYPE_PINNOTFOUND */         dissect_r3_response_singlebyte,
3415   /* RESPONSETYPE_USERACTIVE */          dissect_r3_response_singlebyte,
3416   /* RESPONSETYPE_USERINACTIVE */        dissect_r3_response_singlebyte,
3417   /* RESPONSETYPE_PARENTNOTFOUND */      dissect_r3_response_singlebyte,
3418   /* RESPONSETYPE_NOCHAIN */             dissect_r3_response_singlebyte,
3419   /* RESPONSETYPE_CAUGHTINLOOP */        dissect_r3_response_singlebyte,
3420   /* RESPONSETYPE_EVENTFILTERED */       dissect_r3_response_singlebyte,
3421   /* RESPONSETYPE_PAYLOADTOOLARGE */     dissect_r3_response_singlebyte,
3422   /* RESPONSETYPE_ENDOFDATA */           dissect_r3_response_singlebyte,
3423   /* RESPONSETYPE_RMTAUTHREJECTED */     dissect_r3_response_singlebyte,
3424   /* RESPONSETYPE_NVRAMVERSIONERROR */   dissect_r3_response_singlebyte,
3425   /* RESPONSETYPE_NOHARDWARE */          dissect_r3_response_singlebyte,
3426   /* RESPONSETYPE_SCHEDULERCONFLICT */   dissect_r3_response_singlebyte,
3427   /* RESPONSETYPE_NVRAMWRITEERROR */     dissect_r3_response_singlebyte,
3428   /* RESPONSETYPE_DECLINEDFILTERED */    dissect_r3_response_singlebyte,
3429   /* RESPONSETYPE_NECONFIGPARM */        dissect_r3_response_singlebyte,
3430   /* RESPONSETYPE_FLASHERASEERROR */     dissect_r3_response_singlebyte,
3431   /* RESPONSETYPE_FLASHWRITEERROR */     dissect_r3_response_singlebyte,
3432   /* RESPONSETYPE_BADNVBACKUP */         dissect_r3_response_singlebyte,
3433   /* RESPONSETYPE_EARLYACK */            dissect_r3_response_singlebyte,
3434   /* RESPONSETYPE_ALARMFILTERED */       dissect_r3_response_singlebyte,
3435   /* RESPONSETYPE_ACVFAILURE */          dissect_r3_response_singlebyte,
3436   /* RESPONSETYPE_USERCHECKSUMERROR */   dissect_r3_response_singlebyte,
3437   /* RESPONSETYPE_CHECKSUMERROR */       dissect_r3_response_singlebyte,
3438   /* RESPONSETYPE_RTCSQWFAILURE */       dissect_r3_response_singlebyte,
3439   /* RESPONSETYPE_PRIORITYSHUTDOWN */    dissect_r3_response_singlebyte,
3440   /* RESPONSETYPE_NOTMODIFIABLE */       dissect_r3_response_singlebyte,
3441   /* RESPONSETYPE_CANTPRESERVE */        dissect_r3_response_singlebyte,
3442   /* RESPONSETYPE_INPASSAGEMODE */       dissect_r3_response_singlebyte
3443 };
3444 
3445 static void dissect_r3_upstreamcommand_reserved (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3446 static void dissect_r3_upstreamcommand_debugmsg (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3447 static void dissect_r3_upstreamcommand_queryversion (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3448 static void dissect_r3_upstreamcommand_querydatetime (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3449 static void dissect_r3_upstreamcommand_queryserialnumber (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3450 static void dissect_r3_upstreamcommand_dumpeventlog (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3451 static void dissect_r3_upstreamcommand_dumpnvram (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3452 static void dissect_r3_upstreamcommand_rmtquthrequest (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3453 static void dissect_r3_upstreamcommand_retrieveuser (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3454 static void dissect_r3_upstreamcommand_queryconfig (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3455 static void dissect_r3_upstreamcommand_rmteventlogrecord (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3456 static void dissect_r3_upstreamcommand_dpac (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3457 static void dissect_r3_upstreamcommand_notify (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3458 static void dissect_r3_upstreamcommand_mfg (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3459 static void dissect_r3_upstreamcommand_eventlogwarning (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3460 static void dissect_r3_upstreamcommand_dumpnvramrle (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3461 static void dissect_r3_upstreamcommand_rmtdeclinedrecord (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3462 static void dissect_r3_upstreamcommand_declinedwarning (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3463 static void dissect_r3_upstreamcommand_dumpdeclinedlog (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3464 static void dissect_r3_upstreamcommand_rmtalarmrecord (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3465 static void dissect_r3_upstreamcommand_alarmwarning (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3466 static void dissect_r3_upstreamcommand_dumpalarmlog (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3467 static void dissect_r3_upstreamcommand_connectscheduler (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3468 static void dissect_r3_upstreamcommand_connectcommuser (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3469 static void dissect_r3_upstreamcommand_commandalarm (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3470 static void dissect_r3_upstreamcommand_dumpdebuglog (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3471 
3472 static void (*r3upstreamcommand_dissect []) (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *r3_tree) =
3473 {
3474   /* UPSTREAMCOMMAND_RESERVED */           dissect_r3_upstreamcommand_reserved,
3475   /* UPSTREAMCOMMAND_DEBUGMSG */           dissect_r3_upstreamcommand_debugmsg,
3476   /* UPSTREAMCOMMAND_QUERYVERSION */       dissect_r3_upstreamcommand_queryversion,
3477   /* UPSTREAMCOMMAND_QUERYDATETIME */      dissect_r3_upstreamcommand_querydatetime,
3478   /* UPSTREAMCOMMAND_QUERYSERIALNUMBER */  dissect_r3_upstreamcommand_queryserialnumber,
3479   /* UPSTREAMCOMMAND_DUMPEVENTLOG */       dissect_r3_upstreamcommand_dumpeventlog,
3480   /* UPSTREAMCOMMAND_DUMPNVRAM */          dissect_r3_upstreamcommand_dumpnvram,
3481   /* UPSTREAMCOMMAND_RMTAUTHREQUEST */     dissect_r3_upstreamcommand_rmtquthrequest,
3482   /* UPSTREAMCOMMAND_RETRIEVEUSER */       dissect_r3_upstreamcommand_retrieveuser,
3483   /* UPSTREAMCOMMAND_QUERYCONFIG */        dissect_r3_upstreamcommand_queryconfig,
3484   /* UPSTREAMCOMMAND_RMTEVENTLOGRECORD */  dissect_r3_upstreamcommand_rmteventlogrecord,
3485   /* UPSTREAMCOMMAND_DPAC */               dissect_r3_upstreamcommand_dpac,
3486   /* UPSTREAMCOMMAND_NOTIFY */             dissect_r3_upstreamcommand_notify,
3487   /* UPSTREAMCOMMAND_MFG */                dissect_r3_upstreamcommand_mfg,
3488   /* UPSTREAMCOMMAND_EVENTLOGWARNING */    dissect_r3_upstreamcommand_eventlogwarning,
3489   /* UPSTREAMCOMMAND_DUMPNVRAMRLE */       dissect_r3_upstreamcommand_dumpnvramrle,
3490   /* UPSTREAMCOMMAND_RMTDECLINEDRECORD */  dissect_r3_upstreamcommand_rmtdeclinedrecord,
3491   /* UPSTREAMCOMMAND_DECLINEDWARNING */    dissect_r3_upstreamcommand_declinedwarning,
3492   /* UPSTREAMCOMMAND_DUMPDECLINEDLOG */    dissect_r3_upstreamcommand_dumpdeclinedlog,
3493   /* UPSTREAMCOMMAND_RMTALARMRECORD */     dissect_r3_upstreamcommand_rmtalarmrecord,
3494   /* UPSTREAMCOMMAND_ALARMWARNING */       dissect_r3_upstreamcommand_alarmwarning,
3495   /* UPSTREAMCOMMAND_DUMPALARMLOG */       dissect_r3_upstreamcommand_dumpalarmlog,
3496   /* UPSTREAMCOMMAND_CONNECTSCHEDULER */   dissect_r3_upstreamcommand_connectscheduler,
3497   /* UPSTREAMCOMMAND_CONNECTCOMMUSER */    dissect_r3_upstreamcommand_connectcommuser,
3498   /* UPSTREAMCOMMAND_CONNECTALARM */       dissect_r3_upstreamcommand_commandalarm,
3499   /* UPSTREAMCOMMAND_DUMPDEBUGLOG */       dissect_r3_upstreamcommand_dumpdebuglog
3500 };
3501 
3502 static void dissect_r3_upstreammfgfield_iopins (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3503 static void dissect_r3_upstreammfgfield_adcs (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3504 static void dissect_r3_upstreammfgfield_hardwareid (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3505 static void dissect_r3_upstreammfgfield_checkpointlog (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3506 static void dissect_r3_upstreammfgfield_cpuregisters (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3507 static void dissect_r3_upstreammfgfield_taskflags (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3508 static void dissect_r3_upstreammfgfield_timerchain (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3509 static void dissect_r3_upstreammfgfield_peekpoke (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3510 static void dissect_r3_upstreammfgfield_lockstate (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3511 static void dissect_r3_upstreammfgfield_capabilities (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3512 static void dissect_r3_upstreammfgfield_dumpm41t81 (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3513 static void dissect_r3_upstreammfgfield_nvramchecksumvalue (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3514 static void dissect_r3_upstreammfgfield_checksumresults (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3515 static void dissect_r3_upstreammfgfield_mortisestatelog (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3516 static void dissect_r3_upstreammfgfield_mortisepins (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3517 static void dissect_r3_upstreammfgfield_keypadchar (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3518 static void dissect_r3_upstreammfgfield_magcard (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3519 static void dissect_r3_upstreammfgfield_proxcard (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree);
3520 
3521 static void (*r3upstreammfgfield_dissect []) (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *r3_tree) =
3522 {
3523   /* MFGFIELD_IOPINS */              dissect_r3_upstreammfgfield_iopins,
3524   /* MFGFIELD_ADCS */                dissect_r3_upstreammfgfield_adcs,
3525   /* MFGFIELD_HARDWAREID */          dissect_r3_upstreammfgfield_hardwareid,
3526   /* MFGFIELD_CHECKPOINTLOG */       dissect_r3_upstreammfgfield_checkpointlog,
3527   /* MFGFIELD_CPUREGISTERS */        dissect_r3_upstreammfgfield_cpuregisters,
3528   /* MFGFIELD_TASKFLAGS */           dissect_r3_upstreammfgfield_taskflags,
3529   /* MFGFIELD_TIMERCHAIN */          dissect_r3_upstreammfgfield_timerchain,
3530   /* MFGFIELD_PEEKPOKE */            dissect_r3_upstreammfgfield_peekpoke,
3531   /* MFGFIELD_LOCKSTATE */           dissect_r3_upstreammfgfield_lockstate,
3532   /* MFGFIELD_CAPABILITIES */        dissect_r3_upstreammfgfield_capabilities,
3533   /* MFGFIELD_DUMPM41T81 */          dissect_r3_upstreammfgfield_dumpm41t81,
3534   /* MFGFIELD_NVRAMCHECKSUMVALUE */  dissect_r3_upstreammfgfield_nvramchecksumvalue,
3535   /* MFGFIELD_CHECKSUMRESULTS */     dissect_r3_upstreammfgfield_checksumresults,
3536   /* MFGFIELD_MORTISESTATELOG */     dissect_r3_upstreammfgfield_mortisestatelog,
3537   /* MFGFIELD_MORTISEPINS */         dissect_r3_upstreammfgfield_mortisepins,
3538   /* MFGFIELD_KEYPADCHAR */          dissect_r3_upstreammfgfield_keypadchar,
3539   /* MFGFIELD_MAGCARD */             dissect_r3_upstreammfgfield_magcard,
3540   /* MFGFIELD_PROXCARD */            dissect_r3_upstreammfgfield_proxcard
3541 };
3542 
3543 /*
3544  * ***************************************************************************
3545  */
3546 static void
dissect_serialnumber(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree,int hf_index)3547 dissect_serialnumber (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree, int hf_index)
3548 {
3549   proto_item  *sn_item;
3550   proto_tree  *sn_tree;
3551   const gchar *s;
3552 
3553   tvb_ensure_bytes_exist (tvb, start_offset, 16);
3554 
3555   if (!tree)
3556     return;
3557 
3558   sn_item = proto_tree_add_item (tree, hf_index, tvb, start_offset, 16, ENC_ASCII|ENC_NA);
3559   sn_tree = proto_item_add_subtree (sn_item, ett_r3serialnumber);
3560 
3561   s = tvb_get_string_enc (pinfo->pool, tvb, start_offset +  0, 2, ENC_ASCII|ENC_NA);
3562   proto_tree_add_string_format_value(sn_tree, hf_r3_sn_manufacturer, tvb, start_offset +  0, 2, s, "%s (%s)", s, str_to_str (s, r3_snmanufacturernames, "[Unknown]"));
3563   s = tvb_get_string_enc (pinfo->pool, tvb, start_offset +  2, 1, ENC_ASCII|ENC_NA);
3564   proto_tree_add_string_format_value(sn_tree, hf_r3_sn_year, tvb, start_offset +  2, 1, s, "%s (%s)", s, str_to_str (s, r3_snyearnames, "[Unknown]"));
3565   proto_tree_add_item(sn_tree, hf_r3_sn_week, tvb, start_offset +  3, 2, ENC_ASCII|ENC_NA);
3566   s = tvb_get_string_enc (pinfo->pool, tvb, start_offset +  5, 1, ENC_ASCII|ENC_NA);
3567   proto_tree_add_string_format_value(sn_tree, hf_r3_sn_model, tvb, start_offset +  5, 1, s, "%s (%s)", s, str_to_str (s, r3_snmodelnames, "[Unknown]"));
3568   proto_tree_add_item(sn_tree, hf_r3_sn_sequence, tvb, start_offset +  6, 4, ENC_ASCII|ENC_NA);
3569   s = tvb_get_string_enc (pinfo->pool, tvb, start_offset + 10, 1, ENC_ASCII|ENC_NA);
3570   proto_tree_add_string_format_value(sn_tree, hf_r3_sn_group, tvb, start_offset + 10, 1, s, "%s (%s)", s, str_to_str (s, r3_sngroupnames, "[Unknown]"));
3571   s = tvb_get_string_enc (pinfo->pool, tvb, start_offset + 11, 1, ENC_ASCII|ENC_NA);
3572   proto_tree_add_string_format_value(sn_tree, hf_r3_sn_nid, tvb, start_offset + 11, 1, s, "%s (%s)", s, str_to_str (s, r3_snnidnames, "[Unknown]"));
3573   s = tvb_get_string_enc (pinfo->pool, tvb, start_offset + 12, 2, ENC_ASCII|ENC_NA);
3574   proto_tree_add_string_format_value(sn_tree, hf_r3_sn_hid, tvb, start_offset + 12, 2, s, "%s (%s)", s, str_to_str (s, r3_snhidnames, "[Unknown]"));
3575   s = tvb_get_string_enc (pinfo->pool, tvb, start_offset + 14, 1, ENC_ASCII|ENC_NA);
3576   proto_tree_add_string_format_value(sn_tree, hf_r3_sn_power_supply, tvb, start_offset + 14, 1, s, "%s (%s)", s, str_to_str (s, r3_snpowersupplynames, "[Unknown]"));
3577   s = tvb_get_string_enc (pinfo->pool, tvb, start_offset + 15, 1, ENC_ASCII|ENC_NA);
3578   proto_tree_add_string_format_value(sn_tree, hf_r3_sn_mortise, tvb, start_offset + 15, 1, s, "%s (%s)", s, str_to_str (s, r3_snmortisenames, "[Unknown]"));
3579 }
3580 
3581 /*
3582  * ***************************************************************************
3583  *
3584  * We've already ensured we have enough bytes in the table via tvb_ensure_bytes_exist()
3585  *
3586  */
3587 static void
dissect_r3_upstreamfields(tvbuff_t * tvb,guint32 start_offset,guint32 length,packet_info * pinfo,proto_tree * tree)3588 dissect_r3_upstreamfields (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree)
3589 {
3590   guint32 offset = 0;
3591 
3592   DISSECTOR_ASSERT(start_offset == 0);
3593 
3594   while (offset < tvb_reported_length (tvb))
3595   {
3596     guint32      fieldLength = tvb_get_guint8 (tvb, offset + 0);
3597     guint32      fieldType   = tvb_get_guint8 (tvb, offset + 1);
3598     guint32      dataLength  = fieldLength - 2;
3599     proto_item  *upstreamfield_item;
3600     proto_item  *upstreamfield_length;
3601     proto_tree  *upstreamfield_tree;
3602     const gchar *usfn;
3603 
3604     usfn = val_to_str_ext_const (fieldType, &r3_upstreamfieldnames_ext, "[Unknown Field]");
3605 
3606     upstreamfield_item = proto_tree_add_none_format (tree, hf_r3_upstreamfield, tvb, offset + 0, fieldLength, "Upstream Field: %s (%u)", usfn, fieldType);
3607     upstreamfield_tree = proto_item_add_subtree (upstreamfield_item, ett_r3upstreamfield);
3608 
3609     upstreamfield_length = proto_tree_add_item (upstreamfield_tree, hf_r3_upstreamfieldlength, tvb, offset + 0, 1, ENC_LITTLE_ENDIAN);
3610     proto_tree_add_item (upstreamfield_tree, hf_r3_upstreamfieldtype, tvb, offset + 1, 1, ENC_LITTLE_ENDIAN);
3611 
3612     if (fieldLength < 2)
3613     {
3614       dataLength = 0;
3615       expert_add_info_format(pinfo, upstreamfield_length, &ei_r3_malformed_length, "Malformed length value -- all fields are at least 2 octets.");
3616     }
3617 
3618     offset += 2;
3619 
3620     switch (fieldType)
3621     {
3622       /*
3623        *  Booleans, 8 & 16 bit values
3624        */
3625       case UPSTREAMFIELD_NOTUSED :
3626       case UPSTREAMFIELD_PRIMARYPIN :
3627       case UPSTREAMFIELD_AUXPIN :
3628       case UPSTREAMFIELD_ACCESSALWAYS :
3629       case UPSTREAMFIELD_CACHED :
3630       case UPSTREAMFIELD_ENTRYDEVICE :
3631       case UPSTREAMFIELD_PPMIFIELDTYPE :
3632       case UPSTREAMFIELD_RESPONSEWINDOW :
3633       case UPSTREAMFIELD_USERTYPE :
3634       case UPSTREAMFIELD_PRIMARYFIELDTYPE :
3635       case UPSTREAMFIELD_AUXFIELDTYPE :
3636       case UPSTREAMFIELD_ACCESSMODE :
3637       case UPSTREAMFIELD_USECOUNT :
3638       case UPSTREAMFIELD_EXCEPTIONGROUP :
3639       case UPSTREAMFIELD_NAR :
3640       case UPSTREAMFIELD_SEQUENCENUMBER :
3641       case UPSTREAMFIELD_USERNUMBER :
3642       case UPSTREAMFIELD_EVENTLOGRECORDCOUNT :
3643       case UPSTREAMFIELD_DECLINEDRECORDCOUNT :
3644       case UPSTREAMFIELD_ALARMRECORDCOUNT :
3645         proto_tree_add_item (upstreamfield_tree, hf_r3_upstreamfieldarray [fieldType], tvb, offset, dataLength, ENC_LITTLE_ENDIAN);
3646         break;
3647 
3648       /*
3649        *  Strings
3650        */
3651       case UPSTREAMFIELD_PIN :
3652       case UPSTREAMFIELD_VERSION :
3653       case UPSTREAMFIELD_AUXCTLRVERSION :
3654         proto_tree_add_item (upstreamfield_tree, hf_r3_upstreamfieldarray [fieldType], tvb, offset, dataLength, ENC_ASCII|ENC_NA);
3655         break;
3656 
3657       /*
3658        *  Special types
3659        */
3660       case UPSTREAMFIELD_SERIALNUMBER :
3661         {
3662           tvbuff_t *sn_tvb = tvb_new_subset_length (tvb, offset, dataLength);
3663 
3664           dissect_serialnumber (sn_tvb, 0, length, pinfo, upstreamfield_tree, hf_r3_upstreamfieldarray [fieldType]);
3665         }
3666         break;
3667 
3668       case UPSTREAMFIELD_EVENTLOGRECORD :
3669         {
3670           if (dataLength != 9)
3671           {
3672             expert_add_info_format(pinfo, upstreamfield_length, &ei_r3_malformed_length, "Malformed event log field -- expected 9 octets");
3673           }
3674           else
3675           {
3676             proto_tree *eventlog_tree;
3677 
3678             if (!upstreamfield_tree)
3679               break;
3680 
3681             eventlog_tree = proto_tree_add_subtree(upstreamfield_tree, tvb, offset, 9, ett_r3eventlogrecord, NULL, "Event Log Record");
3682 
3683             proto_tree_add_item (eventlog_tree, hf_r3_eventlog_year,       tvb, offset + 0, 1, ENC_LITTLE_ENDIAN);
3684             proto_tree_add_item (eventlog_tree, hf_r3_eventlog_month,      tvb, offset + 1, 1, ENC_LITTLE_ENDIAN);
3685             proto_tree_add_item (eventlog_tree, hf_r3_eventlog_day,        tvb, offset + 2, 1, ENC_LITTLE_ENDIAN);
3686             proto_tree_add_item (eventlog_tree, hf_r3_eventlog_hour,       tvb, offset + 3, 1, ENC_LITTLE_ENDIAN);
3687             proto_tree_add_item (eventlog_tree, hf_r3_eventlog_minute,     tvb, offset + 4, 1, ENC_LITTLE_ENDIAN);
3688             proto_tree_add_item (eventlog_tree, hf_r3_eventlog_second,     tvb, offset + 5, 1, ENC_LITTLE_ENDIAN);
3689             proto_tree_add_item (eventlog_tree, hf_r3_eventlog_usernumber, tvb, offset + 6, 2, ENC_LITTLE_ENDIAN);
3690             proto_tree_add_item (eventlog_tree, hf_r3_eventlog_event,      tvb, offset + 8, 1, ENC_LITTLE_ENDIAN);
3691           }
3692         }
3693         break;
3694 
3695       case UPSTREAMFIELD_DATETIME :
3696         {
3697           if (dataLength != 8)
3698           {
3699             expert_add_info_format(pinfo, upstreamfield_length, &ei_r3_malformed_length, "Malformed date/time field -- expected 8 octets");
3700           }
3701           else
3702           {
3703             proto_tree *datetime_tree;
3704 
3705             if (!upstreamfield_tree)
3706               break;
3707 
3708             datetime_tree = proto_tree_add_subtree_format(upstreamfield_tree, tvb, offset, 8, ett_r3datetime, NULL,
3709                 "Date/Time: %02u/%02u/%02u-%u %02u:%02u:%02u %u",
3710                 tvb_get_guint8 (tvb, offset + 0), tvb_get_guint8 (tvb, offset + 1), tvb_get_guint8 (tvb, offset + 2), tvb_get_guint8 (tvb, offset + 3),
3711                 tvb_get_guint8 (tvb, offset + 4), tvb_get_guint8 (tvb, offset + 5), tvb_get_guint8 (tvb, offset + 6), tvb_get_guint8 (tvb, offset + 7));
3712 
3713             proto_tree_add_item (datetime_tree, hf_r3_datetime_year,    tvb, offset + 0, 1, ENC_LITTLE_ENDIAN);
3714             proto_tree_add_item (datetime_tree, hf_r3_datetime_month,   tvb, offset + 1, 1, ENC_LITTLE_ENDIAN);
3715             proto_tree_add_item (datetime_tree, hf_r3_datetime_day,     tvb, offset + 2, 1, ENC_LITTLE_ENDIAN);
3716             proto_tree_add_item (datetime_tree, hf_r3_datetime_dow,     tvb, offset + 3, 1, ENC_LITTLE_ENDIAN);
3717             proto_tree_add_item (datetime_tree, hf_r3_datetime_hours,   tvb, offset + 4, 1, ENC_LITTLE_ENDIAN);
3718             proto_tree_add_item (datetime_tree, hf_r3_datetime_minutes, tvb, offset + 5, 1, ENC_LITTLE_ENDIAN);
3719             proto_tree_add_item (datetime_tree, hf_r3_datetime_seconds, tvb, offset + 6, 1, ENC_LITTLE_ENDIAN);
3720             proto_tree_add_item (datetime_tree, hf_r3_datetime_dst,     tvb, offset + 7, 1, ENC_LITTLE_ENDIAN);
3721           }
3722         }
3723         break;
3724 
3725       case UPSTREAMFIELD_DECLINEDRECORD :
3726         {
3727 
3728           if (dataLength != 49)
3729           {
3730             expert_add_info_format(pinfo, upstreamfield_length, &ei_r3_malformed_length, "Malformed declined log field -- expected 49 octets");
3731           }
3732           else
3733           {
3734             proto_tree *declinedlog_tree;
3735             guint8 cred1type;
3736             guint8 cred2type;
3737 
3738             if (!upstreamfield_tree)
3739               break;
3740 
3741             declinedlog_tree = proto_tree_add_subtree(upstreamfield_tree, tvb, offset, 49, ett_r3declinedlogrecord, NULL, "Declined Log Record");
3742 
3743             proto_tree_add_item (declinedlog_tree, hf_r3_declinedlog_year,       tvb, offset + 0, 1, ENC_LITTLE_ENDIAN);
3744             proto_tree_add_item (declinedlog_tree, hf_r3_declinedlog_month,      tvb, offset + 1, 1, ENC_LITTLE_ENDIAN);
3745             proto_tree_add_item (declinedlog_tree, hf_r3_declinedlog_day,        tvb, offset + 2, 1, ENC_LITTLE_ENDIAN);
3746             proto_tree_add_item (declinedlog_tree, hf_r3_declinedlog_hour,       tvb, offset + 3, 1, ENC_LITTLE_ENDIAN);
3747             proto_tree_add_item (declinedlog_tree, hf_r3_declinedlog_minute,     tvb, offset + 4, 1, ENC_LITTLE_ENDIAN);
3748             proto_tree_add_item (declinedlog_tree, hf_r3_declinedlog_second,     tvb, offset + 5, 1, ENC_LITTLE_ENDIAN);
3749             proto_tree_add_item (declinedlog_tree, hf_r3_declinedlog_usernumber, tvb, offset + 6, 2, ENC_LITTLE_ENDIAN);
3750 
3751             cred1type = tvb_get_guint8 (tvb, offset + 8) & 0x07;
3752             cred2type = (tvb_get_guint8 (tvb, offset + 8) & 0x38) >> 3;
3753 
3754             proto_tree_add_uint (declinedlog_tree, hf_r3_declinedlog_cred1type,  tvb, offset, 1, cred1type);
3755             proto_tree_add_uint (declinedlog_tree, hf_r3_declinedlog_cred2type,  tvb, offset, 1, cred2type);
3756             proto_tree_add_item (declinedlog_tree, hf_r3_declinedlog_cred1,      tvb, offset +  9, 19, ENC_NA);
3757             proto_tree_add_item (declinedlog_tree, hf_r3_declinedlog_cred2,      tvb, offset + 28, 19, ENC_NA);
3758           }
3759         }
3760         break;
3761 
3762       case UPSTREAMFIELD_EXPIREON :
3763         {
3764           if (dataLength != 3)
3765           {
3766             expert_add_info_format(pinfo, upstreamfield_length, &ei_r3_malformed_length, "Malformed expiration field -- expected 3 octets");
3767           }
3768           else
3769           {
3770             proto_tree *expireon_tree;
3771 
3772             if (!upstreamfield_tree)
3773               break;
3774 
3775             expireon_tree = proto_tree_add_subtree_format(upstreamfield_tree, tvb, offset, 3, ett_r3expireon, NULL,
3776                 "Expire YY/MM/DD: %02u/%02u/%02u",
3777                 tvb_get_guint8 (tvb, offset + 2), tvb_get_guint8 (tvb, offset + 0), tvb_get_guint8 (tvb, offset + 1));
3778 
3779             proto_tree_add_item (expireon_tree, hf_r3_expireon_month, tvb, offset + 0, 1, ENC_LITTLE_ENDIAN);
3780             proto_tree_add_item (expireon_tree, hf_r3_expireon_day,   tvb, offset + 1, 1, ENC_LITTLE_ENDIAN);
3781             proto_tree_add_item (expireon_tree, hf_r3_expireon_year,  tvb, offset + 2, 1, ENC_LITTLE_ENDIAN);
3782           }
3783         }
3784         break;
3785 
3786       case UPSTREAMFIELD_TIMEZONE :
3787         {
3788           if (dataLength != 4)
3789           {
3790             expert_add_info_format(pinfo, upstreamfield_length, &ei_r3_malformed_length, "Malformed timezone field -- expected 4 octets");
3791           }
3792           else
3793           {
3794             proto_tree_add_bitmask(upstreamfield_tree, tvb, offset, hf_r3_upstreamfieldarray[fieldType], ett_r3timezone, r3_timezonearray, ENC_LITTLE_ENDIAN);
3795           }
3796         }
3797         break;
3798 
3799       case UPSTREAMFIELD_ALARMRECORD :
3800         {
3801           if (dataLength != 9)
3802           {
3803             expert_add_info_format(pinfo, upstreamfield_length, &ei_r3_malformed_length, "Malformed alarm log field -- expected 9 octets");
3804           }
3805           else
3806           {
3807             proto_tree *alarmlog_tree;
3808 
3809             if (!upstreamfield_tree)
3810               break;
3811 
3812             alarmlog_tree = proto_tree_add_subtree(upstreamfield_tree, tvb, offset, 9, ett_r3alarmlogrecord, NULL, "Alarm Record");
3813 
3814             proto_tree_add_item (alarmlog_tree, hf_r3_alarmlog_year,       tvb, offset + 0, 1, ENC_LITTLE_ENDIAN);
3815             proto_tree_add_item (alarmlog_tree, hf_r3_alarmlog_month,      tvb, offset + 1, 1, ENC_LITTLE_ENDIAN);
3816             proto_tree_add_item (alarmlog_tree, hf_r3_alarmlog_day,        tvb, offset + 2, 1, ENC_LITTLE_ENDIAN);
3817             proto_tree_add_item (alarmlog_tree, hf_r3_alarmlog_hour,       tvb, offset + 3, 1, ENC_LITTLE_ENDIAN);
3818             proto_tree_add_item (alarmlog_tree, hf_r3_alarmlog_minute,     tvb, offset + 4, 1, ENC_LITTLE_ENDIAN);
3819             proto_tree_add_item (alarmlog_tree, hf_r3_alarmlog_second,     tvb, offset + 5, 1, ENC_LITTLE_ENDIAN);
3820             proto_tree_add_item (alarmlog_tree, hf_r3_alarmlog_id,         tvb, offset + 6, 1, ENC_LITTLE_ENDIAN);
3821             proto_tree_add_item (alarmlog_tree, hf_r3_alarmlog_usernumber, tvb, offset + 7, 2, ENC_LITTLE_ENDIAN);
3822           }
3823         }
3824         break;
3825 
3826       default :
3827         proto_tree_add_none_format (upstreamfield_tree, hf_r3_upstreamfielderror, tvb, offset, dataLength, "Unknown Field Type");
3828         break;
3829     }
3830 
3831     offset += dataLength;
3832   }
3833 }
3834 
3835 /*
3836  * ***************************************************************************
3837  *
3838  *  These are passed a tvb that contains whatever occurs after the [UPSTREAMCOMMAND_*] byte
3839  */
3840 static void
dissect_r3_upstreamcommand_reserved(tvbuff_t * tvb,guint32 start_offset,guint32 length,packet_info * pinfo,proto_tree * tree)3841 dissect_r3_upstreamcommand_reserved (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree)
3842 {
3843   proto_tree_add_expert(tree, pinfo, &ei_r3_reserved_upstream_command_value, tvb, start_offset, length);
3844 }
3845 
3846 static void
dissect_r3_upstreamcommand_debugmsg(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)3847 dissect_r3_upstreamcommand_debugmsg (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
3848 {
3849   proto_tree *debugmsg_tree;
3850 
3851   if (!tree)
3852     return;
3853 
3854   DISSECTOR_ASSERT(start_offset == 0);
3855 
3856   debugmsg_tree = proto_tree_add_subtree(tree, tvb, 0, -1, ett_r3debugmsg, NULL, "Debug message");
3857 
3858   proto_tree_add_item (debugmsg_tree, hf_r3_debugmsg, tvb, 1, -1, ENC_ASCII|ENC_NA);
3859 }
3860 
3861 static void
dissect_r3_upstreamcommand_queryversion(tvbuff_t * tvb,guint32 start_offset,guint32 length,packet_info * pinfo,proto_tree * tree)3862 dissect_r3_upstreamcommand_queryversion (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree)
3863 {
3864   dissect_r3_upstreamfields (tvb, start_offset, length, pinfo, tree);
3865 }
3866 
3867 static void
dissect_r3_upstreamcommand_querydatetime(tvbuff_t * tvb,guint32 start_offset,guint32 length,packet_info * pinfo,proto_tree * tree)3868 dissect_r3_upstreamcommand_querydatetime (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree)
3869 {
3870   dissect_r3_upstreamfields (tvb, start_offset, length, pinfo, tree);
3871 }
3872 
3873 static void
dissect_r3_upstreamcommand_queryserialnumber(tvbuff_t * tvb,guint32 start_offset,guint32 length,packet_info * pinfo,proto_tree * tree)3874 dissect_r3_upstreamcommand_queryserialnumber (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree)
3875 {
3876   dissect_r3_upstreamfields (tvb, start_offset, length, pinfo, tree);
3877 }
3878 
3879 static void
dissect_r3_upstreamcommand_dumpeventlog(tvbuff_t * tvb,guint32 start_offset,guint32 length,packet_info * pinfo,proto_tree * tree)3880 dissect_r3_upstreamcommand_dumpeventlog (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree)
3881 {
3882   DISSECTOR_ASSERT(start_offset == 0);
3883 
3884   tvb_ensure_bytes_exist (tvb, 0, 11);
3885 
3886   if (length != 11)
3887   {
3888     expert_add_info_format(pinfo, proto_tree_get_parent (tree), &ei_r3_malformed_length, "Malformed event log record -- expected 10 octets");
3889   }
3890   else
3891   {
3892     proto_tree  *eventlog_tree;
3893     const gchar *en;
3894 
3895     if (!tree)
3896       return;
3897 
3898     en = val_to_str_ext_const (tvb_get_guint8 (tvb, 10), &r3_eventnames_ext, "[Unknown Event]");
3899 
3900     eventlog_tree = proto_tree_add_subtree_format(tree, tvb, start_offset, 10, ett_r3eventlogrecord, NULL,
3901         "Event Log Record %u (%s)", tvb_get_letohs (tvb, 0), en);
3902 
3903     proto_tree_add_item (eventlog_tree, hf_r3_eventlog_recordnumber, tvb,  0, 2, ENC_LITTLE_ENDIAN);
3904     proto_tree_add_item (eventlog_tree, hf_r3_eventlog_year,         tvb,  2, 1, ENC_LITTLE_ENDIAN);
3905     proto_tree_add_item (eventlog_tree, hf_r3_eventlog_month,        tvb,  3, 1, ENC_LITTLE_ENDIAN);
3906     proto_tree_add_item (eventlog_tree, hf_r3_eventlog_day,          tvb,  4, 1, ENC_LITTLE_ENDIAN);
3907     proto_tree_add_item (eventlog_tree, hf_r3_eventlog_hour,         tvb,  5, 1, ENC_LITTLE_ENDIAN);
3908     proto_tree_add_item (eventlog_tree, hf_r3_eventlog_minute,       tvb,  6, 1, ENC_LITTLE_ENDIAN);
3909     proto_tree_add_item (eventlog_tree, hf_r3_eventlog_second,       tvb,  7, 1, ENC_LITTLE_ENDIAN);
3910     proto_tree_add_item (eventlog_tree, hf_r3_eventlog_usernumber,   tvb,  8, 2, ENC_LITTLE_ENDIAN);
3911     proto_tree_add_item (eventlog_tree, hf_r3_eventlog_event,        tvb, 10, 1, ENC_LITTLE_ENDIAN);
3912   }
3913 }
3914 
3915 static void
dissect_r3_upstreamcommand_dumpnvram(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)3916 dissect_r3_upstreamcommand_dumpnvram (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
3917 {
3918   DISSECTOR_ASSERT(start_offset == 0);
3919 
3920   tvb_ensure_bytes_exist (tvb, 0, 3);
3921 
3922   if (!tree)
3923     return;
3924 
3925   proto_tree_add_item (tree, hf_r3_nvramdump_record, tvb, 0, 2, ENC_LITTLE_ENDIAN);
3926   proto_tree_add_item (tree, hf_r3_nvramdump_length, tvb, 2, 1, ENC_LITTLE_ENDIAN);
3927   proto_tree_add_item (tree, hf_r3_nvramdump_data,   tvb, 3, tvb_get_guint8 (tvb, 2), ENC_NA);
3928 }
3929 
3930 static void
dissect_r3_upstreamcommand_rmtquthrequest(tvbuff_t * tvb,guint32 start_offset,guint32 length,packet_info * pinfo,proto_tree * tree)3931 dissect_r3_upstreamcommand_rmtquthrequest (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree)
3932 {
3933   dissect_r3_upstreamfields (tvb, start_offset, length, pinfo, tree);
3934 }
3935 
3936 static void
dissect_r3_upstreamcommand_retrieveuser(tvbuff_t * tvb,guint32 start_offset,guint32 length,packet_info * pinfo,proto_tree * tree)3937 dissect_r3_upstreamcommand_retrieveuser (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree)
3938 {
3939   dissect_r3_upstreamfields (tvb, start_offset, length, pinfo, tree);
3940 }
3941 
3942 static void
dissect_r3_upstreamcommand_queryconfig(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo,proto_tree * tree)3943 dissect_r3_upstreamcommand_queryconfig (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo, proto_tree *tree)
3944 {
3945   guint32 offset = 0;
3946 
3947   DISSECTOR_ASSERT(start_offset == 0);
3948 
3949   if (!tree)
3950     return;
3951 
3952   while (offset < tvb_reported_length (tvb))
3953   {
3954     proto_item  *pi;
3955     proto_tree  *upstreamfield_tree;
3956     const gchar *ci;
3957     guint8 item_length;
3958 
3959     ci = val_to_str_ext_const (tvb_get_guint8 (tvb, offset + 1), &r3_configitemnames_ext, "[Unknown Configuration Item]");
3960 
3961     item_length = tvb_get_guint8 (tvb, offset + 0);
3962     upstreamfield_tree = proto_tree_add_subtree_format(tree, tvb, offset + 0, item_length, ett_r3upstreamfield, NULL,
3963                         "Config Field: %s (%u)", ci, tvb_get_guint8 (tvb, offset + 1));
3964 
3965     pi = proto_tree_add_item (upstreamfield_tree, hf_r3_configitemlength, tvb, offset + 0, 1, ENC_LITTLE_ENDIAN);
3966     if (item_length == 0) {
3967       expert_add_info_format(pinfo, pi, &ei_r3_malformed_length, "Invalid item length");
3968       return;
3969     }
3970 
3971     proto_tree_add_item (upstreamfield_tree, hf_r3_configitem,       tvb, offset + 1, 1, ENC_LITTLE_ENDIAN);
3972     proto_tree_add_item (upstreamfield_tree, hf_r3_configitemtype,   tvb, offset + 2, 1, ENC_LITTLE_ENDIAN);
3973 
3974     switch (tvb_get_guint8 (tvb, offset + 2))
3975     {
3976       case CONFIGTYPE_NONE :
3977         proto_tree_add_item (upstreamfield_tree, hf_r3_configitemdata, tvb, offset + 3, item_length - 3, ENC_NA);
3978         break;
3979 
3980       case CONFIGTYPE_BOOL :
3981         proto_tree_add_item (upstreamfield_tree, hf_r3_configitemdata_bool, tvb, offset + 3, 1, ENC_LITTLE_ENDIAN);
3982         break;
3983 
3984       case CONFIGTYPE_8 :
3985         proto_tree_add_item (upstreamfield_tree, hf_r3_configitemdata_8, tvb, offset + 3, 1, ENC_LITTLE_ENDIAN);
3986         break;
3987 
3988       case CONFIGTYPE_16 :
3989         proto_tree_add_item (upstreamfield_tree, hf_r3_configitemdata_16, tvb, offset + 3, 2, ENC_LITTLE_ENDIAN);
3990         break;
3991 
3992       case CONFIGTYPE_32 :
3993         proto_tree_add_item (upstreamfield_tree, hf_r3_configitemdata_32, tvb, offset + 3, 4, ENC_LITTLE_ENDIAN);
3994         break;
3995 
3996       case CONFIGTYPE_STRING :
3997         proto_tree_add_item (upstreamfield_tree, hf_r3_configitemdata_string, tvb, offset + 3, item_length - 3, ENC_ASCII|ENC_NA);
3998         break;
3999 
4000       default :
4001         proto_tree_add_none_format (upstreamfield_tree, hf_r3_upstreamfielderror, tvb, offset + 3, item_length - 3, "Unknown Field Type");
4002         break;
4003     }
4004 
4005     offset += item_length;
4006   }
4007 }
4008 
4009 static void
dissect_r3_upstreamcommand_rmteventlogrecord(tvbuff_t * tvb,guint32 start_offset,guint32 length,packet_info * pinfo,proto_tree * tree)4010 dissect_r3_upstreamcommand_rmteventlogrecord (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree)
4011 {
4012   dissect_r3_upstreamfields (tvb, start_offset, length, pinfo, tree);
4013 }
4014 
4015 static void
dissect_r3_upstreamcommand_dpac(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)4016 dissect_r3_upstreamcommand_dpac (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
4017 {
4018   if (tree)
4019   {
4020     DISSECTOR_ASSERT(start_offset == 0);
4021     /* XXX: hf[] entries for the following hf indexes originally missing */
4022     proto_tree_add_item (tree, hf_r3_dpacreply_stuff,  tvb, 2,  1, ENC_LITTLE_ENDIAN);
4023     proto_tree_add_item (tree, hf_r3_dpacreply_length, tvb, 3,  1, ENC_LITTLE_ENDIAN);
4024     proto_tree_add_item (tree, hf_r3_dpacreply_reply,  tvb, 4, -1, ENC_NA);
4025   }
4026 }
4027 
4028 static void
dissect_r3_upstreamcommand_notify(tvbuff_t * tvb,guint32 start_offset,guint32 length,packet_info * pinfo,proto_tree * tree)4029 dissect_r3_upstreamcommand_notify (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree)
4030 {
4031   dissect_r3_upstreamfields (tvb, start_offset, length, pinfo, tree);
4032 }
4033 
4034 static void
dissect_r3_upstreamcommand_mfg(tvbuff_t * tvb,guint32 start_offset,guint32 length,packet_info * pinfo,proto_tree * tree)4035 dissect_r3_upstreamcommand_mfg (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree)
4036 {
4037   proto_tree *mfg_tree = NULL;
4038   guint8      mfg_fld;
4039   tvbuff_t   *mfg_tvb;
4040   proto_item  *mfg_item;
4041   const gchar *cn;
4042 
4043   DISSECTOR_ASSERT(start_offset == 0);
4044 
4045   mfg_tvb = tvb_new_subset_remaining (tvb, 2);
4046   mfg_fld = tvb_get_guint8 (tvb, 1);
4047 
4048   cn = val_to_str_ext_const (mfg_fld, &r3_mfgfieldnames_ext, "[Unknown Mfg Field]");
4049 
4050   proto_tree_add_item (tree, hf_r3_mfgfield_length, tvb, 0, 1, ENC_LITTLE_ENDIAN);
4051 
4052   mfg_tree = proto_tree_add_subtree_format(tree, tvb, 1, -1, ett_r3commandmfg, &mfg_item,
4053                     "Upstream Manufacturing Field: %s (%u)", cn, mfg_fld);
4054 
4055   proto_tree_add_item (mfg_tree, hf_r3_mfgfield, tvb, 1, 1, ENC_LITTLE_ENDIAN);
4056 
4057   if (mfg_fld >= MFGFIELD_LAST)
4058   {
4059     expert_add_info(pinfo, mfg_item, &ei_r3_mfgfield);
4060   }
4061   else if (r3upstreammfgfield_dissect [mfg_fld])
4062     (*r3upstreammfgfield_dissect [mfg_fld]) (mfg_tvb, 0, length, pinfo, mfg_tree);
4063 }
4064 
4065 static void
dissect_r3_upstreamcommand_eventlogwarning(tvbuff_t * tvb,guint32 start_offset,guint32 length,packet_info * pinfo,proto_tree * tree)4066 dissect_r3_upstreamcommand_eventlogwarning (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree)
4067 {
4068   dissect_r3_upstreamfields (tvb, start_offset, length, pinfo, tree);
4069 }
4070 
4071 static void
dissect_r3_upstreamcommand_dumpnvramrle(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)4072 dissect_r3_upstreamcommand_dumpnvramrle (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
4073 {
4074   if (!tree)
4075     return;
4076 
4077   DISSECTOR_ASSERT(start_offset == 0);
4078 
4079   proto_tree_add_item (tree, hf_r3_nvramdumprle_record, tvb, 0, 2, ENC_LITTLE_ENDIAN);
4080   proto_tree_add_item (tree, hf_r3_nvramdumprle_length, tvb, 3, 1, ENC_LITTLE_ENDIAN);
4081   proto_tree_add_item (tree, hf_r3_nvramdumprle_data,   tvb, 4, tvb_get_guint8 (tvb, 3), ENC_NA);
4082 }
4083 
4084 static void
dissect_r3_upstreamcommand_rmtdeclinedrecord(tvbuff_t * tvb,guint32 start_offset,guint32 length,packet_info * pinfo,proto_tree * tree)4085 dissect_r3_upstreamcommand_rmtdeclinedrecord (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree)
4086 {
4087   dissect_r3_upstreamfields (tvb, start_offset, length, pinfo, tree);
4088 }
4089 
4090 static void
dissect_r3_upstreamcommand_declinedwarning(tvbuff_t * tvb,guint32 start_offset,guint32 length,packet_info * pinfo,proto_tree * tree)4091 dissect_r3_upstreamcommand_declinedwarning (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree)
4092 {
4093   dissect_r3_upstreamfields (tvb, start_offset, length, pinfo, tree);
4094 }
4095 
4096 static void
dissect_r3_upstreamcommand_dumpdeclinedlog(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)4097 dissect_r3_upstreamcommand_dumpdeclinedlog (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
4098 {
4099   proto_tree *declinedlog_tree;
4100   guint8      cred1type;
4101   guint8      cred2type;
4102 
4103   if (!tree)
4104     return;
4105 
4106   DISSECTOR_ASSERT(start_offset == 0);
4107 
4108   declinedlog_tree = proto_tree_add_subtree_format(tree, tvb, start_offset, 49,
4109       ett_r3declinedlogrecord, NULL, "Declined Log Record %u", tvb_get_letohs (tvb, 0));
4110 
4111   proto_tree_add_item (declinedlog_tree, hf_r3_declinedlog_recordnumber, tvb, 0, 2, ENC_LITTLE_ENDIAN);
4112   proto_tree_add_item (declinedlog_tree, hf_r3_declinedlog_year,         tvb, 2, 1, ENC_LITTLE_ENDIAN);
4113   proto_tree_add_item (declinedlog_tree, hf_r3_declinedlog_month,        tvb, 3, 1, ENC_LITTLE_ENDIAN);
4114   proto_tree_add_item (declinedlog_tree, hf_r3_declinedlog_day,          tvb, 4, 1, ENC_LITTLE_ENDIAN);
4115   proto_tree_add_item (declinedlog_tree, hf_r3_declinedlog_hour,         tvb, 5, 1, ENC_LITTLE_ENDIAN);
4116   proto_tree_add_item (declinedlog_tree, hf_r3_declinedlog_minute,       tvb, 6, 1, ENC_LITTLE_ENDIAN);
4117   proto_tree_add_item (declinedlog_tree, hf_r3_declinedlog_second,       tvb, 7, 1, ENC_LITTLE_ENDIAN);
4118   proto_tree_add_item (declinedlog_tree, hf_r3_declinedlog_usernumber,   tvb, 8, 2, ENC_LITTLE_ENDIAN);
4119 
4120   cred1type = tvb_get_guint8 (tvb, 10) & 0x07;
4121   cred2type = (tvb_get_guint8 (tvb, 10) & 0x38) >> 3;
4122 
4123   proto_tree_add_uint (declinedlog_tree, hf_r3_declinedlog_cred1type, tvb, 10, 1, cred1type);
4124   proto_tree_add_uint (declinedlog_tree, hf_r3_declinedlog_cred2type, tvb, 10, 1, cred2type);
4125   proto_tree_add_item (declinedlog_tree, hf_r3_declinedlog_cred1, tvb, 11, 19, ENC_NA);
4126   proto_tree_add_item (declinedlog_tree, hf_r3_declinedlog_cred2, tvb, 30, 19, ENC_NA);
4127 }
4128 
4129 static void
dissect_r3_upstreamcommand_rmtalarmrecord(tvbuff_t * tvb,guint32 start_offset,guint32 length,packet_info * pinfo,proto_tree * tree)4130 dissect_r3_upstreamcommand_rmtalarmrecord (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree)
4131 {
4132   dissect_r3_upstreamfields (tvb, start_offset, length, pinfo, tree);
4133 }
4134 
4135 static void
dissect_r3_upstreamcommand_alarmwarning(tvbuff_t * tvb,guint32 start_offset,guint32 length,packet_info * pinfo,proto_tree * tree)4136 dissect_r3_upstreamcommand_alarmwarning (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree)
4137 {
4138   dissect_r3_upstreamfields (tvb, start_offset, length, pinfo, tree);
4139 }
4140 
4141 static void
dissect_r3_upstreamcommand_dumpalarmlog(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)4142 dissect_r3_upstreamcommand_dumpalarmlog (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
4143 {
4144   proto_tree *alarmlog_tree;
4145 
4146   if (!tree)
4147     return;
4148 
4149   DISSECTOR_ASSERT(start_offset == 0);
4150 
4151   alarmlog_tree = proto_tree_add_subtree_format(tree, tvb, start_offset, 9,
4152         ett_r3alarmlogrecord, NULL, "Alarm Log Record %u", tvb_get_letohs (tvb, 0));
4153 
4154   proto_tree_add_item (alarmlog_tree, hf_r3_alarmlog_recordnumber, tvb, 0, 2, ENC_LITTLE_ENDIAN);
4155   proto_tree_add_item (alarmlog_tree, hf_r3_alarmlog_year,         tvb, 2, 1, ENC_LITTLE_ENDIAN);
4156   proto_tree_add_item (alarmlog_tree, hf_r3_alarmlog_month,        tvb, 3, 1, ENC_LITTLE_ENDIAN);
4157   proto_tree_add_item (alarmlog_tree, hf_r3_alarmlog_day,          tvb, 4, 1, ENC_LITTLE_ENDIAN);
4158   proto_tree_add_item (alarmlog_tree, hf_r3_alarmlog_hour,         tvb, 5, 1, ENC_LITTLE_ENDIAN);
4159   proto_tree_add_item (alarmlog_tree, hf_r3_alarmlog_minute,       tvb, 6, 1, ENC_LITTLE_ENDIAN);
4160   proto_tree_add_item (alarmlog_tree, hf_r3_alarmlog_second,       tvb, 7, 1, ENC_LITTLE_ENDIAN);
4161   proto_tree_add_item (alarmlog_tree, hf_r3_alarmlog_id,           tvb, 8, 1, ENC_LITTLE_ENDIAN);
4162   proto_tree_add_item (alarmlog_tree, hf_r3_alarmlog_usernumber,   tvb, 9, 2, ENC_LITTLE_ENDIAN);
4163 }
4164 
4165 static void
dissect_r3_upstreamcommand_connectscheduler(tvbuff_t * tvb,guint32 start_offset,guint32 length,packet_info * pinfo,proto_tree * tree)4166 dissect_r3_upstreamcommand_connectscheduler (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree)
4167 {
4168   dissect_r3_upstreamfields (tvb, start_offset, length, pinfo, tree);
4169 }
4170 
4171 static void
dissect_r3_upstreamcommand_connectcommuser(tvbuff_t * tvb,guint32 start_offset,guint32 length,packet_info * pinfo,proto_tree * tree)4172 dissect_r3_upstreamcommand_connectcommuser (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree)
4173 {
4174   dissect_r3_upstreamfields (tvb, start_offset, length, pinfo, tree);
4175 }
4176 
4177 static void
dissect_r3_upstreamcommand_commandalarm(tvbuff_t * tvb,guint32 start_offset,guint32 length,packet_info * pinfo,proto_tree * tree)4178 dissect_r3_upstreamcommand_commandalarm (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree)
4179 {
4180   dissect_r3_upstreamfields (tvb, start_offset, length, pinfo, tree);
4181 }
4182 
4183 static void
dissect_r3_upstreamcommand_dumpdebuglog(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)4184 dissect_r3_upstreamcommand_dumpdebuglog (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
4185 {
4186   proto_tree *debuglog_tree;
4187 
4188   if (!tree)
4189     return;
4190 
4191   DISSECTOR_ASSERT(start_offset == 0);
4192 
4193   debuglog_tree = proto_tree_add_subtree_format(tree, tvb, start_offset, 8,
4194             ett_r3debuglogrecord, NULL, "Debug Log Record %u", tvb_get_letohs (tvb, 0));
4195 
4196   proto_tree_add_item (debuglog_tree, hf_r3_debuglog_recordnumber, tvb, 0, 2, ENC_LITTLE_ENDIAN);
4197   proto_tree_add_item (debuglog_tree, hf_r3_debuglog_flags,        tvb, 2, 4, ENC_LITTLE_ENDIAN);
4198   proto_tree_add_item (debuglog_tree, hf_r3_debuglog_tick,         tvb, 6, 2, ENC_LITTLE_ENDIAN);
4199 }
4200 
4201 /*
4202  * ***************************************************************************
4203  */
4204 static void
dissect_r3_upstreammfgfield_iopins(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo,proto_tree * tree)4205 dissect_r3_upstreammfgfield_iopins (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo, proto_tree *tree)
4206 {
4207   gint len;
4208 
4209   DISSECTOR_ASSERT(start_offset == 0);
4210 
4211   len = MAX(0, tvb_reported_length_remaining(tvb, start_offset));
4212   if (len % 3 != 0)
4213   {
4214     expert_add_info_format(pinfo, proto_tree_get_parent (tree), &ei_r3_malformed_length, "IOPINS data length not modulo 3 == 0");
4215   }
4216   else
4217   {
4218     char portname = 'A';
4219     gint i;
4220 
4221     if (!tree)
4222       return;
4223 
4224     for (i = 0; i < len; i += 3, portname++)
4225     {
4226       proto_tree *port_tree = proto_tree_add_subtree_format(tree, tvb, i, 3, ett_r3iopins, NULL,
4227                                                    "Port %c Configuration", (portname == 'I') ? ++portname : portname);
4228 
4229       proto_tree_add_item (port_tree, hf_r3_iopins_lat,  tvb, i + 0, 1, ENC_LITTLE_ENDIAN);
4230       proto_tree_add_item (port_tree, hf_r3_iopins_port, tvb, i + 1, 1, ENC_LITTLE_ENDIAN);
4231       proto_tree_add_item (port_tree, hf_r3_iopins_tris, tvb, i + 2, 1, ENC_LITTLE_ENDIAN);
4232     }
4233   }
4234 }
4235 
4236 static void
dissect_r3_upstreammfgfield_adcs(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo,proto_tree * tree)4237 dissect_r3_upstreammfgfield_adcs (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo, proto_tree *tree)
4238 {
4239   guint   len;
4240   guint32 i;
4241 
4242   if (!tree)
4243     return;
4244 
4245   DISSECTOR_ASSERT(start_offset == 0);
4246 
4247   len = tvb_reported_length(tvb);
4248 
4249   for (i = 0; i < MIN(len,8); i++)
4250   {
4251     proto_item *item = proto_tree_add_item (tree, hf_r3_adc [i], tvb, i, 1, ENC_LITTLE_ENDIAN);
4252     proto_item_append_text (item, " (%.2f Volts)", (float) tvb_get_guint8 (tvb, i) * 0.04154);
4253   }
4254 
4255   if (len > 8)
4256   {
4257     expert_add_info(pinfo, proto_tree_get_parent (tree), &ei_r3_mfgfield_too_many_adc_values);
4258   }
4259 
4260 }
4261 
4262 static void
dissect_r3_upstreammfgfield_hardwareid(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)4263 dissect_r3_upstreammfgfield_hardwareid (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
4264 {
4265   if (!tree)
4266     return;
4267 
4268   DISSECTOR_ASSERT(start_offset == 0);
4269 
4270   proto_tree_add_item (tree, hf_r3_hardwareid_board,  tvb, 0, 1, ENC_LITTLE_ENDIAN);
4271   proto_tree_add_item (tree, hf_r3_hardwareid_cpuid,  tvb, 1, 2, ENC_LITTLE_ENDIAN);
4272   proto_tree_add_item (tree, hf_r3_hardwareid_cpurev, tvb, 3, 1, ENC_LITTLE_ENDIAN);
4273 }
4274 
4275 static void
dissect_r3_upstreammfgfield_checkpointlog(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)4276 dissect_r3_upstreammfgfield_checkpointlog (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
4277 {
4278   proto_tree *cpl_tree;
4279   guint       counter;
4280   gint        len;
4281   gint        i;
4282 
4283   if (!tree)
4284     return;
4285 
4286   DISSECTOR_ASSERT(start_offset == 0);
4287 
4288   len = tvb_reported_length_remaining (tvb, 1);
4289 
4290   proto_tree_add_item (tree, hf_r3_checkpointlog_entryptr, tvb, 0, 1, ENC_LITTLE_ENDIAN);
4291   cpl_tree = proto_tree_add_subtree(tree, tvb, 1, -1, ett_r3checkpointlog, NULL, "Checkpoint Log");
4292 
4293   counter = 0;
4294   for (i = 0; i < len; i += 2, counter++)
4295   {
4296     guint        rcon      = tvb_get_guint8 (tvb, i + 0);
4297     guint        cp        = tvb_get_guint8 (tvb, i + 1);
4298     proto_item  *cpe_item;
4299     proto_tree  *cpe_tree;
4300     guint        resettype;
4301     const gchar *desc;
4302     static const gchar *resets [] = { "Stack underflow", "Stack overflow", "Power-On",
4303                                       "Software", "Brown-out", "MCLR in sleep", "WDT",
4304                                       "Normal", "[Unknown Reset Type]" };
4305 
4306 
4307     cpe_tree = proto_tree_add_subtree_format(cpl_tree, tvb, i + 0, 2, ett_r3checkpointlogentry, &cpe_item,
4308                             "Checkpoint Log Entry %u", counter);
4309     desc = val_to_str_ext_const (cp, &r3_checkpointnames_ext, "[Unknown Checkpoint]");
4310 
4311     if (rcon == 0xff)
4312       resettype = 8;
4313     else
4314     {
4315       rcon &= 0x1f;
4316 
4317       if (rcon == 0x1c)
4318         resettype = 2;
4319       else if ((rcon & 0x10) == 0x00)
4320         resettype = 3;
4321       else if ((rcon & 0x1d) == 0x1c)
4322         resettype = 4;
4323       else if ((rcon & 0x0c) == 0x08)
4324         resettype = 5;
4325       else if ((rcon & 0x0c) == 0x04)
4326         resettype = 6;
4327       else
4328         resettype = 7;
4329     }
4330 
4331     proto_item_append_text (cpe_item, " (%s, %s)", resets [resettype], desc);
4332     proto_item_append_text (
4333       proto_tree_add_item (cpe_tree, hf_r3_checkpointlog_rcon,       tvb, i + 0, 1, ENC_LITTLE_ENDIAN),
4334       " (%s)", resets [resettype]);
4335     proto_item_append_text (
4336       proto_tree_add_item (cpe_tree, hf_r3_checkpointlog_checkpoint, tvb, i + 1, 1, ENC_LITTLE_ENDIAN),
4337       " (%s)", desc);
4338   }
4339 }
4340 
4341 static void
dissect_r3_upstreammfgfield_cpuregisters(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)4342 dissect_r3_upstreammfgfield_cpuregisters (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
4343 {
4344   proto_tree *tmp_tree [19];
4345   proto_tree *cr_tree;
4346 
4347   if (!tree)
4348     return;
4349 
4350   DISSECTOR_ASSERT(start_offset == 0);
4351 
4352   cr_tree = proto_tree_add_subtree(tree, tvb, start_offset, -1, ett_r3cpuregisters, NULL, "CPU Registers");
4353 
4354   tmp_tree [ 0] = proto_item_add_subtree (proto_tree_add_item (cr_tree, hf_r3_cpuregisters_intcon,  tvb,  0, 1, ENC_LITTLE_ENDIAN), ett_r3cpuregister);
4355   tmp_tree [ 1] = proto_item_add_subtree (proto_tree_add_item (cr_tree, hf_r3_cpuregisters_intcon2, tvb,  1, 1, ENC_LITTLE_ENDIAN), ett_r3cpuregister);
4356   tmp_tree [ 2] = proto_item_add_subtree (proto_tree_add_item (cr_tree, hf_r3_cpuregisters_intcon3, tvb,  2, 1, ENC_LITTLE_ENDIAN), ett_r3cpuregister);
4357   tmp_tree [ 3] = proto_item_add_subtree (proto_tree_add_item (cr_tree, hf_r3_cpuregisters_pir1,    tvb,  3, 1, ENC_LITTLE_ENDIAN), ett_r3cpuregister);
4358   tmp_tree [ 4] = proto_item_add_subtree (proto_tree_add_item (cr_tree, hf_r3_cpuregisters_pir2,    tvb,  4, 1, ENC_LITTLE_ENDIAN), ett_r3cpuregister);
4359   tmp_tree [ 5] = proto_item_add_subtree (proto_tree_add_item (cr_tree, hf_r3_cpuregisters_pir3,    tvb,  5, 1, ENC_LITTLE_ENDIAN), ett_r3cpuregister);
4360   tmp_tree [ 6] = proto_item_add_subtree (proto_tree_add_item (cr_tree, hf_r3_cpuregisters_pie1,    tvb,  6, 1, ENC_LITTLE_ENDIAN), ett_r3cpuregister);
4361   tmp_tree [ 7] = proto_item_add_subtree (proto_tree_add_item (cr_tree, hf_r3_cpuregisters_pie2,    tvb,  7, 1, ENC_LITTLE_ENDIAN), ett_r3cpuregister);
4362   tmp_tree [ 8] = proto_item_add_subtree (proto_tree_add_item (cr_tree, hf_r3_cpuregisters_pie3,    tvb,  8, 1, ENC_LITTLE_ENDIAN), ett_r3cpuregister);
4363   tmp_tree [ 9] = proto_item_add_subtree (proto_tree_add_item (cr_tree, hf_r3_cpuregisters_ipr1,    tvb,  9, 1, ENC_LITTLE_ENDIAN), ett_r3cpuregister);
4364   tmp_tree [10] = proto_item_add_subtree (proto_tree_add_item (cr_tree, hf_r3_cpuregisters_ipr2,    tvb, 10, 1, ENC_LITTLE_ENDIAN), ett_r3cpuregister);
4365   tmp_tree [11] = proto_item_add_subtree (proto_tree_add_item (cr_tree, hf_r3_cpuregisters_ipr3,    tvb, 11, 1, ENC_LITTLE_ENDIAN), ett_r3cpuregister);
4366   tmp_tree [12] = proto_item_add_subtree (proto_tree_add_item (cr_tree, hf_r3_cpuregisters_rcon,    tvb, 12, 1, ENC_LITTLE_ENDIAN), ett_r3cpuregister);
4367   tmp_tree [13] = proto_item_add_subtree (proto_tree_add_item (cr_tree, hf_r3_cpuregisters_osccon,  tvb, 13, 1, ENC_LITTLE_ENDIAN), ett_r3cpuregister);
4368   tmp_tree [14] = proto_item_add_subtree (proto_tree_add_item (cr_tree, hf_r3_cpuregisters_rcsta,   tvb, 14, 1, ENC_LITTLE_ENDIAN), ett_r3cpuregister);
4369   tmp_tree [15] = proto_item_add_subtree (proto_tree_add_item (cr_tree, hf_r3_cpuregisters_txsta,   tvb, 15, 1, ENC_LITTLE_ENDIAN), ett_r3cpuregister);
4370   tmp_tree [16] = proto_item_add_subtree (proto_tree_add_item (cr_tree, hf_r3_cpuregisters_rcsta2,  tvb, 16, 1, ENC_LITTLE_ENDIAN), ett_r3cpuregister);
4371   tmp_tree [17] = proto_item_add_subtree (proto_tree_add_item (cr_tree, hf_r3_cpuregisters_txsta2,  tvb, 17, 1, ENC_LITTLE_ENDIAN), ett_r3cpuregister);
4372   tmp_tree [18] = proto_item_add_subtree (proto_tree_add_item (cr_tree, hf_r3_cpuregisters_wdtcon,  tvb, 18, 1, ENC_LITTLE_ENDIAN), ett_r3cpuregister);
4373 
4374   proto_tree_add_item (tmp_tree [ 0], hf_r3_cpuregisters_intcon_rbif,     tvb,  0, 1, ENC_LITTLE_ENDIAN);
4375   proto_tree_add_item (tmp_tree [ 0], hf_r3_cpuregisters_intcon_int0if,   tvb,  0, 1, ENC_LITTLE_ENDIAN);
4376   proto_tree_add_item (tmp_tree [ 0], hf_r3_cpuregisters_intcon_tmr0if,   tvb,  0, 1, ENC_LITTLE_ENDIAN);
4377   proto_tree_add_item (tmp_tree [ 0], hf_r3_cpuregisters_intcon_rbie,     tvb,  0, 1, ENC_LITTLE_ENDIAN);
4378   proto_tree_add_item (tmp_tree [ 0], hf_r3_cpuregisters_intcon_int0ie,   tvb,  0, 1, ENC_LITTLE_ENDIAN);
4379   proto_tree_add_item (tmp_tree [ 0], hf_r3_cpuregisters_intcon_tmr0ie,   tvb,  0, 1, ENC_LITTLE_ENDIAN);
4380   proto_tree_add_item (tmp_tree [ 0], hf_r3_cpuregisters_intcon_giel,     tvb,  0, 1, ENC_LITTLE_ENDIAN);
4381   proto_tree_add_item (tmp_tree [ 0], hf_r3_cpuregisters_intcon_gieh,     tvb,  0, 1, ENC_LITTLE_ENDIAN);
4382   proto_tree_add_item (tmp_tree [ 1], hf_r3_cpuregisters_intcon2_rbip,    tvb,  1, 1, ENC_LITTLE_ENDIAN);
4383   proto_tree_add_item (tmp_tree [ 1], hf_r3_cpuregisters_intcon2_int3ip,  tvb,  1, 1, ENC_LITTLE_ENDIAN);
4384   proto_tree_add_item (tmp_tree [ 1], hf_r3_cpuregisters_intcon2_tmr0ip,  tvb,  1, 1, ENC_LITTLE_ENDIAN);
4385   proto_tree_add_item (tmp_tree [ 1], hf_r3_cpuregisters_intcon2_intedg3, tvb,  1, 1, ENC_LITTLE_ENDIAN);
4386   proto_tree_add_item (tmp_tree [ 1], hf_r3_cpuregisters_intcon2_intedg2, tvb,  1, 1, ENC_LITTLE_ENDIAN);
4387   proto_tree_add_item (tmp_tree [ 1], hf_r3_cpuregisters_intcon2_intedg1, tvb,  1, 1, ENC_LITTLE_ENDIAN);
4388   proto_tree_add_item (tmp_tree [ 1], hf_r3_cpuregisters_intcon2_intedg0, tvb,  1, 1, ENC_LITTLE_ENDIAN);
4389   proto_tree_add_item (tmp_tree [ 1], hf_r3_cpuregisters_intcon2_rbpu,    tvb,  1, 1, ENC_LITTLE_ENDIAN);
4390   proto_tree_add_item (tmp_tree [ 2], hf_r3_cpuregisters_intcon3_int1if,  tvb,  2, 1, ENC_LITTLE_ENDIAN);
4391   proto_tree_add_item (tmp_tree [ 2], hf_r3_cpuregisters_intcon3_int2if,  tvb,  2, 1, ENC_LITTLE_ENDIAN);
4392   proto_tree_add_item (tmp_tree [ 2], hf_r3_cpuregisters_intcon3_int3if,  tvb,  2, 1, ENC_LITTLE_ENDIAN);
4393   proto_tree_add_item (tmp_tree [ 2], hf_r3_cpuregisters_intcon3_int1ie,  tvb,  2, 1, ENC_LITTLE_ENDIAN);
4394   proto_tree_add_item (tmp_tree [ 2], hf_r3_cpuregisters_intcon3_int2ie,  tvb,  2, 1, ENC_LITTLE_ENDIAN);
4395   proto_tree_add_item (tmp_tree [ 2], hf_r3_cpuregisters_intcon3_int3ie,  tvb,  2, 1, ENC_LITTLE_ENDIAN);
4396   proto_tree_add_item (tmp_tree [ 2], hf_r3_cpuregisters_intcon3_int1ip,  tvb,  2, 1, ENC_LITTLE_ENDIAN);
4397   proto_tree_add_item (tmp_tree [ 2], hf_r3_cpuregisters_intcon3_int2ip,  tvb,  2, 1, ENC_LITTLE_ENDIAN);
4398   proto_tree_add_item (tmp_tree [ 3], hf_r3_cpuregisters_pir1_tmr1if,     tvb,  3, 1, ENC_LITTLE_ENDIAN);
4399   proto_tree_add_item (tmp_tree [ 3], hf_r3_cpuregisters_pir1_tmr2if,     tvb,  3, 1, ENC_LITTLE_ENDIAN);
4400   proto_tree_add_item (tmp_tree [ 3], hf_r3_cpuregisters_pir1_ccp1if,     tvb,  3, 1, ENC_LITTLE_ENDIAN);
4401   proto_tree_add_item (tmp_tree [ 3], hf_r3_cpuregisters_pir1_ssp1if,     tvb,  3, 1, ENC_LITTLE_ENDIAN);
4402   proto_tree_add_item (tmp_tree [ 3], hf_r3_cpuregisters_pir1_tx1if,      tvb,  3, 1, ENC_LITTLE_ENDIAN);
4403   proto_tree_add_item (tmp_tree [ 3], hf_r3_cpuregisters_pir1_rc1if,      tvb,  3, 1, ENC_LITTLE_ENDIAN);
4404   proto_tree_add_item (tmp_tree [ 3], hf_r3_cpuregisters_pir1_adif,       tvb,  3, 1, ENC_LITTLE_ENDIAN);
4405   proto_tree_add_item (tmp_tree [ 3], hf_r3_cpuregisters_pir1_pspif,      tvb,  3, 1, ENC_LITTLE_ENDIAN);
4406   proto_tree_add_item (tmp_tree [ 4], hf_r3_cpuregisters_pir2_ccp2if,     tvb,  4, 1, ENC_LITTLE_ENDIAN);
4407   proto_tree_add_item (tmp_tree [ 4], hf_r3_cpuregisters_pir2_tmr3if,     tvb,  4, 1, ENC_LITTLE_ENDIAN);
4408   proto_tree_add_item (tmp_tree [ 4], hf_r3_cpuregisters_pir2_hlvdif,     tvb,  4, 1, ENC_LITTLE_ENDIAN);
4409   proto_tree_add_item (tmp_tree [ 4], hf_r3_cpuregisters_pir2_bcl1if,     tvb,  4, 1, ENC_LITTLE_ENDIAN);
4410   proto_tree_add_item (tmp_tree [ 4], hf_r3_cpuregisters_pir2_eeif,       tvb,  4, 1, ENC_LITTLE_ENDIAN);
4411   proto_tree_add_item (tmp_tree [ 4], hf_r3_cpuregisters_pir2_unused5,    tvb,  4, 1, ENC_LITTLE_ENDIAN);
4412   proto_tree_add_item (tmp_tree [ 4], hf_r3_cpuregisters_pir2_cmif,       tvb,  4, 1, ENC_LITTLE_ENDIAN);
4413   proto_tree_add_item (tmp_tree [ 4], hf_r3_cpuregisters_pir2_oscfif,     tvb,  4, 1, ENC_LITTLE_ENDIAN);
4414   proto_tree_add_item (tmp_tree [ 5], hf_r3_cpuregisters_pir3_ccp3if,     tvb,  5, 1, ENC_LITTLE_ENDIAN);
4415   proto_tree_add_item (tmp_tree [ 5], hf_r3_cpuregisters_pir3_ccp4if,     tvb,  5, 1, ENC_LITTLE_ENDIAN);
4416   proto_tree_add_item (tmp_tree [ 5], hf_r3_cpuregisters_pir3_ccp5if,     tvb,  5, 1, ENC_LITTLE_ENDIAN);
4417   proto_tree_add_item (tmp_tree [ 5], hf_r3_cpuregisters_pir3_tmr4if,     tvb,  5, 1, ENC_LITTLE_ENDIAN);
4418   proto_tree_add_item (tmp_tree [ 5], hf_r3_cpuregisters_pir3_tx2if,      tvb,  5, 1, ENC_LITTLE_ENDIAN);
4419   proto_tree_add_item (tmp_tree [ 5], hf_r3_cpuregisters_pir3_rc2if,      tvb,  5, 1, ENC_LITTLE_ENDIAN);
4420   proto_tree_add_item (tmp_tree [ 5], hf_r3_cpuregisters_pir3_bcl2if,     tvb,  5, 1, ENC_LITTLE_ENDIAN);
4421   proto_tree_add_item (tmp_tree [ 5], hf_r3_cpuregisters_pir3_ssp2if,     tvb,  5, 1, ENC_LITTLE_ENDIAN);
4422   proto_tree_add_item (tmp_tree [ 6], hf_r3_cpuregisters_pie1_tmr1ie,     tvb,  6, 1, ENC_LITTLE_ENDIAN);
4423   proto_tree_add_item (tmp_tree [ 6], hf_r3_cpuregisters_pie1_tmr2ie,     tvb,  6, 1, ENC_LITTLE_ENDIAN);
4424   proto_tree_add_item (tmp_tree [ 6], hf_r3_cpuregisters_pie1_ccp1ie,     tvb,  6, 1, ENC_LITTLE_ENDIAN);
4425   proto_tree_add_item (tmp_tree [ 6], hf_r3_cpuregisters_pie1_ssp1ie,     tvb,  6, 1, ENC_LITTLE_ENDIAN);
4426   proto_tree_add_item (tmp_tree [ 6], hf_r3_cpuregisters_pie1_tx1ie,      tvb,  6, 1, ENC_LITTLE_ENDIAN);
4427   proto_tree_add_item (tmp_tree [ 6], hf_r3_cpuregisters_pie1_rc1ie,      tvb,  6, 1, ENC_LITTLE_ENDIAN);
4428   proto_tree_add_item (tmp_tree [ 6], hf_r3_cpuregisters_pie1_adie,       tvb,  6, 1, ENC_LITTLE_ENDIAN);
4429   proto_tree_add_item (tmp_tree [ 6], hf_r3_cpuregisters_pie1_pspie,      tvb,  6, 1, ENC_LITTLE_ENDIAN);
4430   proto_tree_add_item (tmp_tree [ 7], hf_r3_cpuregisters_pie2_oscfie,     tvb,  7, 1, ENC_LITTLE_ENDIAN);
4431   proto_tree_add_item (tmp_tree [ 7], hf_r3_cpuregisters_pie2_cmie,       tvb,  7, 1, ENC_LITTLE_ENDIAN);
4432   proto_tree_add_item (tmp_tree [ 7], hf_r3_cpuregisters_pie2_unused2,    tvb,  7, 1, ENC_LITTLE_ENDIAN);
4433   proto_tree_add_item (tmp_tree [ 7], hf_r3_cpuregisters_pie2_eeie,       tvb,  7, 1, ENC_LITTLE_ENDIAN);
4434   proto_tree_add_item (tmp_tree [ 7], hf_r3_cpuregisters_pie2_bcl1ie,     tvb,  7, 1, ENC_LITTLE_ENDIAN);
4435   proto_tree_add_item (tmp_tree [ 7], hf_r3_cpuregisters_pie2_hlvdie,     tvb,  7, 1, ENC_LITTLE_ENDIAN);
4436   proto_tree_add_item (tmp_tree [ 7], hf_r3_cpuregisters_pie2_tmr3ie,     tvb,  7, 1, ENC_LITTLE_ENDIAN);
4437   proto_tree_add_item (tmp_tree [ 7], hf_r3_cpuregisters_pie2_ccp2ie,     tvb,  7, 1, ENC_LITTLE_ENDIAN);
4438   proto_tree_add_item (tmp_tree [ 8], hf_r3_cpuregisters_pie3_ccp3ie,     tvb,  8, 1, ENC_LITTLE_ENDIAN);
4439   proto_tree_add_item (tmp_tree [ 8], hf_r3_cpuregisters_pie3_ccp4ie,     tvb,  8, 1, ENC_LITTLE_ENDIAN);
4440   proto_tree_add_item (tmp_tree [ 8], hf_r3_cpuregisters_pie3_ccp5ie,     tvb,  8, 1, ENC_LITTLE_ENDIAN);
4441   proto_tree_add_item (tmp_tree [ 8], hf_r3_cpuregisters_pie3_tmr4ie,     tvb,  8, 1, ENC_LITTLE_ENDIAN);
4442   proto_tree_add_item (tmp_tree [ 8], hf_r3_cpuregisters_pie3_tx2ie,      tvb,  8, 1, ENC_LITTLE_ENDIAN);
4443   proto_tree_add_item (tmp_tree [ 8], hf_r3_cpuregisters_pie3_rc2ie,      tvb,  8, 1, ENC_LITTLE_ENDIAN);
4444   proto_tree_add_item (tmp_tree [ 8], hf_r3_cpuregisters_pie3_bcl2ie,     tvb,  8, 1, ENC_LITTLE_ENDIAN);
4445   proto_tree_add_item (tmp_tree [ 8], hf_r3_cpuregisters_pie3_ssp2ie,     tvb,  8, 1, ENC_LITTLE_ENDIAN);
4446   proto_tree_add_item (tmp_tree [ 9], hf_r3_cpuregisters_ipr1_tmr1ip,     tvb,  9, 1, ENC_LITTLE_ENDIAN);
4447   proto_tree_add_item (tmp_tree [ 9], hf_r3_cpuregisters_ipr1_tmr2ip,     tvb,  9, 1, ENC_LITTLE_ENDIAN);
4448   proto_tree_add_item (tmp_tree [ 9], hf_r3_cpuregisters_ipr1_ccp1ip,     tvb,  9, 1, ENC_LITTLE_ENDIAN);
4449   proto_tree_add_item (tmp_tree [ 9], hf_r3_cpuregisters_ipr1_ssp1ip,     tvb,  9, 1, ENC_LITTLE_ENDIAN);
4450   proto_tree_add_item (tmp_tree [ 9], hf_r3_cpuregisters_ipr1_tx1ip,      tvb,  9, 1, ENC_LITTLE_ENDIAN);
4451   proto_tree_add_item (tmp_tree [ 9], hf_r3_cpuregisters_ipr1_rc1ip,      tvb,  9, 1, ENC_LITTLE_ENDIAN);
4452   proto_tree_add_item (tmp_tree [ 9], hf_r3_cpuregisters_ipr1_adip,       tvb,  9, 1, ENC_LITTLE_ENDIAN);
4453   proto_tree_add_item (tmp_tree [ 9], hf_r3_cpuregisters_ipr1_pspip,      tvb,  9, 1, ENC_LITTLE_ENDIAN);
4454   proto_tree_add_item (tmp_tree [10], hf_r3_cpuregisters_ipr2_ccp2ip,     tvb, 10, 1, ENC_LITTLE_ENDIAN);
4455   proto_tree_add_item (tmp_tree [10], hf_r3_cpuregisters_ipr2_tmr3ip,     tvb, 10, 1, ENC_LITTLE_ENDIAN);
4456   proto_tree_add_item (tmp_tree [10], hf_r3_cpuregisters_ipr2_hlvdip,     tvb, 10, 1, ENC_LITTLE_ENDIAN);
4457   proto_tree_add_item (tmp_tree [10], hf_r3_cpuregisters_ipr2_bcl1ip,     tvb, 10, 1, ENC_LITTLE_ENDIAN);
4458   proto_tree_add_item (tmp_tree [10], hf_r3_cpuregisters_ipr2_eeip,       tvb, 10, 1, ENC_LITTLE_ENDIAN);
4459   proto_tree_add_item (tmp_tree [10], hf_r3_cpuregisters_ipr2_unused5,    tvb, 10, 1, ENC_LITTLE_ENDIAN);
4460   proto_tree_add_item (tmp_tree [10], hf_r3_cpuregisters_ipr2_cmip,       tvb, 10, 1, ENC_LITTLE_ENDIAN);
4461   proto_tree_add_item (tmp_tree [10], hf_r3_cpuregisters_ipr2_oscfip,     tvb, 10, 1, ENC_LITTLE_ENDIAN);
4462   proto_tree_add_item (tmp_tree [11], hf_r3_cpuregisters_ipr3_ccp2ip,     tvb, 11, 1, ENC_LITTLE_ENDIAN);
4463   proto_tree_add_item (tmp_tree [11], hf_r3_cpuregisters_ipr3_ccp4ip,     tvb, 11, 1, ENC_LITTLE_ENDIAN);
4464   proto_tree_add_item (tmp_tree [11], hf_r3_cpuregisters_ipr3_ccp5ip,     tvb, 11, 1, ENC_LITTLE_ENDIAN);
4465   proto_tree_add_item (tmp_tree [11], hf_r3_cpuregisters_ipr3_tmr4ip,     tvb, 11, 1, ENC_LITTLE_ENDIAN);
4466   proto_tree_add_item (tmp_tree [11], hf_r3_cpuregisters_ipr3_tx2ip,      tvb, 11, 1, ENC_LITTLE_ENDIAN);
4467   proto_tree_add_item (tmp_tree [11], hf_r3_cpuregisters_ipr3_rc2ip,      tvb, 11, 1, ENC_LITTLE_ENDIAN);
4468   proto_tree_add_item (tmp_tree [11], hf_r3_cpuregisters_ipr3_bcl2ip,     tvb, 11, 1, ENC_LITTLE_ENDIAN);
4469   proto_tree_add_item (tmp_tree [11], hf_r3_cpuregisters_ipr3_ssp2ip,     tvb, 11, 1, ENC_LITTLE_ENDIAN);
4470   proto_tree_add_item (tmp_tree [12], hf_r3_cpuregisters_rcon_bor,        tvb, 12, 1, ENC_LITTLE_ENDIAN);
4471   proto_tree_add_item (tmp_tree [12], hf_r3_cpuregisters_rcon_por,        tvb, 12, 1, ENC_LITTLE_ENDIAN);
4472   proto_tree_add_item (tmp_tree [12], hf_r3_cpuregisters_rcon_pd,         tvb, 12, 1, ENC_LITTLE_ENDIAN);
4473   proto_tree_add_item (tmp_tree [12], hf_r3_cpuregisters_rcon_to,         tvb, 12, 1, ENC_LITTLE_ENDIAN);
4474   proto_tree_add_item (tmp_tree [12], hf_r3_cpuregisters_rcon_unused4,    tvb, 12, 1, ENC_LITTLE_ENDIAN);
4475   proto_tree_add_item (tmp_tree [12], hf_r3_cpuregisters_rcon_ri,         tvb, 12, 1, ENC_LITTLE_ENDIAN);
4476   proto_tree_add_item (tmp_tree [12], hf_r3_cpuregisters_rcon_sboren,     tvb, 12, 1, ENC_LITTLE_ENDIAN);
4477   proto_tree_add_item (tmp_tree [12], hf_r3_cpuregisters_rcon_ipen,       tvb, 12, 1, ENC_LITTLE_ENDIAN);
4478   proto_tree_add_item (tmp_tree [13], hf_r3_cpuregisters_osccon_scs0,     tvb, 13, 1, ENC_LITTLE_ENDIAN);
4479   proto_tree_add_item (tmp_tree [13], hf_r3_cpuregisters_osccon_scs1,     tvb, 13, 1, ENC_LITTLE_ENDIAN);
4480   proto_tree_add_item (tmp_tree [13], hf_r3_cpuregisters_osccon_iofs,     tvb, 13, 1, ENC_LITTLE_ENDIAN);
4481   proto_tree_add_item (tmp_tree [13], hf_r3_cpuregisters_osccon_osts,     tvb, 13, 1, ENC_LITTLE_ENDIAN);
4482   proto_tree_add_item (tmp_tree [13], hf_r3_cpuregisters_osccon_ircf0,    tvb, 13, 1, ENC_LITTLE_ENDIAN);
4483   proto_tree_add_item (tmp_tree [13], hf_r3_cpuregisters_osccon_ircf1,    tvb, 13, 1, ENC_LITTLE_ENDIAN);
4484   proto_tree_add_item (tmp_tree [13], hf_r3_cpuregisters_osccon_ircf2,    tvb, 13, 1, ENC_LITTLE_ENDIAN);
4485   proto_tree_add_item (tmp_tree [13], hf_r3_cpuregisters_osccon_idlen,    tvb, 13, 1, ENC_LITTLE_ENDIAN);
4486   proto_tree_add_item (tmp_tree [14], hf_r3_cpuregisters_rcsta_rx9d,      tvb, 14, 1, ENC_LITTLE_ENDIAN);
4487   proto_tree_add_item (tmp_tree [14], hf_r3_cpuregisters_rcsta_oerr,      tvb, 14, 1, ENC_LITTLE_ENDIAN);
4488   proto_tree_add_item (tmp_tree [14], hf_r3_cpuregisters_rcsta_ferr,      tvb, 14, 1, ENC_LITTLE_ENDIAN);
4489   proto_tree_add_item (tmp_tree [14], hf_r3_cpuregisters_rcsta_adden,     tvb, 14, 1, ENC_LITTLE_ENDIAN);
4490   proto_tree_add_item (tmp_tree [14], hf_r3_cpuregisters_rcsta_cren,      tvb, 14, 1, ENC_LITTLE_ENDIAN);
4491   proto_tree_add_item (tmp_tree [14], hf_r3_cpuregisters_rcsta_sren,      tvb, 14, 1, ENC_LITTLE_ENDIAN);
4492   proto_tree_add_item (tmp_tree [14], hf_r3_cpuregisters_rcsta_rx9,       tvb, 14, 1, ENC_LITTLE_ENDIAN);
4493   proto_tree_add_item (tmp_tree [14], hf_r3_cpuregisters_rcsta_spen,      tvb, 14, 1, ENC_LITTLE_ENDIAN);
4494   proto_tree_add_item (tmp_tree [15], hf_r3_cpuregisters_txsta_tx9d,      tvb, 15, 1, ENC_LITTLE_ENDIAN);
4495   proto_tree_add_item (tmp_tree [15], hf_r3_cpuregisters_txsta_trmt,      tvb, 15, 1, ENC_LITTLE_ENDIAN);
4496   proto_tree_add_item (tmp_tree [15], hf_r3_cpuregisters_txsta_brgh,      tvb, 15, 1, ENC_LITTLE_ENDIAN);
4497   proto_tree_add_item (tmp_tree [15], hf_r3_cpuregisters_txsta_sendb,     tvb, 15, 1, ENC_LITTLE_ENDIAN);
4498   proto_tree_add_item (tmp_tree [15], hf_r3_cpuregisters_txsta_sync,      tvb, 15, 1, ENC_LITTLE_ENDIAN);
4499   proto_tree_add_item (tmp_tree [15], hf_r3_cpuregisters_txsta_txen,      tvb, 15, 1, ENC_LITTLE_ENDIAN);
4500   proto_tree_add_item (tmp_tree [15], hf_r3_cpuregisters_txsta_tx9,       tvb, 15, 1, ENC_LITTLE_ENDIAN);
4501   proto_tree_add_item (tmp_tree [15], hf_r3_cpuregisters_txsta_csrc,      tvb, 15, 1, ENC_LITTLE_ENDIAN);
4502   proto_tree_add_item (tmp_tree [16], hf_r3_cpuregisters_rcsta2_rx9d,     tvb, 16, 1, ENC_LITTLE_ENDIAN);
4503   proto_tree_add_item (tmp_tree [16], hf_r3_cpuregisters_rcsta2_oerr,     tvb, 16, 1, ENC_LITTLE_ENDIAN);
4504   proto_tree_add_item (tmp_tree [16], hf_r3_cpuregisters_rcsta2_ferr,     tvb, 16, 1, ENC_LITTLE_ENDIAN);
4505   proto_tree_add_item (tmp_tree [16], hf_r3_cpuregisters_rcsta2_adden,    tvb, 16, 1, ENC_LITTLE_ENDIAN);
4506   proto_tree_add_item (tmp_tree [16], hf_r3_cpuregisters_rcsta2_cren,     tvb, 16, 1, ENC_LITTLE_ENDIAN);
4507   proto_tree_add_item (tmp_tree [16], hf_r3_cpuregisters_rcsta2_sren,     tvb, 16, 1, ENC_LITTLE_ENDIAN);
4508   proto_tree_add_item (tmp_tree [16], hf_r3_cpuregisters_rcsta2_rx9,      tvb, 16, 1, ENC_LITTLE_ENDIAN);
4509   proto_tree_add_item (tmp_tree [16], hf_r3_cpuregisters_rcsta2_spen,     tvb, 16, 1, ENC_LITTLE_ENDIAN);
4510   proto_tree_add_item (tmp_tree [17], hf_r3_cpuregisters_txsta2_tx9d,     tvb, 17, 1, ENC_LITTLE_ENDIAN);
4511   proto_tree_add_item (tmp_tree [17], hf_r3_cpuregisters_txsta2_trmt,     tvb, 17, 1, ENC_LITTLE_ENDIAN);
4512   proto_tree_add_item (tmp_tree [17], hf_r3_cpuregisters_txsta2_brgh,     tvb, 17, 1, ENC_LITTLE_ENDIAN);
4513   proto_tree_add_item (tmp_tree [17], hf_r3_cpuregisters_txsta2_sendb,    tvb, 17, 1, ENC_LITTLE_ENDIAN);
4514   proto_tree_add_item (tmp_tree [17], hf_r3_cpuregisters_txsta2_sync,     tvb, 17, 1, ENC_LITTLE_ENDIAN);
4515   proto_tree_add_item (tmp_tree [17], hf_r3_cpuregisters_txsta2_txen,     tvb, 17, 1, ENC_LITTLE_ENDIAN);
4516   proto_tree_add_item (tmp_tree [17], hf_r3_cpuregisters_txsta2_tx9,      tvb, 17, 1, ENC_LITTLE_ENDIAN);
4517   proto_tree_add_item (tmp_tree [17], hf_r3_cpuregisters_txsta2_csrc,     tvb, 17, 1, ENC_LITTLE_ENDIAN);
4518   proto_tree_add_item (tmp_tree [18], hf_r3_cpuregisters_wdtcon_swdten,   tvb, 18, 1, ENC_LITTLE_ENDIAN);
4519   proto_tree_add_item (tmp_tree [18], hf_r3_cpuregisters_wdtcon_unused1,  tvb, 18, 1, ENC_LITTLE_ENDIAN);
4520   proto_tree_add_item (tmp_tree [18], hf_r3_cpuregisters_wdtcon_unused2,  tvb, 18, 1, ENC_LITTLE_ENDIAN);
4521   proto_tree_add_item (tmp_tree [18], hf_r3_cpuregisters_wdtcon_unused3,  tvb, 18, 1, ENC_LITTLE_ENDIAN);
4522   proto_tree_add_item (tmp_tree [18], hf_r3_cpuregisters_wdtcon_unused4,  tvb, 18, 1, ENC_LITTLE_ENDIAN);
4523   proto_tree_add_item (tmp_tree [18], hf_r3_cpuregisters_wdtcon_unused5,  tvb, 18, 1, ENC_LITTLE_ENDIAN);
4524   proto_tree_add_item (tmp_tree [18], hf_r3_cpuregisters_wdtcon_unused6,  tvb, 18, 1, ENC_LITTLE_ENDIAN);
4525   proto_tree_add_item (tmp_tree [18], hf_r3_cpuregisters_wdtcon_unused7,  tvb, 18, 1, ENC_LITTLE_ENDIAN);
4526 }
4527 
4528 static void
dissect_r3_upstreammfgfield_taskflags(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)4529 dissect_r3_upstreammfgfield_taskflags (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
4530 {
4531   gint len;
4532   gint i;
4533   proto_tree *tfg_tree;
4534 
4535   DISSECTOR_ASSERT(start_offset == 0);
4536 
4537   len      = MAX(0, tvb_reported_length_remaining (tvb, 0));
4538   tfg_tree = proto_tree_add_subtree_format(tree, tvb, 0, -1, ett_r3taskflags, NULL,
4539       "Task Flags (%u tasks)", len / 5);
4540 
4541   for (i = 0; i < len; i += 5)
4542   {
4543     proto_tree *tf_tree = proto_tree_add_subtree_format(tfg_tree, tvb, i, 5,
4544                                                ett_r3taskflagsentry, NULL,
4545                                                "Task Flags (%2d: 0x%06x)",
4546                                                tvb_get_guint8 (tvb, i + 0),
4547                                                tvb_get_letohl (tvb, i + 1));
4548 
4549     proto_tree_add_item (tf_tree, hf_r3_taskflags_taskid, tvb, i + 0, 1, ENC_LITTLE_ENDIAN);
4550     proto_tree_add_item (tf_tree, hf_r3_taskflags_flags,  tvb, i + 1, 4, ENC_LITTLE_ENDIAN);
4551   }
4552 }
4553 
4554 static void
dissect_r3_upstreammfgfield_timerchain(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)4555 dissect_r3_upstreammfgfield_timerchain (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
4556 {
4557   gint len;
4558   gint i;
4559 
4560   if (!tree)
4561     return;
4562 
4563   DISSECTOR_ASSERT(start_offset == 0);
4564 
4565   len = tvb_reported_length_remaining (tvb, 3);
4566 
4567   proto_tree_add_item (tree, hf_r3_timerchain_newtick,         tvb, 0, 2, ENC_LITTLE_ENDIAN);
4568   proto_tree_add_item (tree, hf_r3_timerchain_currentboundary, tvb, 2, 1, ENC_LITTLE_ENDIAN);
4569 
4570   for (i = 0; i < len; i += 12)
4571   {
4572     proto_tree *tc_tree = proto_tree_add_subtree(tree, tvb, 3 + i, 12, ett_r3timerchain, NULL, "Timer Chain Entry");
4573 
4574     proto_tree_add_item (tc_tree, hf_r3_timerchain_tasktag,  tvb, 3 + i + 0, 1, ENC_LITTLE_ENDIAN);
4575     proto_tree_add_item (tc_tree, hf_r3_timerchain_address,  tvb, 3 + i + 1, 2, ENC_LITTLE_ENDIAN);
4576     proto_tree_add_item (tc_tree, hf_r3_timerchain_reload,   tvb, 3 + i + 3, 2, ENC_LITTLE_ENDIAN);
4577     proto_tree_add_item (tc_tree, hf_r3_timerchain_boundary, tvb, 3 + i + 5, 1, ENC_LITTLE_ENDIAN);
4578     proto_tree_add_item (tc_tree, hf_r3_timerchain_count,    tvb, 3 + i + 6, 2, ENC_LITTLE_ENDIAN);
4579     proto_tree_add_item (tc_tree, hf_r3_timerchain_flags,    tvb, 3 + i + 8, 4, ENC_LITTLE_ENDIAN);
4580   }
4581 }
4582 
4583 static void
dissect_r3_upstreammfgfield_peekpoke(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo,proto_tree * tree)4584 dissect_r3_upstreammfgfield_peekpoke (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo, proto_tree *tree)
4585 {
4586   gint i;
4587   gint len;
4588 
4589   DISSECTOR_ASSERT(start_offset == 0);
4590 
4591   len = tvb_reported_length_remaining (tvb, 0);
4592 
4593   for (i = 0; i < len; i += 3)
4594   {
4595     proto_item *peekpoke_item;
4596     proto_item *peekpoke_op_item;
4597     proto_tree *peekpoke_tree;
4598 
4599     peekpoke_tree = proto_tree_add_subtree(tree, tvb, i, 3, ett_r3peekpoke, &peekpoke_item, "");
4600 
4601     peekpoke_op_item = proto_tree_add_item (peekpoke_tree, hf_r3_peekpoke_operation, tvb, i + 0, 1, ENC_LITTLE_ENDIAN);
4602     proto_tree_add_item (peekpoke_tree, hf_r3_peekpoke_address,   tvb, i + 1, 2, ENC_LITTLE_ENDIAN);
4603 
4604     switch (tvb_get_guint8 (tvb, i + 0))
4605     {
4606       case PEEKPOKE_READU8 :
4607         if (peekpoke_tree)
4608         {
4609           proto_item_append_text (peekpoke_item, "Read (8 Bits @ 0x%04x = 0x%02x)",
4610                                   tvb_get_letohs (tvb, i + 1),
4611                                   tvb_get_guint8 (tvb, i + 3));
4612           proto_item_set_len (peekpoke_item, 4);
4613           proto_tree_add_item (peekpoke_tree, hf_r3_peekpoke_poke8, tvb, i + 3, 1, ENC_LITTLE_ENDIAN);
4614         }
4615         i += 1;
4616         break;
4617 
4618       case PEEKPOKE_READU16 :
4619         if (peekpoke_tree)
4620         {
4621           proto_item_append_text (peekpoke_item, "Read (16 Bits @ 0x%04x = 0x%04x)",
4622                                   tvb_get_letohs (tvb, i + 1),
4623                                   tvb_get_letohs (tvb, i + 3));
4624           proto_item_set_len (peekpoke_item, 5);
4625           proto_tree_add_item (peekpoke_tree, hf_r3_peekpoke_poke16, tvb, i + 3, 2, ENC_LITTLE_ENDIAN);
4626         }
4627         i += 2;
4628         break;
4629 
4630       case PEEKPOKE_READU24 :
4631         if (peekpoke_tree)
4632         {
4633           proto_item_append_text (peekpoke_item, "Read (24 Bits @ 0x%04x = 0x%06x)",
4634                                   tvb_get_letohs (tvb, i + 1),
4635                                   tvb_get_letoh24 (tvb, i + 3));
4636           proto_item_set_len (peekpoke_item, 6);
4637           proto_tree_add_item (peekpoke_tree, hf_r3_peekpoke_poke24, tvb, i + 3, 3, ENC_LITTLE_ENDIAN);
4638         }
4639         i += 3;
4640         break;
4641 
4642       case PEEKPOKE_READU32 :
4643         if (peekpoke_tree)
4644         {
4645           proto_item_append_text (peekpoke_item, "Read (32 Bits @ 0x%04x = 0x%08x)",
4646                                   tvb_get_letohs (tvb, i + 1),
4647                                   tvb_get_letohl (tvb, i + 3));
4648           proto_item_set_len (peekpoke_item, 7);
4649           proto_tree_add_item (peekpoke_tree, hf_r3_peekpoke_poke32, tvb, i + 3, 4, ENC_LITTLE_ENDIAN);
4650         }
4651         i += 4;
4652         break;
4653 
4654       case PEEKPOKE_READSTRING :
4655         if (peekpoke_tree)
4656         {
4657           proto_item_append_text (peekpoke_item, "Read (%u Bytes @ 0x%04x)",
4658                                   tvb_get_guint8 (tvb, i + 3),
4659                                   tvb_get_letohs (tvb, i + 1));
4660           proto_item_set_len (peekpoke_item, 3 + 1 + tvb_get_guint8 (tvb, i + 3));
4661           proto_tree_add_item (peekpoke_tree, hf_r3_peekpoke_length,     tvb, i + 3, 1, ENC_LITTLE_ENDIAN);
4662           proto_tree_add_item (peekpoke_tree, hf_r3_peekpoke_pokestring, tvb, i + 4, tvb_get_guint8 (tvb, i + 3), ENC_NA);
4663         }
4664         i += tvb_get_guint8 (tvb, i + 3) + 1;
4665         break;
4666 
4667       default :
4668         expert_add_info(pinfo, peekpoke_op_item, &ei_r3_peekpoke_operation);
4669         return;  /* quit */
4670     }
4671   }
4672 }
4673 
4674 static void
dissect_r3_upstreammfgfield_lockstate(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)4675 dissect_r3_upstreammfgfield_lockstate (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
4676 {
4677 static int * const r3_lockstate_flags[] = {
4678   &hf_r3_lockstate_passage,
4679   &hf_r3_lockstate_panic,
4680   &hf_r3_lockstate_lockout,
4681   &hf_r3_lockstate_relock,
4682   &hf_r3_lockstate_autoopen,
4683   &hf_r3_lockstate_nextauto,
4684   &hf_r3_lockstate_lockstate,
4685   &hf_r3_lockstate_wantstate,
4686   &hf_r3_lockstate_remote,
4687   &hf_r3_lockstate_update,
4688   &hf_r3_lockstate_exceptionspresent,
4689   &hf_r3_lockstate_exceptionsactive,
4690   &hf_r3_lockstate_timezonespresent,
4691   &hf_r3_lockstate_timezonesactive,
4692   &hf_r3_lockstate_autounlockspresent,
4693   &hf_r3_lockstate_autounlocksactive,
4694   &hf_r3_lockstate_uapmspresent,
4695   &hf_r3_lockstate_uapmsactive,
4696   &hf_r3_lockstate_uapmrelockspresent,
4697   &hf_r3_lockstate_uapmreslocksactive,
4698   &hf_r3_lockstate_nvramprotect,
4699   &hf_r3_lockstate_nvramchecksum,
4700   NULL
4701 };
4702 
4703  DISSECTOR_ASSERT(start_offset == 0);
4704 
4705  proto_tree_add_bitmask(tree, tvb, start_offset, hf_r3_lockstate, ett_r3lockstate, r3_lockstate_flags, ENC_LITTLE_ENDIAN);
4706 }
4707 
4708 static void
dissect_r3_upstreammfgfield_capabilities(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo,proto_tree * tree)4709 dissect_r3_upstreammfgfield_capabilities (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo, proto_tree *tree)
4710 {
4711   proto_tree *cf_tree;
4712   gint        len;
4713   guint       items;
4714   guint       octets;
4715   gint        i;
4716   guint8      step;
4717 
4718   DISSECTOR_ASSERT(start_offset == 0);
4719 
4720   len = MAX(0, tvb_reported_length_remaining (tvb, 0));
4721 
4722   items = 0;
4723   i     = 0;
4724 
4725   while (i < len)
4726   {
4727     items++;
4728     octets = tvb_get_guint8 (tvb, i);
4729     if (!octets)
4730     {
4731       proto_tree_add_expert_format(tree, pinfo, &ei_r3_malformed_length, tvb, 0, len, "Capabilities could not be decoded because length of 0 encountered");
4732       return;
4733     }
4734     i += octets;
4735   }
4736 
4737   if (!tree)
4738     return;
4739 
4740   cf_tree = proto_tree_add_subtree_format(tree, tvb, 0, len, ett_r3capabilities, NULL, "Capabilities (%u items)", items);
4741 
4742   i = 0;
4743   while (i<len && (step=tvb_get_guint8(tvb, i))>0)
4744   {
4745     proto_item  *tmp_item = proto_tree_add_item (cf_tree, hf_r3_capabilities, tvb, i, tvb_get_guint8 (tvb, i), ENC_NA);
4746     proto_tree  *tmp_tree = proto_item_add_subtree (tmp_item, ett_r3capabilities);
4747     const gchar *fn;
4748 
4749     fn = val_to_str_ext_const (tvb_get_guint8 (tvb, i + 1), &r3_capabilitiesnames_ext, "[Unknown Field Name]");
4750 
4751     proto_item_append_text (tmp_item, " (%s, %u)", fn, tvb_get_letohs (tvb, i + 2));
4752     proto_tree_add_item (tmp_tree, hf_r3_capabilities_length, tvb, i + 0, 1, ENC_LITTLE_ENDIAN);
4753     proto_tree_add_item (tmp_tree, hf_r3_capabilities_type,   tvb, i + 1, 1, ENC_LITTLE_ENDIAN);
4754     proto_tree_add_item (tmp_tree, hf_r3_capabilities_value,  tvb, i + 2, 2, ENC_LITTLE_ENDIAN);
4755 
4756     i += step;
4757   }
4758 }
4759 
4760 static void
dissect_r3_upstreammfgfield_dumpm41t81(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo,proto_tree * tree)4761 dissect_r3_upstreammfgfield_dumpm41t81 (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo, proto_tree *tree)
4762 {
4763   DISSECTOR_ASSERT(start_offset == 0);
4764 
4765   if (tvb_reported_length_remaining (tvb, 0) != 20)
4766   {
4767     expert_add_info_format(pinfo, proto_tree_get_parent (tree), &ei_r3_malformed_length, "Length of M41T81 RTC register dump not 20 octets");
4768   }
4769   else
4770   {
4771     proto_tree *rtc_tree;
4772     proto_tree *tmp_tree [20];
4773     guint       offset_in_bits;
4774 
4775     if (!tree)
4776       return;
4777 
4778     rtc_tree = proto_tree_add_subtree(tree, tvb, 0, -1, ett_r3m41t81registers, NULL, "M41T81 RTC Registers");
4779 
4780     tmp_tree [ 0] = proto_item_add_subtree (proto_tree_add_item (rtc_tree, hf_r3_dumpm41t81_reg00, tvb,  0, 1, ENC_LITTLE_ENDIAN), ett_r3m41t81register);
4781     tmp_tree [ 1] = proto_item_add_subtree (proto_tree_add_item (rtc_tree, hf_r3_dumpm41t81_reg01, tvb,  1, 1, ENC_LITTLE_ENDIAN), ett_r3m41t81register);
4782     tmp_tree [ 2] = proto_item_add_subtree (proto_tree_add_item (rtc_tree, hf_r3_dumpm41t81_reg02, tvb,  2, 1, ENC_LITTLE_ENDIAN), ett_r3m41t81register);
4783     tmp_tree [ 3] = proto_item_add_subtree (proto_tree_add_item (rtc_tree, hf_r3_dumpm41t81_reg03, tvb,  3, 1, ENC_LITTLE_ENDIAN), ett_r3m41t81register);
4784     tmp_tree [ 4] = proto_item_add_subtree (proto_tree_add_item (rtc_tree, hf_r3_dumpm41t81_reg04, tvb,  4, 1, ENC_LITTLE_ENDIAN), ett_r3m41t81register);
4785     tmp_tree [ 5] = proto_item_add_subtree (proto_tree_add_item (rtc_tree, hf_r3_dumpm41t81_reg05, tvb,  5, 1, ENC_LITTLE_ENDIAN), ett_r3m41t81register);
4786     tmp_tree [ 6] = proto_item_add_subtree (proto_tree_add_item (rtc_tree, hf_r3_dumpm41t81_reg06, tvb,  6, 1, ENC_LITTLE_ENDIAN), ett_r3m41t81register);
4787     tmp_tree [ 7] = proto_item_add_subtree (proto_tree_add_item (rtc_tree, hf_r3_dumpm41t81_reg07, tvb,  7, 1, ENC_LITTLE_ENDIAN), ett_r3m41t81register);
4788     tmp_tree [ 8] = proto_item_add_subtree (proto_tree_add_item (rtc_tree, hf_r3_dumpm41t81_reg08, tvb,  8, 1, ENC_LITTLE_ENDIAN), ett_r3m41t81register);
4789     tmp_tree [ 9] = proto_item_add_subtree (proto_tree_add_item (rtc_tree, hf_r3_dumpm41t81_reg09, tvb,  9, 1, ENC_LITTLE_ENDIAN), ett_r3m41t81register);
4790     tmp_tree [10] = proto_item_add_subtree (proto_tree_add_item (rtc_tree, hf_r3_dumpm41t81_reg0a, tvb, 10, 1, ENC_LITTLE_ENDIAN), ett_r3m41t81register);
4791     tmp_tree [11] = proto_item_add_subtree (proto_tree_add_item (rtc_tree, hf_r3_dumpm41t81_reg0b, tvb, 11, 1, ENC_LITTLE_ENDIAN), ett_r3m41t81register);
4792     tmp_tree [12] = proto_item_add_subtree (proto_tree_add_item (rtc_tree, hf_r3_dumpm41t81_reg0c, tvb, 12, 1, ENC_LITTLE_ENDIAN), ett_r3m41t81register);
4793     tmp_tree [13] = proto_item_add_subtree (proto_tree_add_item (rtc_tree, hf_r3_dumpm41t81_reg0d, tvb, 13, 1, ENC_LITTLE_ENDIAN), ett_r3m41t81register);
4794     tmp_tree [14] = proto_item_add_subtree (proto_tree_add_item (rtc_tree, hf_r3_dumpm41t81_reg0e, tvb, 14, 1, ENC_LITTLE_ENDIAN), ett_r3m41t81register);
4795     tmp_tree [15] = proto_item_add_subtree (proto_tree_add_item (rtc_tree, hf_r3_dumpm41t81_reg0f, tvb, 15, 1, ENC_LITTLE_ENDIAN), ett_r3m41t81register);
4796     tmp_tree [16] = proto_item_add_subtree (proto_tree_add_item (rtc_tree, hf_r3_dumpm41t81_reg10, tvb, 16, 1, ENC_LITTLE_ENDIAN), ett_r3m41t81register);
4797     tmp_tree [17] = proto_item_add_subtree (proto_tree_add_item (rtc_tree, hf_r3_dumpm41t81_reg11, tvb, 17, 1, ENC_LITTLE_ENDIAN), ett_r3m41t81register);
4798     tmp_tree [18] = proto_item_add_subtree (proto_tree_add_item (rtc_tree, hf_r3_dumpm41t81_reg12, tvb, 18, 1, ENC_LITTLE_ENDIAN), ett_r3m41t81register);
4799     tmp_tree [19] = proto_item_add_subtree (proto_tree_add_item (rtc_tree, hf_r3_dumpm41t81_reg13, tvb, 19, 1, ENC_LITTLE_ENDIAN), ett_r3m41t81register);
4800 
4801     offset_in_bits = 0 * 8;
4802 
4803     proto_tree_add_bits_item (tmp_tree [ 0], hf_r3_dumpm41t81_reg00_sec1,       tvb, offset_in_bits, 4, ENC_LITTLE_ENDIAN);  offset_in_bits += 4;
4804     proto_tree_add_bits_item (tmp_tree [ 0], hf_r3_dumpm41t81_reg00_sec01,      tvb, offset_in_bits, 4, ENC_LITTLE_ENDIAN);  offset_in_bits += 4;
4805     proto_tree_add_bits_item (tmp_tree [ 1], hf_r3_dumpm41t81_reg01_st,         tvb, offset_in_bits, 1, ENC_LITTLE_ENDIAN);  offset_in_bits += 1;
4806     proto_tree_add_bits_item (tmp_tree [ 1], hf_r3_dumpm41t81_reg01_10sec,      tvb, offset_in_bits, 3, ENC_LITTLE_ENDIAN);  offset_in_bits += 3;
4807     proto_tree_add_bits_item (tmp_tree [ 1], hf_r3_dumpm41t81_reg01_1sec,       tvb, offset_in_bits, 4, ENC_LITTLE_ENDIAN);  offset_in_bits += 4;
4808     proto_tree_add_bits_item (tmp_tree [ 2], hf_r3_dumpm41t81_reg02_notused,    tvb, offset_in_bits, 1, ENC_LITTLE_ENDIAN);  offset_in_bits += 1;
4809     proto_tree_add_bits_item (tmp_tree [ 2], hf_r3_dumpm41t81_reg02_10min,      tvb, offset_in_bits, 3, ENC_LITTLE_ENDIAN);  offset_in_bits += 3;
4810     proto_tree_add_bits_item (tmp_tree [ 2], hf_r3_dumpm41t81_reg02_1min,       tvb, offset_in_bits, 4, ENC_LITTLE_ENDIAN);  offset_in_bits += 4;
4811     proto_tree_add_bits_item (tmp_tree [ 3], hf_r3_dumpm41t81_reg03_cbe,        tvb, offset_in_bits, 1, ENC_LITTLE_ENDIAN);  offset_in_bits += 1;
4812     proto_tree_add_bits_item (tmp_tree [ 3], hf_r3_dumpm41t81_reg03_cb,         tvb, offset_in_bits, 1, ENC_LITTLE_ENDIAN);  offset_in_bits += 1;
4813     proto_tree_add_bits_item (tmp_tree [ 3], hf_r3_dumpm41t81_reg03_10hour,     tvb, offset_in_bits, 2, ENC_LITTLE_ENDIAN);  offset_in_bits += 2;
4814     proto_tree_add_bits_item (tmp_tree [ 3], hf_r3_dumpm41t81_reg03_1hour,      tvb, offset_in_bits, 4, ENC_LITTLE_ENDIAN);  offset_in_bits += 4;
4815     proto_tree_add_bits_item (tmp_tree [ 4], hf_r3_dumpm41t81_reg04_notused,    tvb, offset_in_bits, 5, ENC_LITTLE_ENDIAN);  offset_in_bits += 5;
4816     proto_tree_add_bits_item (tmp_tree [ 4], hf_r3_dumpm41t81_reg04_dow,        tvb, offset_in_bits, 3, ENC_LITTLE_ENDIAN);  offset_in_bits += 3;
4817     proto_tree_add_bits_item (tmp_tree [ 5], hf_r3_dumpm41t81_reg05_notused,    tvb, offset_in_bits, 2, ENC_LITTLE_ENDIAN);  offset_in_bits += 2;
4818     proto_tree_add_bits_item (tmp_tree [ 5], hf_r3_dumpm41t81_reg05_10day,      tvb, offset_in_bits, 2, ENC_LITTLE_ENDIAN);  offset_in_bits += 2;
4819     proto_tree_add_bits_item (tmp_tree [ 5], hf_r3_dumpm41t81_reg05_1day,       tvb, offset_in_bits, 4, ENC_LITTLE_ENDIAN);  offset_in_bits += 4;
4820     proto_tree_add_bits_item (tmp_tree [ 6], hf_r3_dumpm41t81_reg06_notused,    tvb, offset_in_bits, 3, ENC_LITTLE_ENDIAN);  offset_in_bits += 3;
4821     proto_tree_add_bits_item (tmp_tree [ 6], hf_r3_dumpm41t81_reg06_10month,    tvb, offset_in_bits, 1, ENC_LITTLE_ENDIAN);  offset_in_bits += 1;
4822     proto_tree_add_bits_item (tmp_tree [ 6], hf_r3_dumpm41t81_reg06_1month,     tvb, offset_in_bits, 4, ENC_LITTLE_ENDIAN);  offset_in_bits += 4;
4823     proto_tree_add_bits_item (tmp_tree [ 7], hf_r3_dumpm41t81_reg07_10year,     tvb, offset_in_bits, 4, ENC_LITTLE_ENDIAN);  offset_in_bits += 4;
4824     proto_tree_add_bits_item (tmp_tree [ 7], hf_r3_dumpm41t81_reg07_1year,      tvb, offset_in_bits, 4, ENC_LITTLE_ENDIAN);  offset_in_bits += 4;
4825     proto_tree_add_bits_item (tmp_tree [ 8], hf_r3_dumpm41t81_reg08_out,        tvb, offset_in_bits, 1, ENC_LITTLE_ENDIAN);  offset_in_bits += 1;
4826     proto_tree_add_bits_item (tmp_tree [ 8], hf_r3_dumpm41t81_reg08_ft,         tvb, offset_in_bits, 1, ENC_LITTLE_ENDIAN);  offset_in_bits += 1;
4827     proto_tree_add_bits_item (tmp_tree [ 8], hf_r3_dumpm41t81_reg08_s,          tvb, offset_in_bits, 1, ENC_LITTLE_ENDIAN);  offset_in_bits += 1;
4828     proto_tree_add_bits_item (tmp_tree [ 8], hf_r3_dumpm41t81_reg08_cal,        tvb, offset_in_bits, 5, ENC_LITTLE_ENDIAN);  offset_in_bits += 5;
4829     proto_tree_add_bits_item (tmp_tree [ 9], hf_r3_dumpm41t81_reg09_notused,    tvb, offset_in_bits, 1, ENC_LITTLE_ENDIAN);  offset_in_bits += 1;
4830     proto_tree_add_bits_item (tmp_tree [ 9], hf_r3_dumpm41t81_reg09_bmb,        tvb, offset_in_bits, 5, ENC_LITTLE_ENDIAN);  offset_in_bits += 5;
4831     proto_tree_add_bits_item (tmp_tree [ 9], hf_r3_dumpm41t81_reg09_rb,         tvb, offset_in_bits, 2, ENC_LITTLE_ENDIAN);  offset_in_bits += 2;
4832     proto_tree_add_bits_item (tmp_tree [10], hf_r3_dumpm41t81_reg0a_afe,        tvb, offset_in_bits, 1, ENC_LITTLE_ENDIAN);  offset_in_bits += 1;
4833     proto_tree_add_bits_item (tmp_tree [10], hf_r3_dumpm41t81_reg0a_sqwe,       tvb, offset_in_bits, 1, ENC_LITTLE_ENDIAN);  offset_in_bits += 1;
4834     proto_tree_add_bits_item (tmp_tree [10], hf_r3_dumpm41t81_reg0a_abe,        tvb, offset_in_bits, 1, ENC_LITTLE_ENDIAN);  offset_in_bits += 1;
4835     proto_tree_add_bits_item (tmp_tree [10], hf_r3_dumpm41t81_reg0a_10monthalm, tvb, offset_in_bits, 1, ENC_LITTLE_ENDIAN);  offset_in_bits += 1;
4836     proto_tree_add_bits_item (tmp_tree [10], hf_r3_dumpm41t81_reg0a_1monthalm,  tvb, offset_in_bits, 4, ENC_LITTLE_ENDIAN);  offset_in_bits += 4;
4837     proto_tree_add_bits_item (tmp_tree [11], hf_r3_dumpm41t81_reg0b_rpt5,       tvb, offset_in_bits, 1, ENC_LITTLE_ENDIAN);  offset_in_bits += 1;
4838     proto_tree_add_bits_item (tmp_tree [11], hf_r3_dumpm41t81_reg0b_rpt4,       tvb, offset_in_bits, 1, ENC_LITTLE_ENDIAN);  offset_in_bits += 1;
4839     proto_tree_add_bits_item (tmp_tree [11], hf_r3_dumpm41t81_reg0b_10dayalm,   tvb, offset_in_bits, 2, ENC_LITTLE_ENDIAN);  offset_in_bits += 2;
4840     proto_tree_add_bits_item (tmp_tree [11], hf_r3_dumpm41t81_reg0b_1dayalm,    tvb, offset_in_bits, 4, ENC_LITTLE_ENDIAN);  offset_in_bits += 4;
4841     proto_tree_add_bits_item (tmp_tree [12], hf_r3_dumpm41t81_reg0c_rpt3,       tvb, offset_in_bits, 1, ENC_LITTLE_ENDIAN);  offset_in_bits += 1;
4842     proto_tree_add_bits_item (tmp_tree [12], hf_r3_dumpm41t81_reg0c_ht,         tvb, offset_in_bits, 1, ENC_LITTLE_ENDIAN);  offset_in_bits += 1;
4843     proto_tree_add_bits_item (tmp_tree [12], hf_r3_dumpm41t81_reg0c_10houralm,  tvb, offset_in_bits, 2, ENC_LITTLE_ENDIAN);  offset_in_bits += 2;
4844     proto_tree_add_bits_item (tmp_tree [12], hf_r3_dumpm41t81_reg0c_1houralm,   tvb, offset_in_bits, 4, ENC_LITTLE_ENDIAN);  offset_in_bits += 4;
4845     proto_tree_add_bits_item (tmp_tree [13], hf_r3_dumpm41t81_reg0d_rpt2,       tvb, offset_in_bits, 1, ENC_LITTLE_ENDIAN);  offset_in_bits += 1;
4846     proto_tree_add_bits_item (tmp_tree [13], hf_r3_dumpm41t81_reg0d_10minalm,   tvb, offset_in_bits, 3, ENC_LITTLE_ENDIAN);  offset_in_bits += 3;
4847     proto_tree_add_bits_item (tmp_tree [13], hf_r3_dumpm41t81_reg0d_1minalm,    tvb, offset_in_bits, 4, ENC_LITTLE_ENDIAN);  offset_in_bits += 4;
4848     proto_tree_add_bits_item (tmp_tree [14], hf_r3_dumpm41t81_reg0e_rpt1,       tvb, offset_in_bits, 1, ENC_LITTLE_ENDIAN);  offset_in_bits += 1;
4849     proto_tree_add_bits_item (tmp_tree [14], hf_r3_dumpm41t81_reg0e_10secalm,   tvb, offset_in_bits, 3, ENC_LITTLE_ENDIAN);  offset_in_bits += 3;
4850     proto_tree_add_bits_item (tmp_tree [14], hf_r3_dumpm41t81_reg0e_1secalm,    tvb, offset_in_bits, 4, ENC_LITTLE_ENDIAN);  offset_in_bits += 4;
4851     proto_tree_add_bits_item (tmp_tree [15], hf_r3_dumpm41t81_reg0f_wdf,        tvb, offset_in_bits, 1, ENC_LITTLE_ENDIAN);  offset_in_bits += 1;
4852     proto_tree_add_bits_item (tmp_tree [15], hf_r3_dumpm41t81_reg0f_af,         tvb, offset_in_bits, 1, ENC_LITTLE_ENDIAN);  offset_in_bits += 1;
4853     proto_tree_add_bits_item (tmp_tree [15], hf_r3_dumpm41t81_reg0f_notused,    tvb, offset_in_bits, 6, ENC_LITTLE_ENDIAN);  offset_in_bits += 6;
4854     proto_tree_add_bits_item (tmp_tree [16], hf_r3_dumpm41t81_reg10_notused,    tvb, offset_in_bits, 8, ENC_LITTLE_ENDIAN);  offset_in_bits += 8;
4855     proto_tree_add_bits_item (tmp_tree [17], hf_r3_dumpm41t81_reg11_notused,    tvb, offset_in_bits, 8, ENC_LITTLE_ENDIAN);  offset_in_bits += 8;
4856     proto_tree_add_bits_item (tmp_tree [18], hf_r3_dumpm41t81_reg12_notused,    tvb, offset_in_bits, 8, ENC_LITTLE_ENDIAN);  offset_in_bits += 8;
4857     proto_tree_add_bits_item (tmp_tree [19], hf_r3_dumpm41t81_reg13_rs,         tvb, offset_in_bits - 8, 4, ENC_LITTLE_ENDIAN);  offset_in_bits += 4;
4858     proto_tree_add_bits_item (tmp_tree [19], hf_r3_dumpm41t81_reg13_notused,    tvb, offset_in_bits - 8, 4, ENC_LITTLE_ENDIAN);
4859   }
4860 }
4861 
4862 static void
dissect_r3_upstreammfgfield_nvramchecksumvalue(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)4863 dissect_r3_upstreammfgfield_nvramchecksumvalue (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
4864 {
4865   if (tree)
4866   {
4867     DISSECTOR_ASSERT(start_offset == 0);
4868 
4869     proto_tree_add_item (tree, hf_r3_nvramchecksumvalue,       tvb, 0, 4, ENC_LITTLE_ENDIAN);
4870     proto_tree_add_item (tree, hf_r3_nvramchecksumvalue_fixup, tvb, 4, 4, ENC_LITTLE_ENDIAN);
4871   }
4872 }
4873 
4874 static void
dissect_r3_upstreammfgfield_checksumresults(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo,proto_tree * tree)4875 dissect_r3_upstreammfgfield_checksumresults (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo, proto_tree *tree)
4876 {
4877   gint len;
4878 
4879   DISSECTOR_ASSERT(start_offset == 0);
4880 
4881   len = MAX(0, tvb_reported_length_remaining(tvb, 0));
4882   if (len % 3 != 0)
4883   {
4884     expert_add_info_format(pinfo, proto_tree_get_parent (tree), &ei_r3_malformed_length, "Checksum results data length not modulo 3 == 0");
4885   }
4886   else
4887   {
4888     proto_tree *cksum_tree;
4889     guint32     error = FALSE;
4890     gint        i;
4891     guint8      step;
4892 
4893     if (!tree)
4894       return;
4895 
4896     i = 0;
4897     while (i<len && (step=tvb_get_guint8(tvb, i))>0)
4898     {
4899       error |= tvb_get_guint8 (tvb, i + 2);
4900       i += step;
4901     }
4902 
4903     cksum_tree = proto_tree_add_subtree_format(tree, tvb, 0, len, ett_r3checksumresults, NULL,
4904                                    "Checksum Results (%s)", error ? "Error" : "No Errors");
4905 
4906     i = 0;
4907     while (i<len && (step=tvb_get_guint8(tvb, i))>0)
4908     {
4909       proto_item  *res_item = proto_tree_add_item (cksum_tree, hf_r3_checksumresults,
4910                                                   tvb,
4911                                                   i,
4912                                                   tvb_get_guint8 (tvb, i),
4913                                                   ENC_NA);
4914       proto_tree  *res_tree = proto_item_add_subtree (res_item, ett_r3checksumresultsfield);
4915       const gchar *fn;
4916 
4917       fn = val_to_str_ext_const (tvb_get_guint8 (tvb, i + 1), &r3_checksumresultnames_ext, "[Unknown Field Name]");
4918 
4919       proto_item_append_text (res_item, " %s (%s)", fn, tvb_get_guint8 (tvb, i + 2) ? "Error" : "No Error");
4920 
4921       proto_tree_add_item (res_tree, hf_r3_checksumresults_length, tvb, i + 0, 1, ENC_LITTLE_ENDIAN);
4922       proto_tree_add_item (res_tree, hf_r3_checksumresults_field,  tvb, i + 1, 1, ENC_LITTLE_ENDIAN);
4923       proto_tree_add_item (res_tree, hf_r3_checksumresults_state,  tvb, i + 2, 1, ENC_LITTLE_ENDIAN);
4924 
4925       i += step;
4926     }
4927   }
4928 }
4929 
4930 static void
dissect_r3_upstreammfgfield_mortisestatelog(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)4931 dissect_r3_upstreammfgfield_mortisestatelog (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
4932 {
4933   gint len;
4934   gint i;
4935 
4936   if (!tree)
4937     return;
4938 
4939   DISSECTOR_ASSERT(start_offset == 0);
4940 
4941   len = tvb_reported_length_remaining (tvb, 3);
4942 
4943   proto_tree_add_item (tree, hf_r3_mortisestatelog_pointer,     tvb, 0, 1, ENC_LITTLE_ENDIAN);
4944   proto_tree_add_item (tree, hf_r3_mortisestatelog_mortisetype, tvb, 1, 1, ENC_LITTLE_ENDIAN);
4945   proto_tree_add_item (tree, hf_r3_mortisestatelog_waiting,     tvb, 2, 1, ENC_LITTLE_ENDIAN);
4946 
4947   for (i = 0; i < len; i += 3)
4948   {
4949     guint       state   = tvb_get_guint8 (tvb, 3 + i + 0);
4950     guint       last    = tvb_get_guint8 (tvb, 3 + i + 1);
4951     guint       event   = tvb_get_guint8 (tvb, 3 + i + 2);
4952     proto_tree  *ms_tree = proto_tree_add_subtree_format(tree, tvb, 3 + i, 3, ett_r3mortisestatelog, NULL,
4953                                                "State Log Entry %2d (State=0x%02x, Last=0x%02x, Event=%s (0x%02x))",
4954                                                i / 3,
4955                                                state,
4956                                                last,
4957                                                val_to_str_ext_const (event, &r3_mortiseeventnames_ext, "[Unknown]"),
4958                                                event);
4959 
4960     proto_tree_add_item (ms_tree, hf_r3_mortisestatelog_state, tvb, 3 + i + 0, 1, ENC_LITTLE_ENDIAN);
4961     proto_tree_add_item (ms_tree, hf_r3_mortisestatelog_last,  tvb, 3 + i + 1, 1, ENC_LITTLE_ENDIAN);
4962     proto_tree_add_item (ms_tree, hf_r3_mortisestatelog_event, tvb, 3 + i + 2, 1, ENC_LITTLE_ENDIAN);
4963   }
4964 }
4965 
4966 static void
dissect_r3_upstreammfgfield_mortisepins(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)4967 dissect_r3_upstreammfgfield_mortisepins (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
4968 {
4969   proto_tree *iopins_tree;
4970 
4971   if (!tree)
4972     return;
4973 
4974   DISSECTOR_ASSERT(start_offset == 0);
4975 
4976   iopins_tree = proto_tree_add_subtree_format(tree, tvb, 0, 1, ett_r3iopins, NULL,
4977                                      "Mortise Pin States (0x%02x)", tvb_get_guint8 (tvb, 0));
4978 
4979   proto_tree_add_item (iopins_tree, hf_r3_mortisepins_s1, tvb, 0, 1, ENC_LITTLE_ENDIAN);
4980   proto_tree_add_item (iopins_tree, hf_r3_mortisepins_s2, tvb, 0, 1, ENC_LITTLE_ENDIAN);
4981   proto_tree_add_item (iopins_tree, hf_r3_mortisepins_s3, tvb, 0, 1, ENC_LITTLE_ENDIAN);
4982   proto_tree_add_item (iopins_tree, hf_r3_mortisepins_s4, tvb, 0, 1, ENC_LITTLE_ENDIAN);
4983 }
4984 
4985 static void
dissect_r3_upstreammfgfield_keypadchar(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)4986 dissect_r3_upstreammfgfield_keypadchar (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
4987 {
4988   if (!tree)
4989     return;
4990 
4991   DISSECTOR_ASSERT(start_offset == 0);
4992 
4993   proto_item_append_text (
4994     proto_tree_add_item (tree, hf_r3_testkeypad, tvb, 0, 1, ENC_LITTLE_ENDIAN),
4995     " ('%c')", tvb_get_guint8 (tvb, 0));
4996 }
4997 
4998 static void
dissect_r3_upstreammfgfield_magcard(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)4999 dissect_r3_upstreammfgfield_magcard (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
5000 {
5001   DISSECTOR_ASSERT(start_offset == 0);
5002 
5003   proto_tree_add_item (tree, hf_r3_testmagcard, tvb, 0, -1, ENC_ASCII|ENC_NA);
5004 }
5005 
5006 static void
dissect_r3_upstreammfgfield_proxcard(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)5007 dissect_r3_upstreammfgfield_proxcard (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
5008 {
5009   DISSECTOR_ASSERT(start_offset == 0);
5010 
5011   proto_tree_add_item (tree, hf_r3_testproxcard, tvb, 0, -1, ENC_ASCII|ENC_NA);
5012 }
5013 
5014 /*
5015  * ***************************************************************************
5016  *
5017  *  This is passed a tvb that contains [length] [CMD_RESPONSE] [responseType_e] [cmdCommand_e]
5018  */
5019 static void
dissect_r3_response_singlebyte(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)5020 dissect_r3_response_singlebyte (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
5021 {
5022   if (tree)
5023   {
5024     proto_tree_add_item (tree, hf_r3_responsetype,      tvb, start_offset + 2, 1, ENC_LITTLE_ENDIAN);
5025     proto_tree_add_item (tree, hf_r3_responsetocommand, tvb, start_offset + 3, 1, ENC_LITTLE_ENDIAN);
5026   }
5027 }
5028 
5029 /*
5030  *  This is passed a tvb that contains [length] [CMD_RESPONSE] [RESPONSETYPE_HASDATA] [UPSTREAMCOMMAND_*]
5031  */
5032 static void
dissect_r3_response_hasdata(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo,proto_tree * tree)5033 dissect_r3_response_hasdata (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo, proto_tree *tree)
5034 {
5035   guint32      commandPacketLen;
5036   guint8       upstreamCmd;
5037 
5038   DISSECTOR_ASSERT(start_offset == 0);
5039 
5040   tvb_ensure_bytes_exist (tvb, 0, 4);
5041 
5042   commandPacketLen    = tvb_get_guint8 (tvb, 0);
5043   upstreamCmd         = tvb_get_guint8 (tvb, 3);
5044 
5045   if (tvb_get_guint8 (tvb, 1) != CMD_RESPONSE)
5046     expert_add_info(pinfo, proto_tree_get_parent (tree), &ei_r3_response_hasdata_octet_1);
5047   else if (tvb_get_guint8 (tvb, 2) != RESPONSETYPE_HASDATA)
5048     expert_add_info(pinfo, proto_tree_get_parent (tree), &ei_r3_response_hasdata_octet_2);
5049   else if (upstreamCmd >= UPSTREAMCOMMAND_LAST)
5050     expert_add_info(pinfo, proto_tree_get_parent (tree), &ei_r3_response_hasdata_octet_3);
5051   else
5052   {
5053     proto_tree *upstreamcommand_tree = NULL;
5054     tvbuff_t   *upstreamcommand_tvb;
5055 
5056     if (tree)
5057     {
5058       const gchar *ct;
5059       ct = val_to_str_ext_const (upstreamCmd, &r3_upstreamcommandnames_ext, "[Unknown Command Type]");
5060 
5061       proto_tree_add_item (tree, hf_r3_responsetype, tvb, 2, 1, ENC_LITTLE_ENDIAN);
5062 
5063       upstreamcommand_tree = proto_tree_add_subtree_format(tree, tvb, 3, -1, ett_r3upstreamcommand, NULL,
5064                                                   "Upstream Command: %s (%u)", ct, upstreamCmd);
5065 
5066       proto_tree_add_item (upstreamcommand_tree, hf_r3_upstreamcommand, tvb, 3, 1, ENC_LITTLE_ENDIAN);
5067     }
5068     tvb_ensure_bytes_exist (tvb, 0, commandPacketLen - 4);
5069 
5070     upstreamcommand_tvb = tvb_new_subset_length (tvb, 4, commandPacketLen - 4);
5071     if (r3upstreamcommand_dissect [upstreamCmd])
5072       (*r3upstreamcommand_dissect [upstreamCmd]) (upstreamcommand_tvb, 0, commandPacketLen - 4, pinfo, upstreamcommand_tree);
5073   }
5074 }
5075 
5076 /*
5077  * ***************************************************************************
5078  *
5079  *  These are passed a tvb that starts with [length] [CMD_RESPONSE] ...
5080  */
5081 static void
dissect_r3_cmd_response(tvbuff_t * tvb,guint32 start_offset,guint32 length,packet_info * pinfo,proto_tree * tree)5082 dissect_r3_cmd_response (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree)
5083 {
5084   guint8          responseLen  = tvb_get_guint8 (tvb, start_offset + 0);
5085   responseType_e  responseType = (responseType_e)tvb_get_guint8 (tvb, start_offset + 2);
5086   tvbuff_t       *payload_tvb  = tvb_new_subset_length (tvb, start_offset, responseLen);
5087 
5088   if (tree)
5089   {
5090     const gchar *rt;
5091 
5092     rt = val_to_str_ext_const (responseType, &r3_responsetypenames_ext, "[Unknown Response Type]");
5093 
5094     proto_item_set_text (proto_tree_get_parent (tree), "Response Packet: %s (%u)", rt, responseType);
5095     proto_tree_add_item (tree, hf_r3_responselength,  tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
5096     proto_tree_add_item (tree, hf_r3_responsecommand, tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
5097   }
5098 
5099   if (responseType >= RESPONSETYPE_LAST)
5100   {
5101     expert_add_info(pinfo, proto_tree_get_parent (tree), &ei_r3_response_hasdata_octet_3);
5102   }
5103   else if (r3response_dissect [responseType])
5104     (*r3response_dissect [responseType]) (payload_tvb, 0, length, pinfo, tree);
5105 }
5106 
5107 /*
5108  *  These are passed a tvb that contains [length] [cmdCommand_e] [[data]]
5109  */
5110 static void
dissect_r3_cmd_handshake(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)5111 dissect_r3_cmd_handshake (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
5112 {
5113   if (tree)
5114   {
5115     proto_tree_add_item (tree, hf_r3_commandlength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
5116     proto_tree_add_item (tree, hf_r3_command,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
5117   }
5118 }
5119 
5120 static void
dissect_r3_cmd_killsession(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)5121 dissect_r3_cmd_killsession (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
5122 {
5123   if (tree)
5124   {
5125     proto_tree_add_item (tree, hf_r3_commandlength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
5126     proto_tree_add_item (tree, hf_r3_command,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
5127   }
5128 }
5129 
5130 static void
dissect_r3_cmd_queryserialnumber(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)5131 dissect_r3_cmd_queryserialnumber (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
5132 {
5133   if (tree)
5134   {
5135     proto_tree_add_item (tree, hf_r3_commandlength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
5136     proto_tree_add_item (tree, hf_r3_command,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
5137   }
5138 }
5139 
5140 static void
dissect_r3_cmd_queryversion(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)5141 dissect_r3_cmd_queryversion (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
5142 {
5143   if (tree)
5144   {
5145     proto_tree_add_item (tree, hf_r3_commandlength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
5146     proto_tree_add_item (tree, hf_r3_command,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
5147   }
5148 }
5149 
5150 static void
dissect_r3_cmd_setdatetime(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)5151 dissect_r3_cmd_setdatetime (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
5152 {
5153   proto_tree *dt_tree;
5154   guint8      cmdLen;
5155   tvbuff_t   *payload_tvb;
5156 
5157   if (!tree)
5158     return;
5159 
5160   cmdLen      = tvb_get_guint8 (tvb, start_offset + 0);
5161   payload_tvb = tvb_new_subset_length (tvb, start_offset + 2, cmdLen - 2);
5162 
5163   proto_tree_add_item (tree, hf_r3_commandlength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
5164   proto_tree_add_item (tree, hf_r3_command,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
5165 
5166   dt_tree = proto_tree_add_subtree_format (tree, payload_tvb, 0, -1, ett_r3setdatetime, NULL,
5167                                  "Set Date/Time (%02u/%02u/%02u-%u %02u:%02u:%02u)",
5168                                  tvb_get_guint8 (payload_tvb, 0),
5169                                  tvb_get_guint8 (payload_tvb, 1),
5170                                  tvb_get_guint8 (payload_tvb, 2),
5171                                  tvb_get_guint8 (payload_tvb, 3),
5172                                  tvb_get_guint8 (payload_tvb, 4),
5173                                  tvb_get_guint8 (payload_tvb, 5),
5174                                  tvb_get_guint8 (payload_tvb, 6));
5175 
5176   proto_tree_add_item (dt_tree, hf_r3_setdate_year,    payload_tvb, 0, 1, ENC_LITTLE_ENDIAN);
5177   proto_tree_add_item (dt_tree, hf_r3_setdate_month,   payload_tvb, 1, 1, ENC_LITTLE_ENDIAN);
5178   proto_tree_add_item (dt_tree, hf_r3_setdate_day,     payload_tvb, 2, 1, ENC_LITTLE_ENDIAN);
5179   proto_tree_add_item (dt_tree, hf_r3_setdate_dow,     payload_tvb, 3, 1, ENC_LITTLE_ENDIAN);
5180   proto_tree_add_item (dt_tree, hf_r3_setdate_hours,   payload_tvb, 4, 1, ENC_LITTLE_ENDIAN);
5181   proto_tree_add_item (dt_tree, hf_r3_setdate_minutes, payload_tvb, 5, 1, ENC_LITTLE_ENDIAN);
5182   proto_tree_add_item (dt_tree, hf_r3_setdate_seconds, payload_tvb, 6, 1, ENC_LITTLE_ENDIAN);
5183 }
5184 
5185 static void
dissect_r3_cmd_querydatetime(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)5186 dissect_r3_cmd_querydatetime (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
5187 {
5188   if (tree)
5189   {
5190     proto_tree_add_item (tree, hf_r3_commandlength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
5191     proto_tree_add_item (tree, hf_r3_command,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
5192   }
5193 }
5194 
5195 static void
dissect_r3_cmd_setconfig(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo,proto_tree * tree)5196 dissect_r3_cmd_setconfig (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo, proto_tree *tree)
5197 {
5198   guint     cmdLen;
5199   tvbuff_t *payload_tvb;
5200   guint32   offset = 0;
5201 
5202   if (!tree)
5203     return;
5204 
5205   cmdLen      = tvb_get_guint8 (tvb, start_offset + 0);
5206   payload_tvb = tvb_new_subset_length (tvb, start_offset + 2, cmdLen - 2);
5207 
5208   proto_tree_add_item (tree, hf_r3_commandlength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
5209   proto_tree_add_item (tree, hf_r3_command,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
5210 
5211   while (offset < (cmdLen - 2))
5212   {
5213     proto_item  *sc_item;
5214     proto_tree  *sc_tree;
5215     const gchar *ci;
5216     guint8       configItem;
5217     guint8       item_length;
5218 
5219     configItem = tvb_get_guint8 (payload_tvb, offset + 1);
5220 
5221     ci = val_to_str_ext_const (
5222       configItem,
5223       &r3_configitemnames_ext,
5224       "[Unknown Configuration Item]");
5225 
5226     item_length = tvb_get_guint8 (payload_tvb, offset + 0);
5227     sc_tree = proto_tree_add_subtree_format(tree, payload_tvb, offset + 0, item_length,
5228                                    ett_r3upstreamfield, NULL, "Config Field: %s (%u)", ci, configItem);
5229 
5230     sc_item = proto_tree_add_item (sc_tree, hf_r3_configitemlength, payload_tvb, offset + 0, 1, ENC_LITTLE_ENDIAN);
5231     proto_tree_add_item (sc_tree, hf_r3_configitem,       payload_tvb, offset + 1, 1, ENC_LITTLE_ENDIAN);
5232     if (item_length == 0) {
5233       expert_add_info_format(pinfo, sc_item, &ei_r3_malformed_length, "Invalid item length");
5234       return;
5235     }
5236 
5237     if (configItem < array_length (configMap))
5238     {
5239       switch (configMap [configItem])
5240       {
5241         case CONFIGTYPE_NONE :
5242           proto_tree_add_item (sc_tree, hf_r3_configitemdata, payload_tvb, offset + 2, item_length - 3, ENC_NA);
5243           break;
5244 
5245         case CONFIGTYPE_BOOL :
5246           proto_tree_add_item (sc_tree, hf_r3_configitemdata_bool,   payload_tvb, offset + 2, 1, ENC_LITTLE_ENDIAN);
5247           break;
5248 
5249         case CONFIGTYPE_8 :
5250           proto_tree_add_item (sc_tree, hf_r3_configitemdata_8,      payload_tvb, offset + 2, 1, ENC_LITTLE_ENDIAN);
5251           break;
5252 
5253         case CONFIGTYPE_16 :
5254           proto_tree_add_item (sc_tree, hf_r3_configitemdata_16,     payload_tvb, offset + 2, 2, ENC_LITTLE_ENDIAN);
5255           break;
5256 
5257         case CONFIGTYPE_32 :
5258           proto_tree_add_item (sc_tree, hf_r3_configitemdata_32,     payload_tvb, offset + 2, 4, ENC_LITTLE_ENDIAN);
5259           break;
5260 
5261         case CONFIGTYPE_STRING :
5262           proto_tree_add_item (sc_tree, hf_r3_configitemdata_string, payload_tvb, offset + 2,
5263                                item_length - 2, ENC_ASCII|ENC_NA);
5264           break;
5265 
5266         default :
5267           proto_tree_add_none_format (sc_tree, hf_r3_upstreamfielderror, payload_tvb, offset + 2,
5268                                       item_length - 2, "Unknown Field Type");
5269           break;
5270       }
5271     }
5272     else {
5273       proto_tree_add_none_format (sc_tree, hf_r3_upstreamfielderror, payload_tvb, offset + 2,
5274                                       item_length - 2, "Unknown Field Type");
5275     }
5276 
5277     offset += item_length;
5278   }
5279 }
5280 
5281 static void
dissect_r3_cmd_getconfig(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)5282 dissect_r3_cmd_getconfig (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
5283 {
5284   proto_item *config_item;
5285   proto_tree *config_tree;
5286   guint32     cmdLen;
5287   guint32     i;
5288 
5289   if (!tree)
5290     return;
5291 
5292   cmdLen = tvb_get_guint8 (tvb, start_offset + 0);
5293 
5294   proto_tree_add_item (tree, hf_r3_commandlength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
5295   proto_tree_add_item (tree, hf_r3_command,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
5296 
5297   config_item = proto_tree_add_item (tree, hf_r3_configitems, tvb, start_offset + 2, cmdLen - 2, ENC_NA);
5298   config_tree = proto_item_add_subtree (config_item, ett_r3configitem);
5299 
5300   for (i = 2; i < cmdLen; i++)
5301     proto_tree_add_item (config_tree, hf_r3_configitem, tvb, start_offset + i, 1, ENC_LITTLE_ENDIAN);
5302 }
5303 
5304 static void
dissect_r3_cmd_manageuser(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo,proto_tree * tree)5305 dissect_r3_cmd_manageuser (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo, proto_tree *tree)
5306 {
5307   guint8    cmdLen      = tvb_get_guint8 (tvb, start_offset + 0);
5308   tvbuff_t *payload_tvb = tvb_new_subset_length (tvb, start_offset + 2, cmdLen - 2);
5309   guint32   offset      = 0;
5310 
5311   proto_tree_add_item (tree, hf_r3_commandlength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
5312   proto_tree_add_item (tree, hf_r3_command,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
5313 
5314   while (offset < tvb_reported_length (payload_tvb))
5315   {
5316     guint32      paramLength = tvb_get_guint8 (payload_tvb, offset + 0);
5317     guint32      paramType   = tvb_get_guint8 (payload_tvb, offset + 1);
5318     guint32      dataLength  = paramLength - 2;
5319     proto_tree  *mu_tree     = NULL;
5320     proto_item  *len_field   = NULL;
5321 
5322     if (tree)
5323     {
5324       const gchar *auptn;
5325       auptn = val_to_str_ext_const (paramType, &r3_adduserparamtypenames_ext, "[Unknown Field]");
5326 
5327       mu_tree = proto_item_add_subtree (
5328         proto_tree_add_none_format (tree, hf_r3_adduserparamtype, payload_tvb, offset + 0, paramLength,
5329                                     "Manage User Field: %s (%u)", auptn, paramType), ett_r3manageuser);
5330 
5331       len_field = proto_tree_add_item (mu_tree, hf_r3_adduserparamtypelength, payload_tvb, offset + 0, 1, ENC_LITTLE_ENDIAN);
5332       proto_tree_add_item (mu_tree, hf_r3_adduserparamtypetype, payload_tvb, offset + 1, 1, ENC_LITTLE_ENDIAN);
5333     }
5334 
5335     if (paramLength < 2)
5336     {
5337       dataLength = 0;
5338       expert_add_info_format(pinfo, len_field, &ei_r3_malformed_length, "Malformed length value -- all fields are at least 2 octets.");
5339     }
5340 
5341     offset += 2;
5342 
5343     switch (paramType)
5344     {
5345       case ADDUSERPARAMTYPE_DISPOSITION :
5346       case ADDUSERPARAMTYPE_ACCESSALWAYS :
5347       case ADDUSERPARAMTYPE_ACCESSMODE :
5348       case ADDUSERPARAMTYPE_CACHED :
5349       case ADDUSERPARAMTYPE_USERTYPE :
5350       case ADDUSERPARAMTYPE_PRIMARYFIELDTYPE :
5351       case ADDUSERPARAMTYPE_AUXFIELDTYPE :
5352       case ADDUSERPARAMTYPE_USECOUNT :
5353       case ADDUSERPARAMTYPE_EXCEPTIONGROUP :
5354         if (dataLength != 1)
5355         {
5356           expert_add_info_format(pinfo, proto_tree_get_parent (mu_tree), &ei_r3_malformed_length, "Malformed field -- expected 1 octet");
5357         }
5358         else
5359           proto_tree_add_item (mu_tree, hf_r3_adduserparamtypearray [paramType], payload_tvb, offset, dataLength, ENC_LITTLE_ENDIAN);
5360         break;
5361 
5362       case ADDUSERPARAMTYPE_USERNO :
5363         if (dataLength != 2)
5364         {
5365           expert_add_info_format(pinfo, proto_tree_get_parent (mu_tree), &ei_r3_malformed_length, "Malformed field -- expected 2 octets");
5366         }
5367         else
5368           proto_tree_add_item (mu_tree, hf_r3_adduserparamtypearray [paramType], payload_tvb, offset, dataLength, ENC_LITTLE_ENDIAN);
5369         break;
5370 
5371       case ADDUSERPARAMTYPE_PRIMARYFIELD :
5372       case ADDUSERPARAMTYPE_AUXFIELD :
5373         proto_tree_add_item (mu_tree, hf_r3_adduserparamtypearray [paramType], payload_tvb, offset, dataLength, ENC_NA);
5374         break;
5375 
5376       case ADDUSERPARAMTYPE_EXPIREON :
5377         {
5378           if (dataLength != 3)
5379           {
5380             expert_add_info_format(pinfo, proto_tree_get_parent (mu_tree), &ei_r3_malformed_length, "Malformed expiration field -- expected 3 octets");
5381           }
5382           else
5383           {
5384             proto_tree *expireon_tree;
5385 
5386             if (!tree)
5387               break;
5388 
5389             expireon_tree = proto_tree_add_subtree_format(mu_tree, payload_tvb, offset, 3,
5390                                                  ett_r3expireon, NULL,
5391                                                  "Expire YY/MM/DD: %02u/%02u/%02u",
5392                                                  tvb_get_guint8 (payload_tvb, offset + 2),
5393                                                  tvb_get_guint8 (payload_tvb, offset + 0),
5394                                                  tvb_get_guint8 (payload_tvb, offset + 1));
5395 
5396             proto_tree_add_item (expireon_tree, hf_r3_expireon_month, payload_tvb, offset + 0, 1, ENC_LITTLE_ENDIAN);
5397             proto_tree_add_item (expireon_tree, hf_r3_expireon_day,   payload_tvb, offset + 1, 1, ENC_LITTLE_ENDIAN);
5398             proto_tree_add_item (expireon_tree, hf_r3_expireon_year,  payload_tvb, offset + 2, 1, ENC_LITTLE_ENDIAN);
5399           }
5400         }
5401         break;
5402 
5403       case ADDUSERPARAMTYPE_TIMEZONE :
5404         {
5405           if (dataLength != 4)
5406           {
5407             expert_add_info_format(pinfo, proto_tree_get_parent (mu_tree), &ei_r3_malformed_length, "Malformed timezone field -- expected 4 octets");
5408           }
5409           else
5410           {
5411             proto_tree_add_bitmask(mu_tree, payload_tvb, offset, hf_r3_adduserparamtypearray[paramType], ett_r3timezone, r3_timezonearray, ENC_LITTLE_ENDIAN);
5412           }
5413         }
5414         break;
5415 
5416       default :
5417         proto_tree_add_none_format (mu_tree, hf_r3_upstreamfielderror, payload_tvb, offset, dataLength, "Unknown Field Type");
5418         break;
5419     }
5420 
5421     offset += dataLength;
5422   }
5423 }
5424 
5425 static void
dissect_r3_cmd_deleteusers(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)5426 dissect_r3_cmd_deleteusers (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
5427 {
5428   guint8    cmdLen;
5429   tvbuff_t *payload_tvb;
5430 
5431   if (!tree)
5432     return;
5433 
5434   cmdLen      = tvb_get_guint8 (tvb, start_offset + 0);
5435   payload_tvb = tvb_new_subset_length (tvb, start_offset + 2, cmdLen - 2);
5436 
5437   proto_tree_add_item (tree, hf_r3_commandlength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
5438   proto_tree_add_item (tree, hf_r3_command,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
5439 
5440   proto_tree_add_item (tree, hf_r3_deleteusers, payload_tvb, 0, 1, ENC_LITTLE_ENDIAN);
5441 }
5442 
5443 static void
dissect_r3_cmd_defineexception(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)5444 dissect_r3_cmd_defineexception (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
5445 {
5446   proto_tree *startdate_tree;
5447   proto_tree *enddate_tree;
5448   guint8      cmdLen;
5449   tvbuff_t   *payload_tvb;
5450 
5451   if (!tree)
5452     return;
5453 
5454   cmdLen      = tvb_get_guint8 (tvb, start_offset + 0);
5455   payload_tvb = tvb_new_subset_length (tvb, start_offset + 2, cmdLen - 2);
5456 
5457   proto_tree_add_item (tree, hf_r3_commandlength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
5458   proto_tree_add_item (tree, hf_r3_command,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
5459 
5460   proto_tree_add_item (tree, hf_r3_defineexception_number, payload_tvb, 0, 1, ENC_LITTLE_ENDIAN);
5461 
5462   startdate_tree = proto_tree_add_subtree_format(tree, payload_tvb, 1, 4,
5463                                         ett_r3defineexceptionstartdate, NULL,
5464                                         "Start MM/DD HH:MM (%02u/%02u %02u:%02u)",
5465                                         tvb_get_guint8 (payload_tvb, 1),
5466                                         tvb_get_guint8 (payload_tvb, 2),
5467                                         tvb_get_guint8 (payload_tvb, 3),
5468                                         tvb_get_guint8 (payload_tvb, 4));
5469   proto_tree_add_item (startdate_tree, hf_r3_defineexception_startdate_month,   payload_tvb, 1, 1, ENC_LITTLE_ENDIAN);
5470   proto_tree_add_item (startdate_tree, hf_r3_defineexception_startdate_day,     payload_tvb, 2, 1, ENC_LITTLE_ENDIAN);
5471   proto_tree_add_item (startdate_tree, hf_r3_defineexception_startdate_hours,   payload_tvb, 3, 1, ENC_LITTLE_ENDIAN);
5472   proto_tree_add_item (startdate_tree, hf_r3_defineexception_startdate_minutes, payload_tvb, 4, 1, ENC_LITTLE_ENDIAN);
5473 
5474   enddate_tree = proto_tree_add_subtree_format(tree, payload_tvb, 5, 4,
5475                                         ett_r3defineexceptionenddate, NULL,
5476                                       "End MM/DD HH:MM (%02u/%02u %02u:%02u)",
5477                                       tvb_get_guint8 (payload_tvb, 5),
5478                                       tvb_get_guint8 (payload_tvb, 6),
5479                                       tvb_get_guint8 (payload_tvb, 7),
5480                                       tvb_get_guint8 (payload_tvb, 8));
5481   proto_tree_add_item (enddate_tree, hf_r3_defineexception_enddate_month,   payload_tvb, 5, 1, ENC_LITTLE_ENDIAN);
5482   proto_tree_add_item (enddate_tree, hf_r3_defineexception_enddate_day,     payload_tvb, 6, 1, ENC_LITTLE_ENDIAN);
5483   proto_tree_add_item (enddate_tree, hf_r3_defineexception_enddate_hours,   payload_tvb, 7, 1, ENC_LITTLE_ENDIAN);
5484   proto_tree_add_item (enddate_tree, hf_r3_defineexception_enddate_minutes, payload_tvb, 8, 1, ENC_LITTLE_ENDIAN);
5485 }
5486 
5487 static void
dissect_r3_cmd_defineexceptiongroup(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)5488 dissect_r3_cmd_defineexceptiongroup (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
5489 {
5490   proto_tree *bits_tree;
5491   guint       cmdLen;
5492   tvbuff_t   *payload_tvb;
5493   guint32     i;
5494   guint32     bit = 0;
5495 
5496   if (!tree)
5497     return;
5498 
5499   cmdLen      = tvb_get_guint8 (tvb, start_offset + 0);
5500   payload_tvb = tvb_new_subset_length (tvb, start_offset + 2, cmdLen - 2);
5501 
5502   proto_tree_add_item (tree, hf_r3_commandlength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
5503   proto_tree_add_item (tree, hf_r3_command,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
5504 
5505   proto_tree_add_item (tree, hf_r3_defineexceptiongroup_number, payload_tvb, 0, 1, ENC_LITTLE_ENDIAN);
5506 
5507   bits_tree = proto_tree_add_subtree(tree, payload_tvb, 1, -1, ett_r3defineexceptiongroupbits, NULL, "Exception Group Bit Field");
5508 
5509   for (i = 1; i < (cmdLen - 2); i++)
5510   {
5511     guint32 j;
5512     guint8  byte = tvb_get_guint8 (payload_tvb, i);
5513 
5514     for (j = 0; j < 8; j++)
5515       proto_tree_add_none_format (bits_tree, hf_r3_defineexceptiongroup_bits, payload_tvb, i, 1,
5516                                   "Exception Group %2d: %s", bit++, (byte & (1 << j)) ? "Enabled" : "Disabled");
5517   }
5518 }
5519 
5520 static void
dissect_r3_cmd_definecalendar(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)5521 dissect_r3_cmd_definecalendar (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
5522 {
5523   guint8       cmdLen;
5524   tvbuff_t    *payload_tvb;
5525   const gchar *mn;
5526   guint32      i;
5527 
5528   if (!tree)
5529     return;
5530 
5531   cmdLen      = tvb_get_guint8 (tvb, start_offset + 0);
5532   payload_tvb = tvb_new_subset_length (tvb, start_offset + 2, cmdLen - 2);
5533 
5534   proto_tree_add_item (tree, hf_r3_commandlength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
5535   proto_tree_add_item (tree, hf_r3_command,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
5536 
5537   proto_tree_add_item (tree, hf_r3_definecalendar_number, payload_tvb, 0, 1, ENC_LITTLE_ENDIAN);
5538 
5539   for (i = 0; i < 12; i++)
5540   {
5541     guint32     daymap = tvb_get_letohl (payload_tvb, (i * 4) + 1);
5542     proto_tree *calendar_tree = proto_tree_add_subtree_format(tree, payload_tvb, (i * 4) + 1, 4,
5543                                                      ett_r3definecalendarmonth [i + 1], NULL,
5544                                                      "Calendar Bit Field - %s (0x%08x)",
5545                                                      (mn = val_to_str_ext_const (i + 1, &r3_monthnames_ext, "[Unknown Month]")),
5546                                                      daymap);
5547     guint32     j;
5548 
5549     for (j = 0; j < 31; j++)
5550       proto_tree_add_none_format (calendar_tree, hf_r3_definecalendar_bits, payload_tvb, (i * 4) + 1, 4,
5551                                   "%s Of %s: %s",
5552                                   val_to_str_ext_const (j + 1, &r3_monthdaynames_ext, "[Unknown Day]"),
5553                                   mn,
5554                                   (daymap & (1 << j)) ? "Enabled" : "Disabled");
5555   }
5556 }
5557 
5558 static void
dissect_r3_cmd_definetimezone(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)5559 dissect_r3_cmd_definetimezone (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
5560 {
5561   proto_tree *starttime_tree;
5562   proto_tree *endtime_tree;
5563   guint8      cmdLen;
5564   tvbuff_t   *payload_tvb;
5565   guint8      tzmode;
5566 
5567   if (!tree)
5568     return;
5569 
5570   cmdLen      = tvb_get_guint8 (tvb, start_offset + 0);
5571   payload_tvb = tvb_new_subset_length (tvb, start_offset + 2, cmdLen - 2);
5572 
5573   proto_tree_add_item (tree, hf_r3_commandlength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
5574   proto_tree_add_item (tree, hf_r3_command,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
5575 
5576   proto_tree_add_item (tree, hf_r3_definetimezone_number, payload_tvb, 0, 1, ENC_LITTLE_ENDIAN);
5577 
5578   starttime_tree = proto_tree_add_subtree_format(tree, payload_tvb, 1, 2,
5579                                         ett_r3definetimezonestarttime, NULL,
5580                                         "Start HH:MM (%02u:%02u)",
5581                                         tvb_get_guint8 (payload_tvb, 1),
5582                                         tvb_get_guint8 (payload_tvb, 2));
5583   proto_tree_add_item (starttime_tree, hf_r3_definetimezone_starttime_hours,   payload_tvb, 1, 1, ENC_LITTLE_ENDIAN);
5584   proto_tree_add_item (starttime_tree, hf_r3_definetimezone_starttime_minutes, payload_tvb, 2, 1, ENC_LITTLE_ENDIAN);
5585 
5586   endtime_tree = proto_tree_add_subtree_format(tree, payload_tvb, 3, 2,
5587                                       ett_r3definetimezoneendtime, NULL,
5588                                       "End HH:MM (%02u:%02u)",
5589                                       tvb_get_guint8 (payload_tvb, 3),
5590                                       tvb_get_guint8 (payload_tvb, 4));
5591   proto_tree_add_item (endtime_tree, hf_r3_definetimezone_endtime_hours,   payload_tvb, 3, 1, ENC_LITTLE_ENDIAN);
5592   proto_tree_add_item (endtime_tree, hf_r3_definetimezone_endtime_minutes, payload_tvb, 4, 1, ENC_LITTLE_ENDIAN);
5593 
5594   proto_tree_add_bitmask(tree, payload_tvb, 5, hf_r3_definetimezone_daymap, ett_r3definetimezonedaymap, r3_definetimezone_daymap, ENC_NA);
5595 
5596   proto_tree_add_item (tree, hf_r3_definetimezone_exceptiongroup, payload_tvb, 6, 1, ENC_LITTLE_ENDIAN);
5597   proto_tree_add_uint (tree, hf_r3_definetimezone_mode, payload_tvb, 7, 1,
5598                        (tzmode = tvb_get_guint8 (payload_tvb, 7)) & 0x0f);
5599   proto_tree_add_none_format (tree, hf_r3_definetimezone_calendar, payload_tvb, 7, 1,
5600                               "Access Always: %s", (tzmode & 0x10) ? "True" : "False");
5601 }
5602 
5603 static void
dissect_r3_cmd_rmtauthretry(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)5604 dissect_r3_cmd_rmtauthretry (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
5605 {
5606   guint8    cmdLen;
5607   tvbuff_t *payload_tvb;
5608 
5609   if (!tree)
5610     return;
5611 
5612   cmdLen      = tvb_get_guint8 (tvb, start_offset + 0);
5613   payload_tvb = tvb_new_subset_length (tvb, start_offset + 2, cmdLen - 2);
5614 
5615   proto_tree_add_item (tree, hf_r3_commandlength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
5616   proto_tree_add_item (tree, hf_r3_command,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
5617 
5618   proto_tree_add_item (tree, hf_r3_rmtauthretry_sequence, payload_tvb, 0, 2, ENC_LITTLE_ENDIAN);
5619   proto_tree_add_item (tree, hf_r3_rmtauthretry_retry,    payload_tvb, 2, 1, ENC_LITTLE_ENDIAN);
5620 }
5621 
5622 static void
dissect_r3_cmd_filters(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)5623 dissect_r3_cmd_filters (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
5624 {
5625   proto_tree *filter_tree;
5626   guint8      cmdLen;
5627   tvbuff_t   *payload_tvb;
5628   guint32     i;
5629 
5630   if (!tree)
5631     return;
5632 
5633   cmdLen      = tvb_get_guint8 (tvb, start_offset + 0);
5634   payload_tvb = tvb_new_subset_length (tvb, start_offset + 2, cmdLen - 2);
5635 
5636   proto_tree_add_item (tree, hf_r3_commandlength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
5637   proto_tree_add_item (tree, hf_r3_command,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
5638 
5639   proto_tree_add_item (tree, hf_r3_filter_type, payload_tvb, 1, 1, ENC_LITTLE_ENDIAN);
5640 
5641   filter_tree = proto_tree_add_subtree_format(tree, payload_tvb, 2, -1, ett_r3filters, NULL,
5642                                      "Filters (%u specified)", tvb_get_guint8 (payload_tvb, 0));
5643 
5644   for (i = 0; i < tvb_get_guint8 (payload_tvb, 0); i++)
5645     proto_tree_add_item (filter_tree, hf_r3_filter_list, payload_tvb, i + 2, 1, ENC_LITTLE_ENDIAN);
5646 }
5647 
5648 static void
dissect_r3_cmd_alarmconfigure(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo,proto_tree * tree)5649 dissect_r3_cmd_alarmconfigure (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo, proto_tree *tree)
5650 {
5651   proto_item *alarm_item;
5652   proto_tree *alarm_tree;
5653   guint       cmdLen;
5654   tvbuff_t   *payload_tvb;
5655   guint32     offset = 0;
5656   guint32     alarms = 0;
5657 
5658   if (!tree)
5659     return;
5660 
5661   cmdLen      = tvb_get_guint8 (tvb, start_offset + 0);
5662   payload_tvb = tvb_new_subset_length (tvb, start_offset + 2, cmdLen - 2);
5663 
5664   proto_tree_add_item (tree, hf_r3_commandlength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
5665   proto_tree_add_item (tree, hf_r3_command,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
5666 
5667   alarm_tree = proto_tree_add_subtree(tree, payload_tvb, 0, -1, ett_r3alarmlist, &alarm_item, "Alarm List (0 items)");
5668 
5669   while (offset < (cmdLen - 2))
5670   {
5671     proto_item  *pi;
5672     proto_tree  *alarmcfg_tree;
5673     const gchar *ai;
5674     const gchar *as;
5675     guint32 alarm_len;
5676 
5677     if (!(ai = try_val_to_str_ext (tvb_get_guint8 (payload_tvb, offset + 1), &r3_alarmidnames_ext)))
5678     {
5679       ai = "[Unknown Alarm ID]";
5680       as = "N/A";
5681     }
5682     else
5683       as = (tvb_get_guint8 (payload_tvb, offset + 2) & 0xfe) ?
5684         "Error" : (tvb_get_guint8 (payload_tvb, offset + 2) & 0x01) ? "Enabled" : "Disabled";
5685 
5686     alarmcfg_tree = proto_tree_add_subtree_format(alarm_tree, payload_tvb, offset, tvb_get_guint8 (payload_tvb, offset),
5687                                          ett_r3alarmcfg, NULL, "Alarm Item (%s, %s)", ai, as);
5688 
5689     alarm_len = tvb_get_guint8 (payload_tvb, offset + 0);
5690     pi = proto_tree_add_item (alarmcfg_tree, hf_r3_alarm_length, payload_tvb, offset + 0, 1, ENC_LITTLE_ENDIAN);
5691     if (alarm_len == 0) {
5692       expert_add_info_format (pinfo, pi, &ei_r3_malformed_length,
5693                               "Alarm length equal to 0. Payload could be partially decoded");
5694       break;
5695     }
5696 
5697     proto_tree_add_item (alarmcfg_tree, hf_r3_alarm_id,     payload_tvb, offset + 1, 1, ENC_LITTLE_ENDIAN);
5698     proto_tree_add_item (alarmcfg_tree, hf_r3_alarm_state,  payload_tvb, offset + 2, 1, ENC_LITTLE_ENDIAN);
5699 
5700     alarms++;
5701     offset += alarm_len;
5702   }
5703 
5704   if (alarms)
5705     proto_item_set_text (alarm_item, "Alarm List (%d items)", alarms);
5706 }
5707 
5708 static void
dissect_r3_cmd_eventlogdump(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)5709 dissect_r3_cmd_eventlogdump (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
5710 {
5711   proto_tree *starttime_tree;
5712   proto_tree *endtime_tree;
5713   guint8      cmdLen;
5714   tvbuff_t   *payload_tvb;
5715 
5716   if (!tree)
5717     return;
5718 
5719   cmdLen      = tvb_get_guint8 (tvb, start_offset + 0);
5720   payload_tvb = tvb_new_subset_length (tvb, start_offset + 2, cmdLen - 2);
5721 
5722   proto_tree_add_item (tree, hf_r3_commandlength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
5723   proto_tree_add_item (tree, hf_r3_command,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
5724 
5725   starttime_tree = proto_tree_add_subtree_format(tree, payload_tvb, 0, 5,
5726                                         ett_r3eventlogdumpstarttime, NULL,
5727                                         "Start YY/MM/DD HH:MM (%02u/%02u/%02u %02u:%02u)",
5728                                         tvb_get_guint8 (payload_tvb, 0),
5729                                         tvb_get_guint8 (payload_tvb, 1),
5730                                         tvb_get_guint8 (payload_tvb, 2),
5731                                         tvb_get_guint8 (payload_tvb, 3),
5732                                         tvb_get_guint8 (payload_tvb, 4));
5733   proto_tree_add_item (starttime_tree, hf_r3_eventlogdump_starttime_year,    payload_tvb, 0, 1, ENC_LITTLE_ENDIAN);
5734   proto_tree_add_item (starttime_tree, hf_r3_eventlogdump_starttime_month,   payload_tvb, 1, 1, ENC_LITTLE_ENDIAN);
5735   proto_tree_add_item (starttime_tree, hf_r3_eventlogdump_starttime_day,     payload_tvb, 2, 1, ENC_LITTLE_ENDIAN);
5736   proto_tree_add_item (starttime_tree, hf_r3_eventlogdump_starttime_hours,   payload_tvb, 3, 1, ENC_LITTLE_ENDIAN);
5737   proto_tree_add_item (starttime_tree, hf_r3_eventlogdump_starttime_minutes, payload_tvb, 4, 1, ENC_LITTLE_ENDIAN);
5738 
5739   endtime_tree = proto_tree_add_subtree_format(tree, payload_tvb, 5, 5,
5740                                       ett_r3eventlogdumpendtime, NULL,
5741                                       "End YY/MM/DD HH:MM (%02u/%02u/%02u %02u:%02u)",
5742                                       tvb_get_guint8 (payload_tvb, 5),
5743                                       tvb_get_guint8 (payload_tvb, 6),
5744                                       tvb_get_guint8 (payload_tvb, 7),
5745                                       tvb_get_guint8 (payload_tvb, 8),
5746                                       tvb_get_guint8 (payload_tvb, 9));
5747   proto_tree_add_item (endtime_tree, hf_r3_eventlogdump_endtime_year,    payload_tvb, 5, 1, ENC_LITTLE_ENDIAN);
5748   proto_tree_add_item (endtime_tree, hf_r3_eventlogdump_endtime_month,   payload_tvb, 6, 1, ENC_LITTLE_ENDIAN);
5749   proto_tree_add_item (endtime_tree, hf_r3_eventlogdump_endtime_day,     payload_tvb, 7, 1, ENC_LITTLE_ENDIAN);
5750   proto_tree_add_item (endtime_tree, hf_r3_eventlogdump_endtime_hours,   payload_tvb, 8, 1, ENC_LITTLE_ENDIAN);
5751   proto_tree_add_item (endtime_tree, hf_r3_eventlogdump_endtime_minutes, payload_tvb, 9, 1, ENC_LITTLE_ENDIAN);
5752 
5753   proto_tree_add_item (tree, hf_r3_eventlogdump_user, payload_tvb, 10, 2, ENC_LITTLE_ENDIAN);
5754 }
5755 
5756 static void
dissect_r3_cmd_declinedlogdump(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)5757 dissect_r3_cmd_declinedlogdump (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
5758 {
5759   proto_tree *starttime_tree;
5760   proto_tree *endtime_tree;
5761   guint8      cmdLen;
5762   tvbuff_t   *payload_tvb;
5763 
5764   if (!tree)
5765     return;
5766 
5767   cmdLen      = tvb_get_guint8 (tvb, start_offset + 0);
5768   payload_tvb = tvb_new_subset_length (tvb, start_offset + 2, cmdLen - 2);
5769 
5770   proto_tree_add_item (tree, hf_r3_commandlength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
5771   proto_tree_add_item (tree, hf_r3_command,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
5772 
5773   starttime_tree = proto_tree_add_subtree_format(tree, payload_tvb, 0, 5,
5774                                         ett_r3declinedlogdumpstarttime, NULL,
5775                                         "Start YY/MM/DD HH:MM (%02u/%02u/%02u %02u:%02u)",
5776                                         tvb_get_guint8 (payload_tvb, 0),
5777                                         tvb_get_guint8 (payload_tvb, 1),
5778                                         tvb_get_guint8 (payload_tvb, 2),
5779                                         tvb_get_guint8 (payload_tvb, 3),
5780                                         tvb_get_guint8 (payload_tvb, 4));
5781   proto_tree_add_item (starttime_tree, hf_r3_declinedlogdump_starttime_year,    payload_tvb, 0, 1, ENC_LITTLE_ENDIAN);
5782   proto_tree_add_item (starttime_tree, hf_r3_declinedlogdump_starttime_month,   payload_tvb, 1, 1, ENC_LITTLE_ENDIAN);
5783   proto_tree_add_item (starttime_tree, hf_r3_declinedlogdump_starttime_day,     payload_tvb, 2, 1, ENC_LITTLE_ENDIAN);
5784   proto_tree_add_item (starttime_tree, hf_r3_declinedlogdump_starttime_hours,   payload_tvb, 3, 1, ENC_LITTLE_ENDIAN);
5785   proto_tree_add_item (starttime_tree, hf_r3_declinedlogdump_starttime_minutes, payload_tvb, 4, 1, ENC_LITTLE_ENDIAN);
5786 
5787   endtime_tree = proto_tree_add_subtree_format(tree, payload_tvb, 5, 5,
5788                                       ett_r3declinedlogdumpendtime, NULL,
5789                                       "End YY/MM/DD HH:MM (%02u/%02u/%02u %02u:%02u)",
5790                                       tvb_get_guint8 (payload_tvb, 5),
5791                                       tvb_get_guint8 (payload_tvb, 6),
5792                                       tvb_get_guint8 (payload_tvb, 7),
5793                                       tvb_get_guint8 (payload_tvb, 8),
5794                                       tvb_get_guint8 (payload_tvb, 9));
5795   proto_tree_add_item (endtime_tree, hf_r3_declinedlogdump_endtime_year,    payload_tvb, 5, 1, ENC_LITTLE_ENDIAN);
5796   proto_tree_add_item (endtime_tree, hf_r3_declinedlogdump_endtime_month,   payload_tvb, 6, 1, ENC_LITTLE_ENDIAN);
5797   proto_tree_add_item (endtime_tree, hf_r3_declinedlogdump_endtime_day,     payload_tvb, 7, 1, ENC_LITTLE_ENDIAN);
5798   proto_tree_add_item (endtime_tree, hf_r3_declinedlogdump_endtime_hours,   payload_tvb, 8, 1, ENC_LITTLE_ENDIAN);
5799   proto_tree_add_item (endtime_tree, hf_r3_declinedlogdump_endtime_minutes, payload_tvb, 9, 1, ENC_LITTLE_ENDIAN);
5800 }
5801 
5802 static void
dissect_r3_cmd_alarmlogdump(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)5803 dissect_r3_cmd_alarmlogdump (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
5804 {
5805   proto_tree *starttime_tree;
5806   proto_tree *endtime_tree;
5807   guint8      cmdLen;
5808   tvbuff_t   *payload_tvb;
5809 
5810   if (!tree)
5811     return;
5812 
5813   cmdLen      = tvb_get_guint8 (tvb, start_offset + 0);
5814   payload_tvb = tvb_new_subset_length (tvb, start_offset + 2, cmdLen - 2);
5815 
5816   proto_tree_add_item (tree, hf_r3_commandlength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
5817   proto_tree_add_item (tree, hf_r3_command,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
5818 
5819   starttime_tree = proto_tree_add_subtree_format(tree, payload_tvb, 0, 5,
5820                                         ett_r3alarmlogdumpstarttime, NULL,
5821                                         "Start YY/MM/DD HH:MM (%02u/%02u/%02u %02u:%02u)",
5822                                         tvb_get_guint8 (payload_tvb, 0),
5823                                         tvb_get_guint8 (payload_tvb, 1),
5824                                         tvb_get_guint8 (payload_tvb, 2),
5825                                         tvb_get_guint8 (payload_tvb, 3),
5826                                         tvb_get_guint8 (payload_tvb, 4));
5827   proto_tree_add_item (starttime_tree, hf_r3_alarmlogdump_starttime_year,    payload_tvb, 0, 1, ENC_LITTLE_ENDIAN);
5828   proto_tree_add_item (starttime_tree, hf_r3_alarmlogdump_starttime_month,   payload_tvb, 1, 1, ENC_LITTLE_ENDIAN);
5829   proto_tree_add_item (starttime_tree, hf_r3_alarmlogdump_starttime_day,     payload_tvb, 2, 1, ENC_LITTLE_ENDIAN);
5830   proto_tree_add_item (starttime_tree, hf_r3_alarmlogdump_starttime_hours,   payload_tvb, 3, 1, ENC_LITTLE_ENDIAN);
5831   proto_tree_add_item (starttime_tree, hf_r3_alarmlogdump_starttime_minutes, payload_tvb, 4, 1, ENC_LITTLE_ENDIAN);
5832 
5833   endtime_tree = proto_tree_add_subtree_format(tree, payload_tvb, 5, 5,
5834                                       ett_r3alarmlogdumpendtime, NULL,
5835                                       "End YY/MM/DD HH:MM (%02u/%02u/%02u %02u:%02u)",
5836                                       tvb_get_guint8 (payload_tvb, 5),
5837                                       tvb_get_guint8 (payload_tvb, 6),
5838                                       tvb_get_guint8 (payload_tvb, 7),
5839                                       tvb_get_guint8 (payload_tvb, 8),
5840                                       tvb_get_guint8 (payload_tvb, 9));
5841   proto_tree_add_item (endtime_tree, hf_r3_alarmlogdump_endtime_year,    payload_tvb, 5, 1, ENC_LITTLE_ENDIAN);
5842   proto_tree_add_item (endtime_tree, hf_r3_alarmlogdump_endtime_month,   payload_tvb, 6, 1, ENC_LITTLE_ENDIAN);
5843   proto_tree_add_item (endtime_tree, hf_r3_alarmlogdump_endtime_day,     payload_tvb, 7, 1, ENC_LITTLE_ENDIAN);
5844   proto_tree_add_item (endtime_tree, hf_r3_alarmlogdump_endtime_hours,   payload_tvb, 8, 1, ENC_LITTLE_ENDIAN);
5845   proto_tree_add_item (endtime_tree, hf_r3_alarmlogdump_endtime_minutes, payload_tvb, 9, 1, ENC_LITTLE_ENDIAN);
5846 }
5847 
5848 static void
dissect_r3_cmd_downloadfirmware(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo,proto_tree * tree)5849 dissect_r3_cmd_downloadfirmware (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo, proto_tree *tree)
5850 {
5851   proto_item *dlfw_item = NULL;
5852   proto_item *dlfw_action_item = NULL;
5853   proto_tree *dlfw_tree = NULL;
5854   guint8      cmdLen;
5855   tvbuff_t   *payload_tvb;
5856   guint32     packetCRC;
5857   guint32     calculatedCRC;
5858 
5859   cmdLen      = tvb_get_guint8 (tvb, start_offset + 0);
5860   payload_tvb = tvb_new_subset_length (tvb, start_offset + 2, cmdLen - 2);
5861 
5862   if (tree)
5863   {
5864     proto_tree_add_item (tree, hf_r3_commandlength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
5865     proto_tree_add_item (tree, hf_r3_command,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
5866 
5867     dlfw_tree = proto_tree_add_subtree_format(tree, payload_tvb, 0, -1, ett_r3downloadfirmware, &dlfw_item,
5868                                      "Download Record (Record #%u, ", tvb_get_letohs (payload_tvb, 2));
5869 
5870     proto_tree_add_item (dlfw_tree, hf_r3_firmwaredownload_length, payload_tvb, 0, 2, ENC_LITTLE_ENDIAN);
5871     proto_tree_add_item (dlfw_tree, hf_r3_firmwaredownload_record, payload_tvb, 2, 2, ENC_LITTLE_ENDIAN);
5872     dlfw_action_item = proto_tree_add_item (dlfw_tree, hf_r3_firmwaredownload_action, payload_tvb, 4, 1, ENC_LITTLE_ENDIAN);
5873   }
5874 
5875   switch (tvb_get_guint8 (payload_tvb, 4))
5876   {
5877     case DOWNLOADFIRMWARE_START :
5878       if (!dlfw_tree)
5879         break;
5880       proto_item_append_text (dlfw_item, "DOWNLOADFIRMWARE_START)");
5881       proto_tree_add_item (dlfw_tree, hf_r3_firmwaredownload_timeout, payload_tvb, 5, 1, ENC_LITTLE_ENDIAN);
5882       proto_tree_add_item (dlfw_tree, hf_r3_firmwaredownload_nvram,   payload_tvb, 6, 1, ENC_LITTLE_ENDIAN);
5883       break;
5884 
5885     case DOWNLOADFIRMWARE_DATA :
5886       if (!dlfw_tree)
5887         break;
5888       proto_item_append_text (dlfw_item, "DOWNLOADFIRMWARE_DATA, Address 0x%08x, %u Bytes)",
5889                               tvb_get_letohl (payload_tvb, 5), tvb_get_guint8 (payload_tvb, 9));
5890       proto_tree_add_item (dlfw_tree, hf_r3_firmwaredownload_address, payload_tvb, 5, 4, ENC_LITTLE_ENDIAN);
5891       proto_tree_add_item (dlfw_tree, hf_r3_firmwaredownload_bytes,   payload_tvb, 9, 1, ENC_LITTLE_ENDIAN);
5892       proto_tree_add_item (dlfw_tree, hf_r3_firmwaredownload_data,    payload_tvb, 10,
5893                            tvb_get_guint8 (payload_tvb, 9), ENC_NA);
5894       break;
5895 
5896     case DOWNLOADFIRMWARE_COMPLETE :
5897       if (!dlfw_tree)
5898         break;
5899       proto_item_append_text (dlfw_item, "DOWNLOADFIRMWARE_COMPLETE)");
5900       break;
5901 
5902     case DOWNLOADFIRMWARE_ABORT :
5903       if (!dlfw_tree)
5904         break;
5905       proto_item_append_text (dlfw_item, "DOWNLOADFIRMWARE_ABORT)");
5906       break;
5907 
5908     case DOWNLOADFIRMWARE_RESET :
5909       if (!dlfw_tree)
5910         break;
5911       proto_item_append_text (dlfw_item, "DOWNLOADFIRMWARE_RESET)");
5912       break;
5913 
5914     default :
5915       expert_add_info(pinfo, dlfw_action_item, &ei_r3_firmwaredownload_action);
5916       return;  /* quit */
5917   }
5918 
5919   if (!dlfw_tree)
5920     return;
5921 
5922   packetCRC = tvb_get_letohs (payload_tvb, cmdLen - 2 - 2);
5923 
5924   if ((calculatedCRC = crc16_r3_ccitt_tvb(payload_tvb, 0, cmdLen - 2 - 2)) == packetCRC)
5925     proto_tree_add_uint_format_value(dlfw_tree, hf_r3_firmwaredownload_crc, payload_tvb,
5926                                 cmdLen - 2 - 2, 2,
5927                                 packetCRC, "0x%04x (correct)", packetCRC);
5928   else
5929   {
5930     proto_item *tmp_item;
5931 
5932     proto_tree_add_uint_format_value(dlfw_tree, hf_r3_firmwaredownload_crc, payload_tvb,
5933                                 cmdLen - 2 - 2, 2,
5934                                 packetCRC, "0x%04x (incorrect, should be 0x%04x)", calculatedCRC, packetCRC);
5935     tmp_item = proto_tree_add_boolean (dlfw_tree, hf_r3_firmwaredownload_crc_bad, payload_tvb,
5936                                        cmdLen - 2 - 2, 2, TRUE);
5937     proto_item_set_generated (tmp_item);
5938   }
5939 }
5940 
5941 static void
dissect_r3_cmd_downloadfirmwaretimeout(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo,proto_tree * tree)5942 dissect_r3_cmd_downloadfirmwaretimeout (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo, proto_tree *tree)
5943 {
5944   guint8    cmdLen;
5945   tvbuff_t *payload_tvb;
5946 
5947   if (tree)
5948   {
5949     cmdLen      = tvb_get_guint8 (tvb, start_offset + 0);
5950     payload_tvb = tvb_new_subset_length (tvb, start_offset + 2, cmdLen - 2);
5951 
5952     proto_tree_add_item (tree, hf_r3_commandlength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
5953     proto_tree_add_item (tree, hf_r3_command,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
5954 
5955     proto_tree_add_item (tree, hf_r3_commanddata, payload_tvb, 0, -1, ENC_NA);
5956   }
5957   expert_add_info(pinfo, proto_tree_get_parent (tree), &ei_r3_cmd_downloadfirmwaretimeout); /* XXX: ??? */
5958 }
5959 
5960 static void
dissect_r3_cmd_powertableselection(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)5961 dissect_r3_cmd_powertableselection (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
5962 {
5963   guint8    cmdLen;
5964   tvbuff_t *payload_tvb;
5965 
5966   if (!tree)
5967     return;
5968 
5969   cmdLen      = tvb_get_guint8 (tvb, start_offset + 0);
5970   payload_tvb = tvb_new_subset_length (tvb, start_offset + 2, cmdLen - 2);
5971 
5972   proto_tree_add_item (tree, hf_r3_commandlength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
5973   proto_tree_add_item (tree, hf_r3_command,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
5974 
5975   proto_tree_add_item (tree, hf_r3_powertableselection, payload_tvb, 0, 1, ENC_LITTLE_ENDIAN);
5976 }
5977 
5978 static void
dissect_r3_cmd_clearnvram(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)5979 dissect_r3_cmd_clearnvram (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
5980 {
5981   proto_tree_add_item (tree, hf_r3_commandlength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
5982   proto_tree_add_item (tree, hf_r3_command,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
5983   proto_tree_add_bitmask(tree, tvb, start_offset + 2, hf_r3_nvramclearoptions,
5984                          ett_r3clearnvram, r3_nvramclearoptions, ENC_LITTLE_ENDIAN);
5985 }
5986 
5987 static void
dissect_r3_cmd_dpac(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)5988 dissect_r3_cmd_dpac (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
5989 {
5990   guint8    cmdLen;
5991   tvbuff_t *payload_tvb;
5992 
5993   if (!tree)
5994     return;
5995 
5996   cmdLen      = tvb_get_guint8 (tvb, start_offset + 0);
5997   payload_tvb = tvb_new_subset_length (tvb, start_offset + 2, cmdLen - 2);
5998 
5999   proto_tree_add_item (tree, hf_r3_commandlength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
6000   proto_tree_add_item (tree, hf_r3_command,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
6001 
6002   /* XXX: hf[] entries for the following hf indexes originally missing */
6003   proto_tree_add_item (tree, hf_r3_dpac_action,   payload_tvb, 0, 1, ENC_LITTLE_ENDIAN);
6004   proto_tree_add_item (tree, hf_r3_dpac_waittime, payload_tvb, 1, 2, ENC_LITTLE_ENDIAN);
6005   proto_tree_add_item (tree, hf_r3_dpac_command,  payload_tvb, 3, -1, ENC_NA);
6006 }
6007 
6008 static void
dissect_r3_cmd_selftest(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)6009 dissect_r3_cmd_selftest (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
6010 {
6011   if (tree)
6012   {
6013     proto_tree_add_item (tree, hf_r3_commandlength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
6014     proto_tree_add_item (tree, hf_r3_command,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
6015   }
6016 }
6017 
6018 static void
dissect_r3_cmd_reset(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)6019 dissect_r3_cmd_reset (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
6020 {
6021   if (tree)
6022   {
6023     proto_tree_add_item (tree, hf_r3_commandlength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
6024     proto_tree_add_item (tree, hf_r3_command,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
6025   }
6026 }
6027 
6028 static void
dissect_r3_cmd_logwrite(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)6029 dissect_r3_cmd_logwrite (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
6030 {
6031   guint8    cmdLen;
6032   tvbuff_t *payload_tvb;
6033 
6034   if (!tree)
6035     return;
6036 
6037   cmdLen      = tvb_get_guint8 (tvb, start_offset + 0);
6038   payload_tvb = tvb_new_subset_length (tvb, start_offset + 2, cmdLen - 2);
6039 
6040   proto_tree_add_item (tree, hf_r3_commandlength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
6041   proto_tree_add_item (tree, hf_r3_command,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
6042 
6043   proto_tree_add_item (tree, hf_r3_writeeventlog_user,  payload_tvb, 0, 2, ENC_LITTLE_ENDIAN);
6044   proto_tree_add_item (tree, hf_r3_writeeventlog_event, payload_tvb, 2, 1, ENC_LITTLE_ENDIAN);
6045 }
6046 
6047 static void
dissect_r3_cmd_mfgcommand(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)6048 dissect_r3_cmd_mfgcommand (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
6049 {
6050   if (tree)
6051   {
6052     proto_tree_add_item (tree, hf_r3_commandlength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
6053     proto_tree_add_item (tree, hf_r3_command,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
6054   }
6055   mfgCommandFlag = TRUE;
6056 }
6057 
6058 static void
dissect_r3_cmd_nvrambackup(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)6059 dissect_r3_cmd_nvrambackup (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
6060 {
6061   if (tree)
6062   {
6063     proto_tree_add_item (tree, hf_r3_commandlength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
6064     proto_tree_add_item (tree, hf_r3_command,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
6065   }
6066 }
6067 
6068 static void
dissect_r3_cmd_extendedresponse(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)6069 dissect_r3_cmd_extendedresponse (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
6070 {
6071   if (tree)
6072   {
6073     proto_tree_add_item (tree, hf_r3_commandlength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
6074     proto_tree_add_item (tree, hf_r3_command,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
6075   }
6076 }
6077 
6078 /*
6079  * ***************************************************************************
6080  */
6081 static void
dissect_r3_cmdmfg_setserialnumber(tvbuff_t * tvb,guint32 start_offset,guint32 length,packet_info * pinfo,proto_tree * tree)6082 dissect_r3_cmdmfg_setserialnumber (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *tree)
6083 {
6084   tvbuff_t *sn_tvb = tvb_new_subset_length (tvb, start_offset + 2, 16);
6085 
6086   if (tree)
6087   {
6088     proto_tree_add_item (tree, hf_r3_commandmfglength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
6089     proto_tree_add_item (tree, hf_r3_commandmfg,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
6090   }
6091   dissect_serialnumber (sn_tvb, 0, length, pinfo, tree, hf_r3_mfgsetserialnumber);
6092 }
6093 
6094 static void
dissect_r3_cmdmfg_setcryptkey(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)6095 dissect_r3_cmdmfg_setcryptkey (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
6096 {
6097   if (tree)
6098   {
6099     proto_tree_add_item (tree, hf_r3_commandmfglength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
6100     proto_tree_add_item (tree, hf_r3_commandmfg,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
6101     proto_tree_add_item (tree, hf_r3_mfgsetcryptkey,   tvb, start_offset + 2, -1, ENC_NA);
6102   }
6103 }
6104 
6105 static void
dissect_r3_cmdmfg_dumpnvram(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)6106 dissect_r3_cmdmfg_dumpnvram (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
6107 {
6108   if (tree)
6109   {
6110     proto_tree_add_item (tree, hf_r3_commandmfglength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
6111     proto_tree_add_item (tree, hf_r3_commandmfg,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
6112     proto_tree_add_item (tree, hf_r3_mfgdumpnvram,     tvb, start_offset + 2, 1, ENC_LITTLE_ENDIAN);
6113   }
6114 }
6115 
6116 static void
dissect_r3_cmdmfg_terminal(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)6117 dissect_r3_cmdmfg_terminal (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
6118 {
6119   if (tree)
6120   {
6121     proto_tree_add_item (tree, hf_r3_commandmfglength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
6122     proto_tree_add_item (tree, hf_r3_commandmfg,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
6123   }
6124 }
6125 
6126 static void
dissect_r3_cmdmfg_remoteunlock(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)6127 dissect_r3_cmdmfg_remoteunlock (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
6128 {
6129   if (tree)
6130   {
6131     proto_tree_add_item (tree, hf_r3_commandmfglength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
6132     proto_tree_add_item (tree, hf_r3_commandmfg,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
6133     proto_tree_add_item (tree, hf_r3_mfgremoteunlock,  tvb, start_offset + 2, 1, ENC_LITTLE_ENDIAN);
6134   }
6135 }
6136 
6137 static void
dissect_r3_cmdmfg_auxctlrversion(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)6138 dissect_r3_cmdmfg_auxctlrversion (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
6139 {
6140   if (tree)
6141   {
6142     proto_tree_add_item (tree, hf_r3_commandmfglength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
6143     proto_tree_add_item (tree, hf_r3_commandmfg,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
6144   }
6145 }
6146 
6147 static void
dissect_r3_cmdmfg_iopins(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)6148 dissect_r3_cmdmfg_iopins (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
6149 {
6150   if (tree)
6151   {
6152     proto_tree_add_item (tree, hf_r3_commandmfglength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
6153     proto_tree_add_item (tree, hf_r3_commandmfg,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
6154   }
6155 }
6156 
6157 static void
dissect_r3_cmdmfg_adcs(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)6158 dissect_r3_cmdmfg_adcs (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
6159 {
6160   if (tree)
6161   {
6162     proto_tree_add_item (tree, hf_r3_commandmfglength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
6163     proto_tree_add_item (tree, hf_r3_commandmfg,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
6164   }
6165 }
6166 
6167 static void
dissect_r3_cmdmfg_hardwareid(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)6168 dissect_r3_cmdmfg_hardwareid (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
6169 {
6170   if (tree)
6171   {
6172     proto_tree_add_item (tree, hf_r3_commandmfglength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
6173     proto_tree_add_item (tree, hf_r3_commandmfg,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
6174   }
6175 }
6176 
6177 static void
dissect_r3_cmdmfg_checkpointlogdump(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)6178 dissect_r3_cmdmfg_checkpointlogdump (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
6179 {
6180   if (tree)
6181   {
6182     proto_tree_add_item (tree, hf_r3_commandmfglength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
6183     proto_tree_add_item (tree, hf_r3_commandmfg,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
6184   }
6185 }
6186 
6187 static void
dissect_r3_cmdmfg_checkpointlogclear(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)6188 dissect_r3_cmdmfg_checkpointlogclear (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
6189 {
6190   if (tree)
6191   {
6192     proto_tree_add_item (tree, hf_r3_commandmfglength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
6193     proto_tree_add_item (tree, hf_r3_commandmfg,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
6194   }
6195 }
6196 
6197 static void
dissect_r3_cmdmfg_readregisters(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)6198 dissect_r3_cmdmfg_readregisters (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
6199 {
6200   if (tree)
6201   {
6202     proto_tree_add_item (tree, hf_r3_commandmfglength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
6203     proto_tree_add_item (tree, hf_r3_commandmfg,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
6204   }
6205 }
6206 
6207 static void
dissect_r3_cmdmfg_forceoptions(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo,proto_tree * tree)6208 dissect_r3_cmdmfg_forceoptions (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo, proto_tree *tree)
6209 {
6210   gint    i;
6211   gint    len;
6212   guint8  step;
6213 
6214   proto_tree_add_item (tree, hf_r3_commandmfglength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
6215   proto_tree_add_item (tree, hf_r3_commandmfg,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
6216 
6217   start_offset += 2;
6218   len = tvb_reported_length_remaining (tvb, start_offset);
6219 
6220   i = 0;
6221   while (i<len && (step=tvb_get_guint8(tvb, start_offset + i))>0)
6222   {
6223     proto_tree *force_tree = proto_tree_add_subtree_format(tree, tvb, start_offset + i, tvb_get_guint8 (tvb, start_offset + i),
6224                                                   ett_r3forceoptions, NULL,
6225                                                   "Force Option %s (%u)",
6226                                                   val_to_str_ext_const (
6227                                                     tvb_get_guint8 (tvb, start_offset + i + 1),
6228                                                     &r3_forceitemnames_ext, "[Unknown]"),
6229                                                   tvb_get_guint8 (tvb, start_offset + i + 1));
6230     proto_item *force_item_item;
6231 
6232     proto_tree_add_item (force_tree, hf_r3_forceoptions_length, tvb, start_offset + i + 0, 1, ENC_LITTLE_ENDIAN);
6233     force_item_item = proto_tree_add_item (force_tree, hf_r3_forceoptions_item,   tvb, start_offset + i + 1, 1, ENC_LITTLE_ENDIAN);
6234 
6235     switch (tvb_get_guint8 (tvb, start_offset + i) - 2)
6236     {
6237       case 1  : proto_tree_add_item (force_tree, hf_r3_forceoptions_state_8,  tvb, start_offset + i + 2, 1, ENC_LITTLE_ENDIAN);
6238         break;
6239       case 2  : proto_tree_add_item (force_tree, hf_r3_forceoptions_state_16, tvb, start_offset + i + 2, 2, ENC_LITTLE_ENDIAN);
6240         break;
6241       case 3  : proto_tree_add_item (force_tree, hf_r3_forceoptions_state_24, tvb, start_offset + i + 2, 3, ENC_LITTLE_ENDIAN);
6242         break;
6243       case 4  : proto_tree_add_item (force_tree, hf_r3_forceoptions_state_32, tvb, start_offset + i + 2, 4, ENC_LITTLE_ENDIAN);
6244         break;
6245       default :
6246         expert_add_info_format(pinfo, force_item_item, &ei_r3_malformed_length, "Invalid length for Forceoptions State entry");
6247         return;  /* quit */
6248         break;
6249     }
6250 
6251     i += step;
6252   }
6253 }
6254 
6255 static void
dissect_r3_cmdmfg_commuser(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)6256 dissect_r3_cmdmfg_commuser (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
6257 {
6258   if (tree)
6259   {
6260     proto_tree_add_item (tree, hf_r3_commandmfglength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
6261     proto_tree_add_item (tree, hf_r3_commandmfg,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
6262   }
6263 }
6264 
6265 static void
dissect_r3_cmdmfg_dumpkeypad(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)6266 dissect_r3_cmdmfg_dumpkeypad (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
6267 {
6268   if (tree)
6269   {
6270     proto_tree_add_item (tree, hf_r3_commandmfglength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
6271     proto_tree_add_item (tree, hf_r3_commandmfg,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
6272   }
6273 }
6274 
6275 static void
dissect_r3_cmdmfg_batterycheck(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)6276 dissect_r3_cmdmfg_batterycheck (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
6277 {
6278   if (tree)
6279   {
6280     proto_tree_add_item (tree, hf_r3_commandmfglength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
6281     proto_tree_add_item (tree, hf_r3_commandmfg,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
6282   }
6283 }
6284 
6285 static void
dissect_r3_cmdmfg_ramrefresh(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)6286 dissect_r3_cmdmfg_ramrefresh (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
6287 {
6288   if (tree)
6289   {
6290     proto_tree_add_item (tree, hf_r3_commandmfglength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
6291     proto_tree_add_item (tree, hf_r3_commandmfg,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
6292   }
6293 }
6294 
6295 static void
dissect_r3_cmdmfg_taskflags(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)6296 dissect_r3_cmdmfg_taskflags (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
6297 {
6298   if (tree)
6299   {
6300     proto_tree_add_item (tree, hf_r3_commandmfglength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
6301     proto_tree_add_item (tree, hf_r3_commandmfg,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
6302   }
6303 }
6304 
6305 static void
dissect_r3_cmdmfg_timerchain(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)6306 dissect_r3_cmdmfg_timerchain (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
6307 {
6308   if (tree)
6309   {
6310     proto_tree_add_item (tree, hf_r3_commandmfglength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
6311     proto_tree_add_item (tree, hf_r3_commandmfg,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
6312   }
6313 }
6314 
6315 static void
dissect_r3_cmdmfg_peekpoke(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo,proto_tree * tree)6316 dissect_r3_cmdmfg_peekpoke (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo, proto_tree *tree)
6317 {
6318   gint i;
6319   gint len;
6320 
6321   proto_tree_add_item (tree, hf_r3_commandmfglength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
6322   proto_tree_add_item (tree, hf_r3_commandmfg,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
6323 
6324   start_offset += 2;
6325   len = tvb_reported_length_remaining (tvb, start_offset);
6326 
6327   for (i = 0; i < len; i += 3)
6328   {
6329     proto_item *peekpoke_item;
6330     proto_item *peekpoke_op_item;
6331     proto_tree *peekpoke_tree;
6332 
6333     peekpoke_tree = proto_tree_add_subtree(tree, tvb, start_offset + i, 3, ett_r3peekpoke, &peekpoke_item, "");
6334 
6335     peekpoke_op_item = proto_tree_add_item (peekpoke_tree, hf_r3_peekpoke_operation, tvb, start_offset + i + 0, 1, ENC_LITTLE_ENDIAN);
6336     proto_tree_add_item (peekpoke_tree, hf_r3_peekpoke_address,   tvb, start_offset + i + 1, 2, ENC_LITTLE_ENDIAN);
6337 
6338     switch (tvb_get_guint8 (tvb, start_offset + i + 0))
6339     {
6340       case PEEKPOKE_READU8 :
6341         proto_item_append_text (peekpoke_item, "Read (8 Bits @ 0x%04x)", tvb_get_letohs (tvb, start_offset + i + 1));
6342         break;
6343 
6344       case PEEKPOKE_READU16 :
6345         proto_item_append_text (peekpoke_item, "Read (16 Bits @ 0x%04x)", tvb_get_letohs (tvb, start_offset + i + 1));
6346         break;
6347 
6348       case PEEKPOKE_READU24 :
6349         proto_item_append_text (peekpoke_item, "Read (24 Bits @ 0x%04x)", tvb_get_letohs (tvb, start_offset + i + 1));
6350         break;
6351 
6352       case PEEKPOKE_READU32 :
6353         proto_item_append_text (peekpoke_item, "Read (32 Bits @ 0x%04x)", tvb_get_letohs (tvb, start_offset + i + 1));
6354         break;
6355 
6356       case PEEKPOKE_READSTRING :
6357         proto_item_append_text (peekpoke_item,
6358                                 "Read (%d Bytes @ 0x%04x)",
6359                                 tvb_get_guint8 (tvb, start_offset + i + 3),
6360                                 tvb_get_letohs (tvb, start_offset + i + 1));
6361         proto_item_set_len (peekpoke_item, 4);
6362         proto_tree_add_item (peekpoke_tree, hf_r3_peekpoke_length, tvb, start_offset + i + 3, 1, ENC_LITTLE_ENDIAN);
6363         i += 1;
6364         break;
6365 
6366       case PEEKPOKE_WRITEU8 :
6367         proto_item_append_text (peekpoke_item,
6368                                 "Write (8 Bits: 0x%02x @ 0x%04x)",
6369                                 tvb_get_guint8 (tvb, start_offset + i + 3),
6370                                 tvb_get_letohs (tvb, start_offset + i + 1));
6371         proto_item_set_len (peekpoke_item, 4);
6372         proto_tree_add_item (peekpoke_tree, hf_r3_peekpoke_poke8, tvb, start_offset + i + 3, 1, ENC_LITTLE_ENDIAN);
6373         i += 1;
6374         break;
6375 
6376       case PEEKPOKE_WRITEU16 :
6377         proto_item_append_text (peekpoke_item,
6378                                 "Write (16 Bits: 0x%04x @ 0x%04x)",
6379                                 tvb_get_letohs (tvb, start_offset + i + 3),
6380                                 tvb_get_letohs (tvb, start_offset + i + 1));
6381         proto_item_set_len (peekpoke_item, 5);
6382         proto_tree_add_item (peekpoke_tree, hf_r3_peekpoke_poke16, tvb, start_offset + i + 3, 2, ENC_LITTLE_ENDIAN);
6383         i += 2;
6384         break;
6385 
6386       case PEEKPOKE_WRITEU24 :
6387         proto_item_append_text (peekpoke_item,
6388                                 "Write (24 Bits: 0x%06x @ 0x%04x)",
6389                                 tvb_get_letoh24 (tvb, start_offset + i + 3),
6390                                 tvb_get_letohs (tvb, start_offset + i + 1));
6391         proto_item_set_len (peekpoke_item, 6);
6392         proto_tree_add_item (peekpoke_tree, hf_r3_peekpoke_poke24, tvb, start_offset + i + 3, 3, ENC_LITTLE_ENDIAN);
6393         i += 3;
6394         break;
6395 
6396       case PEEKPOKE_WRITEU32 :
6397         proto_item_append_text (peekpoke_item,
6398                                 "Write (32 Bits: 0x%08x @ 0x%04x)",
6399                                 tvb_get_letohl (tvb, start_offset + i + 3),
6400                                 tvb_get_letohs (tvb, start_offset + i + 1));
6401         proto_item_set_len (peekpoke_item, 7);
6402         proto_tree_add_item (peekpoke_tree, hf_r3_peekpoke_poke32, tvb, start_offset + i + 3, 4, ENC_LITTLE_ENDIAN);
6403         i += 4;
6404         break;
6405 
6406       case PEEKPOKE_WRITESTRING :
6407         proto_item_append_text (peekpoke_item,
6408                                 "Write (%d Bytes @ 0x%04x)",
6409                                 tvb_get_guint8 (tvb, start_offset + i + 3),
6410                                 tvb_get_letohs (tvb, start_offset + i + 1));
6411         proto_item_set_len (peekpoke_item, 3 + 1 + tvb_get_guint8 (tvb, start_offset + i + 3));
6412         proto_tree_add_item (peekpoke_tree, hf_r3_peekpoke_length,     tvb, start_offset + i + 3, 1, ENC_LITTLE_ENDIAN);
6413         proto_tree_add_item (peekpoke_tree, hf_r3_peekpoke_pokestring, tvb, start_offset + i + 4,
6414                              tvb_get_guint8 (tvb, start_offset + i + 3), ENC_NA);
6415         i += tvb_get_guint8 (tvb, start_offset + i + 3) + 1;
6416         break;
6417 
6418       default :
6419         expert_add_info_format(pinfo, peekpoke_op_item, &ei_r3_peekpoke_operation, "Unknown Mfg peekpoke operation value");
6420         return;  /* quit */
6421     }
6422   }
6423 }
6424 
6425 static void
dissect_r3_cmdmfg_lockstate(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)6426 dissect_r3_cmdmfg_lockstate (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
6427 {
6428   proto_tree_add_item (tree, hf_r3_commandmfglength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
6429   proto_tree_add_item (tree, hf_r3_commandmfg,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
6430 }
6431 
6432 static void
dissect_r3_cmdmfg_capabilities(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)6433 dissect_r3_cmdmfg_capabilities (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
6434 {
6435   proto_tree_add_item (tree, hf_r3_commandmfglength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
6436   proto_tree_add_item (tree, hf_r3_commandmfg,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
6437 }
6438 
6439 static void
dissect_r3_cmdmfg_dumpm41t81(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)6440 dissect_r3_cmdmfg_dumpm41t81 (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
6441 {
6442   proto_tree_add_item (tree, hf_r3_commandmfglength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
6443   proto_tree_add_item (tree, hf_r3_commandmfg,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
6444 }
6445 
6446 static void
dissect_r3_cmdmfg_debuglogdump(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)6447 dissect_r3_cmdmfg_debuglogdump (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
6448 {
6449   proto_tree_add_item (tree, hf_r3_commandmfglength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
6450   proto_tree_add_item (tree, hf_r3_commandmfg,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
6451 }
6452 
6453 static void
dissect_r3_cmdmfg_debuglogclear(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)6454 dissect_r3_cmdmfg_debuglogclear (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
6455 {
6456   proto_tree_add_item (tree, hf_r3_commandmfglength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
6457   proto_tree_add_item (tree, hf_r3_commandmfg,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
6458 }
6459 
6460 static void
dissect_r3_cmdmfg_testwdt(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)6461 dissect_r3_cmdmfg_testwdt (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
6462 {
6463   proto_tree_add_item (tree, hf_r3_commandmfglength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
6464   proto_tree_add_item (tree, hf_r3_commandmfg,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
6465 }
6466 
6467 static void
dissect_r3_cmdmfg_querycksum(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)6468 dissect_r3_cmdmfg_querycksum (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
6469 {
6470   proto_tree_add_item (tree, hf_r3_commandmfglength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
6471   proto_tree_add_item (tree, hf_r3_commandmfg,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
6472 }
6473 
6474 static void
dissect_r3_cmdmfg_validatechecksums(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)6475 dissect_r3_cmdmfg_validatechecksums (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
6476 {
6477   proto_tree_add_item (tree, hf_r3_commandmfglength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
6478   proto_tree_add_item (tree, hf_r3_commandmfg,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
6479 }
6480 
6481 static void
dissect_r3_cmdmfg_rebuildlrucache(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)6482 dissect_r3_cmdmfg_rebuildlrucache (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
6483 {
6484   proto_tree_add_item (tree, hf_r3_commandmfglength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
6485   proto_tree_add_item (tree, hf_r3_commandmfg,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
6486 }
6487 
6488 static void
dissect_r3_cmdmfg_tzupdate(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)6489 dissect_r3_cmdmfg_tzupdate (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
6490 {
6491   proto_tree_add_item (tree, hf_r3_commandmfglength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
6492   proto_tree_add_item (tree, hf_r3_commandmfg,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
6493 }
6494 
6495 static void
dissect_r3_cmdmfg_testpreserve(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)6496 dissect_r3_cmdmfg_testpreserve (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
6497 {
6498   proto_tree_add_item (tree, hf_r3_commandmfglength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
6499   proto_tree_add_item (tree, hf_r3_commandmfg,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
6500   proto_tree_add_item (tree, hf_r3_mfgtestpreserve,  tvb, start_offset + 2, 1, ENC_LITTLE_ENDIAN);
6501 }
6502 
6503 static void
dissect_r3_cmdmfg_mortisestatelogdump(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)6504 dissect_r3_cmdmfg_mortisestatelogdump (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
6505 {
6506   proto_tree_add_item (tree, hf_r3_commandmfglength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
6507   proto_tree_add_item (tree, hf_r3_commandmfg,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
6508 }
6509 
6510 static void
dissect_r3_cmdmfg_mortisestatelogclear(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)6511 dissect_r3_cmdmfg_mortisestatelogclear (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
6512 {
6513   proto_tree_add_item (tree, hf_r3_commandmfglength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
6514   proto_tree_add_item (tree, hf_r3_commandmfg,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
6515 }
6516 
6517 static void
dissect_r3_cmdmfg_mortisepins(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)6518 dissect_r3_cmdmfg_mortisepins (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
6519 {
6520   proto_tree_add_item (tree, hf_r3_commandmfglength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
6521   proto_tree_add_item (tree, hf_r3_commandmfg,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
6522 }
6523 
6524 static void
dissect_r3_cmdmfg_haltandcatchfire(tvbuff_t * tvb,guint32 start_offset,guint32 length _U_,packet_info * pinfo _U_,proto_tree * tree)6525 dissect_r3_cmdmfg_haltandcatchfire (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree)
6526 {
6527   proto_tree_add_item (tree, hf_r3_commandmfglength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN);
6528   proto_tree_add_item (tree, hf_r3_commandmfg,       tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN);
6529 }
6530 
6531 /*
6532  */
6533 static gint
dissect_r3_command(tvbuff_t * tvb,guint32 start_offset,guint32 length,packet_info * pinfo,proto_tree * r3_tree)6534 dissect_r3_command (tvbuff_t *tvb, guint32 start_offset, guint32 length, packet_info *pinfo, proto_tree *r3_tree)
6535 {
6536   proto_item  *cmd_item;
6537   proto_tree  *cmd_tree;
6538   const gchar *cn;
6539   guint8       cmdLen;
6540   guint8       cmd;
6541 
6542   tvb_ensure_bytes_exist (tvb, start_offset, 2);
6543 
6544   cmdLen = tvb_get_guint8 (tvb, start_offset + 0);
6545   cmd    = tvb_get_guint8 (tvb, start_offset + 1);
6546 
6547   if (!mfgCommandFlag)
6548     cn = val_to_str_ext_const (cmd, &r3_cmdnames_ext, "[Unknown Command]");
6549   else
6550     cn = val_to_str_ext_const (cmd, &r3_cmdmfgnames_ext, "[Unknown Mfg Command]");
6551 
6552   cmd_tree = proto_tree_add_subtree_format(r3_tree, tvb, start_offset, cmdLen,
6553                             ett_r3cmd, &cmd_item, "Command Packet: %s (%d)", cn, cmd);
6554 
6555   if (!mfgCommandFlag)
6556   {
6557     if (cmd >= CMD_LAST)
6558       expert_add_info(pinfo, cmd_item, &ei_r3_unknown_command_value);
6559     else if (r3command_dissect [cmd])
6560       (*r3command_dissect [cmd]) (tvb, start_offset, length, pinfo, cmd_tree);
6561   }
6562   else
6563   {
6564     mfgCommandFlag = FALSE;
6565 
6566     if (cmd >= CMDMFG_LAST)
6567     {
6568       expert_add_info_format(pinfo, proto_tree_get_parent (cmd_tree), &ei_r3_unknown_command_value, "Unknown manufacturing command value");
6569     }
6570     else if (r3commandmfg_dissect [cmd])
6571       (*r3commandmfg_dissect [cmd]) (tvb, start_offset, length, pinfo, cmd_tree);
6572   }
6573 
6574   return tvb_get_guint8 (tvb, start_offset + 0);
6575 }
6576 
6577 /*
6578  * ***************************************************************************
6579  *
6580  *  Dissect a single r3 PDU
6581  *
6582  *  return: amount consumed
6583  */
6584 static int
dissect_r3_packet(tvbuff_t * tvb,packet_info * pinfo,proto_tree * r3_tree)6585 dissect_r3_packet (tvbuff_t *tvb, packet_info *pinfo, proto_tree *r3_tree)
6586 {
6587   proto_item *payload_item = NULL;
6588   proto_tree *payload_tree = NULL;
6589   guint       offset       = 0;
6590   guint32     packetLen;
6591   guint       octConsumed;
6592 
6593   if (tvb_strneql (tvb, 0, "~~~ds", 5) == 0)
6594   {
6595     if (r3_tree)
6596       proto_tree_add_item (r3_tree, hf_r3_tildex3ds, tvb, 0, -1, ENC_ASCII|ENC_NA);
6597 
6598     return 5;
6599   }
6600 
6601   /*
6602    *  Show basic header stuff
6603    */
6604   if (r3_tree)
6605   {
6606     proto_item *header_item = proto_tree_add_item (r3_tree, hf_r3_header, tvb, 0, 5, ENC_NA);
6607     proto_tree *header_tree = proto_item_add_subtree (header_item, ett_r3header);
6608 
6609     proto_tree_add_item (header_tree, hf_r3_sigil,        tvb, 0, 1, ENC_LITTLE_ENDIAN);
6610     proto_tree_add_item (header_tree, hf_r3_address,      tvb, 1, 1, ENC_LITTLE_ENDIAN);
6611     proto_tree_add_item (header_tree, hf_r3_packetnumber, tvb, 2, 1, ENC_LITTLE_ENDIAN);
6612     proto_tree_add_item (header_tree, hf_r3_packetlength, tvb, 3, 1, ENC_LITTLE_ENDIAN);
6613     proto_tree_add_item (header_tree, hf_r3_encryption,   tvb, 4, 1, ENC_LITTLE_ENDIAN);
6614   }
6615 
6616   /* Note: packetLen == tvb_reported_length() */
6617 
6618   packetLen = tvb_get_guint8 (tvb, 3);
6619 
6620   if (r3_tree)
6621   {
6622     payload_item = proto_tree_add_item (r3_tree, hf_r3_payload, tvb, 5, -1, ENC_NA);
6623     payload_tree = proto_item_add_subtree (payload_item, ett_r3payload);
6624   }
6625 
6626   offset = 5;
6627 
6628   mfgCommandFlag = FALSE;   /* XXX: Assumption: mfgCmd always follows Cmd in same r3 "packet" */
6629   while (offset < (packetLen - 3))
6630   {
6631     octConsumed = dissect_r3_command (tvb, offset, 0, pinfo, payload_tree);
6632     if(octConsumed == 0)
6633     {
6634       expert_add_info_format(pinfo, proto_tree_get_parent (payload_tree), &ei_r3_malformed_length,
6635                               "Command length equal to 0. Payload could be partially decoded");
6636       offset = tvb_reported_length (tvb) - 3; /* just do CRC stuff ?? */
6637       break;
6638     }
6639     offset += octConsumed;
6640   }
6641 
6642   /*
6643    *  Show the CRC and XOR status
6644    */
6645   if (r3_tree)
6646   {
6647     proto_item *tail_item     = proto_tree_add_item (r3_tree, hf_r3_tail, tvb, offset, 3, ENC_NA);
6648     proto_tree *tail_tree     = proto_item_add_subtree (tail_item, ett_r3tail);
6649     guint32     packetCRC     = tvb_get_letohs (tvb, offset);
6650     guint32     packetXor     = tvb_get_guint8 (tvb, offset + 2);
6651     guint32     calculatedCRC;
6652 
6653     if ((calculatedCRC = crc16_r3_ccitt_tvb(tvb, 1, packetLen - 3)) == packetCRC)
6654       proto_tree_add_uint_format_value(tail_tree, hf_r3_crc, tvb, offset, 2, packetCRC, "0x%04x (correct)", packetCRC);
6655     else
6656     {
6657       proto_item *tmp_item;
6658 
6659       proto_tree_add_uint_format_value(tail_tree, hf_r3_crc, tvb, offset, 2, packetCRC,
6660                                   "0x%04x (incorrect, should be 0x%04x)", calculatedCRC, packetCRC);
6661       tmp_item = proto_tree_add_boolean (tail_tree, hf_r3_crc_bad, tvb, offset, 2, TRUE);
6662       proto_item_set_generated (tmp_item);
6663     }
6664 
6665     if ((packetLen ^ 0xff) == packetXor)
6666       proto_tree_add_uint_format_value(tail_tree, hf_r3_xor, tvb, offset + 2, 1, packetXor,
6667                                   "0x%02x (correct)", packetXor);
6668     else
6669     {
6670       proto_item *tmp_item;
6671 
6672       proto_tree_add_uint_format_value(tail_tree, hf_r3_xor, tvb, offset + 7, 1, packetXor,
6673                                   "0x%02x (incorrect, should be 0x%02x)", packetXor, packetLen ^ 0xff);
6674       tmp_item = proto_tree_add_boolean (tail_tree, hf_r3_xor_bad, tvb, offset + 7, 1, TRUE);
6675       proto_item_set_generated (tmp_item);
6676     }
6677   }
6678 
6679   offset += 3;
6680 
6681   return offset;
6682 }
6683 
6684 /*
6685  * ***************************************************************************
6686  *
6687  *  Main dissector entry points
6688  */
6689 static int
dissect_r3_message(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)6690 dissect_r3_message (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
6691 {
6692   proto_tree *r3_tree = NULL;
6693 
6694   col_set_str (pinfo->cinfo, COL_PROTOCOL, "R3");
6695   col_clear (pinfo->cinfo, COL_INFO);
6696 
6697   /* Note: The tvb (provided via tcp_dissect_pdus()) will contain (at most) one PDU of the length
6698    *       specified via get_r3_message_len()
6699    */
6700 
6701   if (tree)
6702   {
6703     proto_item *r3_item;
6704     r3_item = proto_tree_add_item (tree, proto_r3, tvb, 0, -1, ENC_NA);
6705     r3_tree = proto_item_add_subtree (r3_item, ett_r3);
6706   }
6707 
6708   dissect_r3_packet (tvb, pinfo, r3_tree);
6709 
6710   return tvb_reported_length(tvb);
6711 }
6712 
6713 static guint
get_r3_message_len(packet_info * pinfo _U_,tvbuff_t * tvb,int offset,void * data _U_)6714 get_r3_message_len (packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
6715 {
6716   return (guint) tvb_get_guint8 (tvb, offset + 3) + 1;
6717 }
6718 
6719 static int
dissect_r3(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data)6720 dissect_r3 (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
6721 {
6722   tcp_dissect_pdus (tvb, pinfo, tree, TRUE, 4, get_r3_message_len, dissect_r3_message, data);
6723   return tvb_reported_length(tvb);
6724 }
6725 
6726 /*
6727  * ***************************************************************************
6728  */
proto_register_r3(void)6729 void proto_register_r3 (void)
6730 {
6731 
6732   /* Setup list of header fields */
6733   static hf_register_info hf [] =
6734     {
6735       { &hf_r3_tildex3ds,
6736         { "DPAC Attention", "r3.dpac_attention",
6737           FT_STRING, BASE_NONE, NULL, 0x0,
6738           NULL, HFILL }
6739       },
6740 
6741       { &hf_r3_header,
6742         { "Header", "r3.header",
6743           FT_NONE, BASE_NONE, NULL, 0x0,
6744           NULL, HFILL }
6745       },
6746       { &hf_r3_payload,
6747         { "Payload", "r3.payload",
6748           FT_NONE, BASE_NONE, NULL, 0x0,
6749           NULL, HFILL }
6750       },
6751       { &hf_r3_tail,
6752         { "Tail", "r3.tail",
6753           FT_NONE, BASE_NONE, NULL, 0x0,
6754           NULL, HFILL }
6755       },
6756 
6757       { &hf_r3_sigil,
6758         { "Sigil", "r3.sigil",
6759           FT_UINT8, BASE_HEX, NULL, 0x0,
6760           NULL, HFILL }
6761       },
6762       { &hf_r3_address,
6763         { "Address", "r3.address",
6764           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
6765           NULL, HFILL }
6766       },
6767       { &hf_r3_packetnumber,
6768         { "Packet Number", "r3.packetnumber",
6769           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
6770           NULL, HFILL }
6771       },
6772       { &hf_r3_packetlength,
6773         { "Packet Length", "r3.packetlength",
6774           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
6775           NULL, HFILL }
6776       },
6777       { &hf_r3_encryption,
6778         { "Crypt Type", "r3.encryption",
6779           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_encryptionschemenames_ext, 0x0,
6780           NULL, HFILL }
6781       },
6782       { &hf_r3_crc,
6783         { "CRC", "r3.crc",
6784           FT_UINT16, BASE_HEX, NULL, 0x0,
6785           NULL, HFILL }
6786       },
6787       { &hf_r3_crc_bad,
6788         { "Bad CRC", "r3.crc_bad",
6789           FT_BOOLEAN, BASE_NONE, NULL, 0x0,
6790           NULL, HFILL }
6791       },
6792       { &hf_r3_xor,
6793         { "XOR", "r3.xor",
6794           FT_UINT8, BASE_HEX, NULL, 0x0,
6795           NULL, HFILL }
6796       },
6797       { &hf_r3_xor_bad,
6798         { "Bad XOR", "r3.xor_bad",
6799           FT_BOOLEAN, BASE_NONE, NULL, 0x0,
6800           NULL, HFILL }
6801       },
6802 
6803       { &hf_r3_commandlength,
6804         { "Command Length", "r3.command.length",
6805           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
6806           NULL, HFILL }
6807       },
6808       { &hf_r3_command,
6809         { "Command", "r3.command.command",
6810           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_cmdnames_ext, 0x0,
6811           NULL, HFILL }
6812       },
6813       { &hf_r3_commanddata,
6814         { "Command Data", "r3.command.data",
6815           FT_NONE, BASE_NONE, NULL, 0x0,
6816           NULL, HFILL }
6817       },
6818 
6819       { &hf_r3_commandmfglength,
6820         { "Mfg Command Length", "r3.commandmfg.length",
6821           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
6822           NULL, HFILL }
6823       },
6824       { &hf_r3_commandmfg,
6825         { "Mfg Command", "r3.commandmfg.command",
6826           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_cmdmfgnames_ext, 0x0,
6827           NULL, HFILL }
6828       },
6829 #if 0
6830       { &hf_r3_commandmfgdata,
6831         { "Mfg Command Data", "r3.commandmfg.data",
6832           FT_NONE, BASE_NONE, NULL, 0x0,
6833           NULL, HFILL }
6834       },
6835 #endif
6836 
6837       { &hf_r3_responselength,
6838         { "Response Length", "r3.response.length",
6839           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
6840           NULL, HFILL }
6841       },
6842       { &hf_r3_responsecommand,
6843         { "Response Command", "r3.response.command",
6844           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_cmdnames_ext, 0x0,
6845           NULL, HFILL }
6846       },
6847       { &hf_r3_responsetype,
6848         { "Response Type", "r3.response.responsetype",
6849           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_responsetypenames_ext, 0x0,
6850           NULL, HFILL }
6851       },
6852       { &hf_r3_responsetocommand,
6853         { "Response To Command", "r3.response.to_command",
6854           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_cmdnames_ext, 0x0,
6855           NULL, HFILL }
6856       },
6857 #if 0
6858       { &hf_r3_responsedata,
6859         { "Response Data", "r3.response.data",
6860           FT_NONE, BASE_NONE, NULL, 0x0,
6861           NULL, HFILL }
6862       },
6863 #endif
6864 
6865       { &hf_r3_upstreamcommand,
6866         { "Upstream Command", "r3.upstreamcommand.command",
6867           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_upstreamcommandnames_ext, 0x0,
6868           NULL, HFILL }
6869       },
6870 
6871       { &hf_r3_upstreamfield,
6872         { "Upstream Field", "r3.upstreamfield",
6873           FT_NONE, BASE_NONE, NULL, 0x0,
6874           NULL, HFILL }
6875       },
6876       { &hf_r3_upstreamfieldlength,
6877         { "Field Length", "r3.upstreamfield.length",
6878           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
6879           NULL, HFILL }
6880       },
6881       { &hf_r3_upstreamfieldtype,
6882         { "Field Type", "r3.upstreamfield.type",
6883           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_upstreamfieldnames_ext, 0x0,
6884           NULL, HFILL }
6885       },
6886 #if 0
6887       { &hf_r3_upstreamfielddatalen,
6888         { "Data Length", "r3.upstreamfield.datalen",
6889           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
6890           NULL, HFILL }
6891       },
6892 #endif
6893       { &hf_r3_upstreamfielderror,
6894         { "Error", "r3.upstreamfield.error",
6895           FT_NONE, BASE_NONE, NULL, 0x0,
6896           NULL, HFILL }
6897       },
6898       { &hf_r3_upstreamfieldarray [UPSTREAMFIELD_SERIALNUMBER],
6899         { "Serial Number", "r3.upstreamfield.serialnumber",
6900           FT_STRING, BASE_NONE, NULL, 0x0,
6901           NULL, HFILL }
6902       },
6903       { &hf_r3_upstreamfieldarray [UPSTREAMFIELD_NAR],
6904         { "Next Available Record", "r3.upstreamfield.nar",
6905           FT_UINT16, BASE_DEC_HEX, NULL, 0x0,
6906           NULL, HFILL }
6907       },
6908       { &hf_r3_upstreamfieldarray [UPSTREAMFIELD_ENTRYDEVICE],
6909         { "Entry Device", "r3.upstreamfield.entrydevice",
6910           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_ppmisourcenames_ext, 0x0,
6911           NULL, HFILL }
6912       },
6913       { &hf_r3_upstreamfieldarray [UPSTREAMFIELD_PPMIFIELDTYPE],
6914         { "PPMI Field Type", "r3.upstreamfield.ppmifieldtype",
6915           FT_UINT8, BASE_HEX_DEC|BASE_EXT_STRING, &r3_ppmisourcenames_ext, 0x0,
6916           NULL, HFILL }
6917       },
6918       { &hf_r3_upstreamfieldarray [UPSTREAMFIELD_PIN],
6919         { "PIN", "r3.upstreamfield.pin",
6920           FT_STRING, BASE_NONE, NULL, 0x0,
6921           NULL, HFILL }
6922       },
6923       { &hf_r3_upstreamfieldarray [UPSTREAMFIELD_SEQUENCENUMBER],
6924         { "Sequence Number", "r3.upstreamfield.sequencenumber",
6925           FT_UINT16, BASE_DEC_HEX, NULL, 0x0,
6926           NULL, HFILL }
6927       },
6928       { &hf_r3_upstreamfieldarray [UPSTREAMFIELD_RESPONSEWINDOW],
6929         { "Response Window", "r3.upstreamfield.responsewindow",
6930           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
6931           NULL, HFILL }
6932       },
6933       { &hf_r3_upstreamfieldarray [UPSTREAMFIELD_USERNUMBER],
6934         { "User Number", "r3.upstreamfield.usernumber",
6935           FT_UINT16, BASE_DEC_HEX, NULL, 0x0,
6936           NULL, HFILL }
6937       },
6938       { &hf_r3_upstreamfieldarray [UPSTREAMFIELD_VERSION],
6939         { "Version", "r3.upstreamfield.version",
6940           FT_STRING, BASE_NONE, NULL, 0x0,
6941           NULL, HFILL }
6942       },
6943       { &hf_r3_upstreamfieldarray [UPSTREAMFIELD_EVENTLOGRECORD],
6944         { "Event Log Record", "r3.upstreamfield.eventlogrecord",
6945           FT_BYTES, BASE_NONE, NULL, 0x0,
6946           NULL, HFILL }
6947       },
6948       { &hf_r3_upstreamfieldarray [UPSTREAMFIELD_DATETIME],
6949         { "Date/Time", "r3.upstreamfield.datetime",
6950           FT_BYTES, BASE_NONE, NULL, 0x0,
6951           NULL, HFILL }
6952       },
6953       { &hf_r3_upstreamfieldarray [UPSTREAMFIELD_EVENTLOGRECORDCOUNT],
6954         { "Event Log Record Count", "r3.upstreamfield.eventlogrecordcount",
6955           FT_UINT16, BASE_DEC_HEX, NULL, 0x0,
6956           NULL, HFILL }
6957       },
6958       { &hf_r3_upstreamfieldarray [UPSTREAMFIELD_DECLINEDRECORDCOUNT],
6959         { "Declined Log Record", "r3.upstreamfield.declinedlogrecord",
6960           FT_UINT16, BASE_DEC_HEX, NULL, 0x0,
6961           NULL, HFILL }
6962       },
6963       { &hf_r3_upstreamfieldarray [UPSTREAMFIELD_DECLINEDRECORD],
6964         { "Declined Log", "r3.upstreamfield.declinedlog",
6965           FT_BYTES, BASE_NONE, NULL, 0x0,
6966           NULL, HFILL }
6967       },
6968       { &hf_r3_upstreamfieldarray [UPSTREAMFIELD_USERTYPE],
6969         { "User Type", "r3.upstreamfield.usertype",
6970           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_usertypenames_ext, 0x0,
6971           NULL, HFILL }
6972       },
6973       { &hf_r3_upstreamfieldarray [UPSTREAMFIELD_ACCESSALWAYS],
6974         { "Access Always", "r3.upstreamfield.accessalways",
6975           FT_BOOLEAN, BASE_NONE, NULL, 0x0,
6976           NULL, HFILL }
6977       },
6978       { &hf_r3_upstreamfieldarray [UPSTREAMFIELD_CACHED],
6979         { "Cached", "r3.upstreamfield.cached",
6980           FT_BOOLEAN, BASE_NONE, NULL, 0x0,
6981           NULL, HFILL }
6982       },
6983       { &hf_r3_upstreamfieldarray [UPSTREAMFIELD_PRIMARYFIELDTYPE],
6984         { "Primary Field Type", "r3.upstreamfield.primaryfieldtype",
6985           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_ppmisourcenames_ext, 0x0,
6986           NULL, HFILL }
6987       },
6988       { &hf_r3_upstreamfieldarray [UPSTREAMFIELD_AUXFIELDTYPE],
6989         { "Aux Field Type", "r3.upstreamfield.auxfieldtype",
6990           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_ppmisourcenames_ext, 0x0,
6991           NULL, HFILL }
6992       },
6993       { &hf_r3_upstreamfieldarray [UPSTREAMFIELD_ACCESSMODE],
6994         { "Access Mode", "r3.upstreamfield.accessmode",
6995           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_accessmodenames_ext, 0x0,
6996           NULL, HFILL }
6997       },
6998       { &hf_r3_upstreamfieldarray [UPSTREAMFIELD_EXPIREON],
6999         { "Expire On", "r3.upstreamfield.expireon",
7000           FT_UINT24, BASE_HEX, NULL, 0x0,
7001           NULL, HFILL }
7002       },
7003       { &hf_r3_upstreamfieldarray [UPSTREAMFIELD_USECOUNT],
7004         { "Use Count", "r3.upstreamfield.usecount",
7005           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7006           NULL, HFILL }
7007       },
7008       { &hf_r3_upstreamfieldarray [UPSTREAMFIELD_TIMEZONE],
7009         { "Timezone", "r3.upstreamfield.timezone",
7010           FT_UINT32, BASE_HEX, NULL, 0x0,
7011           NULL, HFILL }
7012       },
7013       { &hf_r3_upstreamfieldarray [UPSTREAMFIELD_EXCEPTIONGROUP],
7014         { "Exception Group", "r3.upstreamfield.exceptiongroup",
7015           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7016           NULL, HFILL }
7017       },
7018       { &hf_r3_upstreamfieldarray [UPSTREAMFIELD_PRIMARYPIN],
7019         { "Primary PIN", "r3.upstreamfield.primarypin",
7020           FT_BYTES, BASE_NONE, NULL, 0x0,
7021           NULL, HFILL }
7022       },
7023       { &hf_r3_upstreamfieldarray [UPSTREAMFIELD_AUXPIN],
7024         { "Aux PIN", "r3.upstreamfield.auxpin",
7025           FT_BYTES, BASE_NONE, NULL, 0x0,
7026           NULL, HFILL }
7027       },
7028       { &hf_r3_upstreamfieldarray [UPSTREAMFIELD_ALARMRECORDCOUNT],
7029         { "Alarm Record Count", "r3.upstreamfield.alarmrecordcount",
7030           FT_UINT16, BASE_DEC_HEX, NULL, 0x0,
7031           NULL, HFILL }
7032       },
7033       { &hf_r3_upstreamfieldarray [UPSTREAMFIELD_ALARMRECORD],
7034         { "Alarm Record", "r3.upstreamfield.alarmrecord",
7035           FT_BYTES, BASE_NONE, NULL, 0x0,
7036           NULL, HFILL }
7037       },
7038       { &hf_r3_upstreamfieldarray [UPSTREAMFIELD_AUXCTLRVERSION],
7039         { "Aux Controller Version", "r3.upstreamfield.auxctlrversion",
7040           FT_STRING, BASE_NONE, NULL, 0x0,
7041           NULL, HFILL }
7042       },
7043 
7044       { &hf_r3_configitems,
7045         { "Configuration Item List", "r3.configitems",
7046           FT_NONE, BASE_NONE, NULL, 0x0,
7047           NULL, HFILL }
7048       },
7049       { &hf_r3_configitem,
7050         { "Configuration Item", "r3.configitem",
7051           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_configitemnames_ext, 0x0,
7052           NULL, HFILL }
7053       },
7054 #if 0
7055       { &hf_r3_configfield,
7056         { "Config Field", "r3.configfield",
7057           FT_NONE, BASE_NONE, NULL, 0x0,
7058           NULL, HFILL }
7059       },
7060 #endif
7061       { &hf_r3_configitemlength,
7062         { "Configuration Item Length", "r3.configitem.length",
7063           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7064           NULL, HFILL }
7065       },
7066       { &hf_r3_configitemtype,
7067         { "Configuration Item Type", "r3.configitem.type",
7068           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_configtypenames_ext, 0x0,
7069           NULL, HFILL }
7070       },
7071       { &hf_r3_configitemdata,
7072         { "Configuration Item Data", "r3.configitem.data",
7073           FT_NONE, BASE_NONE, NULL, 0x0,
7074           NULL, HFILL }
7075       },
7076       { &hf_r3_configitemdata_bool,
7077         { "Configuration Item Boolean", "r3.configitem.data_boolean",
7078           FT_BOOLEAN, BASE_NONE, NULL, 0x0,
7079           NULL, HFILL }
7080       },
7081       { &hf_r3_configitemdata_8,
7082         { "Configuration Item 8-bit", "r3.configitem.data_8",
7083           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7084           NULL, HFILL }
7085       },
7086       { &hf_r3_configitemdata_16,
7087         { "Configuration Item 16-bit", "r3.configitem.data_16",
7088           FT_UINT16, BASE_DEC_HEX, NULL, 0x0,
7089           NULL, HFILL }
7090       },
7091       { &hf_r3_configitemdata_32,
7092         { "Configuration Item 32-bit", "r3.configitem.data_32",
7093           FT_UINT32, BASE_DEC_HEX, NULL, 0x0,
7094           NULL, HFILL }
7095       },
7096       { &hf_r3_configitemdata_string,
7097         { "Configuration Item String", "r3.configitem.data_string",
7098           FT_STRING, BASE_NONE, NULL, 0x0,
7099           NULL, HFILL }
7100       },
7101 
7102       { &hf_r3_timezonearray0,
7103         { "Timezone  0", "r3.timezone.0",
7104           FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00000001,
7105           NULL, HFILL }
7106       },
7107       { &hf_r3_timezonearray1,
7108         { "Timezone  1", "r3.timezone.1",
7109           FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00000002,
7110           NULL, HFILL }
7111       },
7112       { &hf_r3_timezonearray2,
7113         { "Timezone  2", "r3.timezone.2",
7114           FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00000004,
7115           NULL, HFILL }
7116       },
7117       { &hf_r3_timezonearray3,
7118         { "Timezone  3", "r3.timezone.3",
7119           FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00000008,
7120           NULL, HFILL }
7121       },
7122       { &hf_r3_timezonearray4,
7123         { "Timezone  4", "r3.timezone.4",
7124           FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00000010,
7125           NULL, HFILL }
7126       },
7127       { &hf_r3_timezonearray5,
7128         { "Timezone  5", "r3.timezone.5",
7129           FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00000020,
7130           NULL, HFILL }
7131       },
7132       { &hf_r3_timezonearray6,
7133         { "Timezone  6", "r3.timezone.6",
7134           FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00000040,
7135           NULL, HFILL }
7136       },
7137       { &hf_r3_timezonearray7,
7138         { "Timezone  7", "r3.timezone.7",
7139           FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00000080,
7140           NULL, HFILL }
7141       },
7142       { &hf_r3_timezonearray8,
7143         { "Timezone  8", "r3.timezone.8",
7144           FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00000100,
7145           NULL, HFILL }
7146       },
7147       { &hf_r3_timezonearray9,
7148         { "Timezone  9", "r3.timezone.9",
7149           FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00000200,
7150           NULL, HFILL }
7151       },
7152       { &hf_r3_timezonearray10,
7153         { "Timezone 10", "r3.timezone.10",
7154           FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00000400,
7155           NULL, HFILL }
7156       },
7157       { &hf_r3_timezonearray11,
7158         { "Timezone 11", "r3.timezone.11",
7159           FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00000800,
7160           NULL, HFILL }
7161       },
7162       { &hf_r3_timezonearray12,
7163         { "Timezone 12", "r3.timezone.12",
7164           FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00001000,
7165           NULL, HFILL }
7166       },
7167       { &hf_r3_timezonearray13,
7168         { "Timezone 13", "r3.timezone.13",
7169           FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00002000,
7170           NULL, HFILL }
7171       },
7172       { &hf_r3_timezonearray14,
7173         { "Timezone 14", "r3.timezone.14",
7174           FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00004000,
7175           NULL, HFILL }
7176       },
7177       { &hf_r3_timezonearray15,
7178         { "Timezone 15", "r3.timezone.15",
7179           FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00008000,
7180           NULL, HFILL }
7181       },
7182       { &hf_r3_timezonearray16,
7183         { "Timezone 16", "r3.timezone.16",
7184           FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00010000,
7185           NULL, HFILL }
7186       },
7187       { &hf_r3_timezonearray17,
7188         { "Timezone 17", "r3.timezone.17",
7189           FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00020000,
7190           NULL, HFILL }
7191       },
7192       { &hf_r3_timezonearray18,
7193         { "Timezone 18", "r3.timezone.18",
7194           FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00040000,
7195           NULL, HFILL }
7196       },
7197       { &hf_r3_timezonearray19,
7198         { "Timezone 19", "r3.timezone.19",
7199           FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00080000,
7200           NULL, HFILL }
7201       },
7202       { &hf_r3_timezonearray20,
7203         { "Timezone 20", "r3.timezone.20",
7204           FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00100000,
7205           NULL, HFILL }
7206       },
7207       { &hf_r3_timezonearray21,
7208         { "Timezone 21", "r3.timezone.21",
7209           FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00200000,
7210           NULL, HFILL }
7211       },
7212       { &hf_r3_timezonearray22,
7213         { "Timezone 22", "r3.timezone.22",
7214           FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00400000,
7215           NULL, HFILL }
7216       },
7217       { &hf_r3_timezonearray23,
7218         { "Timezone 23", "r3.timezone.23",
7219           FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00800000,
7220           NULL, HFILL }
7221       },
7222       { &hf_r3_timezonearray24,
7223         { "Timezone 24", "r3.timezone.24",
7224           FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x01000000,
7225           NULL, HFILL }
7226       },
7227       { &hf_r3_timezonearray25,
7228         { "Timezone 25", "r3.timezone.25",
7229           FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x02000000,
7230           NULL, HFILL }
7231       },
7232       { &hf_r3_timezonearray26,
7233         { "Timezone 26", "r3.timezone.26",
7234           FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x04000000,
7235           NULL, HFILL }
7236       },
7237       { &hf_r3_timezonearray27,
7238         { "Timezone 27", "r3.timezone.27",
7239           FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x08000000,
7240           NULL, HFILL }
7241       },
7242       { &hf_r3_timezonearray28,
7243         { "Timezone 28", "r3.timezone.28",
7244           FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x10000000,
7245           NULL, HFILL }
7246       },
7247       { &hf_r3_timezonearray29,
7248         { "Timezone 29", "r3.timezone.29",
7249           FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x20000000,
7250           NULL, HFILL }
7251       },
7252       { &hf_r3_timezonearray30,
7253         { "Timezone 30", "r3.timezone.30",
7254           FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x40000000,
7255           NULL, HFILL }
7256       },
7257       { &hf_r3_timezonearray31,
7258         { "Timezone 31", "r3.timezone.31",
7259           FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x80000000,
7260           NULL, HFILL }
7261       },
7262 
7263       { &hf_r3_expireon_year,
7264         { "Expiration Year", "r3.expireon.year",
7265           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7266           NULL, HFILL }
7267       },
7268       { &hf_r3_expireon_month,
7269         { "Expiration Month", "r3.expireon.month",
7270           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_monthnames_ext, 0x0,
7271           NULL, HFILL }
7272       },
7273       { &hf_r3_expireon_day,
7274         { "Expiration Day", "r3.expireon.day",
7275           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7276           NULL, HFILL }
7277       },
7278 
7279       { &hf_r3_datetime_year,
7280         { "Date/Time Year", "r3.datetime.year",
7281           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7282           NULL, HFILL }
7283       },
7284       { &hf_r3_datetime_month,
7285         { "Date/Time Month", "r3.datetime.month",
7286           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_monthnames_ext, 0x0,
7287           NULL, HFILL }
7288       },
7289       { &hf_r3_datetime_day,
7290         { "Date/Time Day", "r3.datetime.day",
7291           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7292           NULL, HFILL }
7293       },
7294       { &hf_r3_datetime_dow,
7295         { "Date/Time DOW", "r3.datetime.dow",
7296           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_daynames_ext, 0x0,
7297           NULL, HFILL }
7298       },
7299       { &hf_r3_datetime_hours,
7300         { "Date/Time Hours", "r3.datetime.hours",
7301           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7302           NULL, HFILL }
7303       },
7304       { &hf_r3_datetime_minutes,
7305         { "Date/Time Minutes", "r3.datetime.minutes",
7306           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7307           NULL, HFILL }
7308       },
7309       { &hf_r3_datetime_seconds,
7310         { "Date/Time Seconds", "r3.datetime.seconds",
7311           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7312           NULL, HFILL }
7313       },
7314       { &hf_r3_datetime_dst,
7315         { "Date/Time DST", "r3.datetime.dst",
7316           FT_BOOLEAN, BASE_NONE, NULL, 0x0,
7317           NULL, HFILL }
7318       },
7319 
7320       { &hf_r3_eventlog_recordnumber,
7321         { "Record Number", "r3.eventlog.recordnumber",
7322           FT_UINT16, BASE_DEC_HEX, NULL, 0x0,
7323           NULL, HFILL }
7324       },
7325       { &hf_r3_eventlog_year,
7326         { "Year", "r3.eventlog.year",
7327           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7328           NULL, HFILL }
7329       },
7330       { &hf_r3_eventlog_month,
7331         { "Month", "r3.eventlog.month",
7332           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_monthnames_ext, 0x0,
7333           NULL, HFILL }
7334       },
7335       { &hf_r3_eventlog_day,
7336         { "Day", "r3.eventlog.day",
7337           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7338           NULL, HFILL }
7339       },
7340       { &hf_r3_eventlog_hour,
7341         { "Hours", "r3.eventlog.hours",
7342           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7343           NULL, HFILL }
7344       },
7345       { &hf_r3_eventlog_minute,
7346         { "Minutes", "r3.eventlog.minutes",
7347           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7348           NULL, HFILL }
7349       },
7350       { &hf_r3_eventlog_second,
7351         { "Seconds", "r3.eventlog.seconds",
7352           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7353           NULL, HFILL }
7354       },
7355       { &hf_r3_eventlog_usernumber,
7356         { "User Number", "r3.eventlog.usernumber",
7357           FT_UINT16, BASE_DEC_HEX, NULL, 0x0,
7358           NULL, HFILL }
7359       },
7360       { &hf_r3_eventlog_event,
7361         { "ID", "r3.eventlog.id",
7362           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_eventnames_ext, 0x0,
7363           NULL, HFILL }
7364       },
7365 
7366       { &hf_r3_declinedlog_recordnumber,
7367         { "Record Number", "r3.declinedlog.recordnumber",
7368           FT_UINT16, BASE_DEC_HEX, NULL, 0x0,
7369           NULL, HFILL }
7370       },
7371       { &hf_r3_declinedlog_year,
7372         { "Year", "r3.declinedlog.year",
7373           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7374           NULL, HFILL }
7375       },
7376       { &hf_r3_declinedlog_month,
7377         { "Month", "r3.declinedlog.month",
7378           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_monthnames_ext, 0x0,
7379           NULL, HFILL }
7380       },
7381       { &hf_r3_declinedlog_day,
7382         { "Day", "r3.declinedlog.day",
7383           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7384           NULL, HFILL }
7385       },
7386       { &hf_r3_declinedlog_hour,
7387         { "Hours", "r3.declinedlog.hours",
7388           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7389           NULL, HFILL }
7390       },
7391       { &hf_r3_declinedlog_minute,
7392         { "Minutes", "r3.declinedlog.minutes",
7393           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7394           NULL, HFILL }
7395       },
7396       { &hf_r3_declinedlog_second,
7397         { "Seconds", "r3.declinedlog.seconds",
7398           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7399           NULL, HFILL }
7400       },
7401       { &hf_r3_declinedlog_usernumber,
7402         { "User Number", "r3.declinedlog.usernumber",
7403           FT_UINT16, BASE_DEC_HEX, NULL, 0x0,
7404           NULL, HFILL }
7405       },
7406       { &hf_r3_declinedlog_cred1type,
7407         { "Credential 1 Type", "r3.declinedlog.cred1type",
7408           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_fieldtypenames_ext, 0x0,
7409           NULL, HFILL }
7410       },
7411       { &hf_r3_declinedlog_cred2type,
7412         { "Credential 2 Type", "r3.declinedlog.cred2type",
7413           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_fieldtypenames_ext, 0x0,
7414           NULL, HFILL }
7415       },
7416       { &hf_r3_declinedlog_cred1,
7417         { "Credential 1", "r3.declinedlog.cred1",
7418           FT_BYTES, BASE_NONE, NULL, 0x0,
7419           NULL, HFILL }
7420       },
7421       { &hf_r3_declinedlog_cred2,
7422         { "Credential 2", "r3.declinedlog.cred2",
7423           FT_BYTES, BASE_NONE, NULL, 0x0,
7424           NULL, HFILL }
7425       },
7426 
7427       { &hf_r3_alarmlog_recordnumber,
7428         { "Record Number", "r3.alarmlog.recordnumber",
7429           FT_UINT16, BASE_DEC_HEX, NULL, 0x0,
7430           NULL, HFILL }
7431       },
7432       { &hf_r3_alarmlog_year,
7433         { "Year", "r3.alarmlog.year",
7434           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7435           NULL, HFILL }
7436       },
7437       { &hf_r3_alarmlog_month,
7438         { "Month", "r3.alarmlog.month",
7439           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_monthnames_ext, 0x0,
7440           NULL, HFILL }
7441       },
7442       { &hf_r3_alarmlog_day,
7443         { "Day", "r3.alarmlog.day",
7444           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7445           NULL, HFILL }
7446       },
7447       { &hf_r3_alarmlog_hour,
7448         { "Hours", "r3.alarmlog.hours",
7449           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7450           NULL, HFILL }
7451       },
7452       { &hf_r3_alarmlog_minute,
7453         { "Minutes", "r3.alarmlog.minutes",
7454           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7455           NULL, HFILL }
7456       },
7457       { &hf_r3_alarmlog_second,
7458         { "Seconds", "r3.alarmlog.seconds",
7459           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7460           NULL, HFILL }
7461       },
7462       { &hf_r3_alarmlog_id,
7463         { "ID", "r3.alarmlog.id",
7464           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_alarmidnames_ext, 0x0,
7465           NULL, HFILL }
7466       },
7467       { &hf_r3_alarmlog_usernumber,
7468         { "User Number", "r3.alarmlog.usernumber",
7469           FT_UINT16, BASE_DEC_HEX, NULL, 0x0,
7470           NULL, HFILL }
7471       },
7472 
7473       { &hf_r3_debugmsg,
7474         { "Debug Message", "r3.debug",
7475           FT_STRING, BASE_NONE, NULL, 0x0,
7476           NULL, HFILL }
7477       },
7478 
7479       { &hf_r3_setdate_year,
7480         { "Year", "r3.setdate.year",
7481           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7482           NULL, HFILL }
7483       },
7484       { &hf_r3_setdate_month,
7485         { "Month", "r3.setdate.month",
7486           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_monthnames_ext, 0x0,
7487           NULL, HFILL }
7488       },
7489       { &hf_r3_setdate_day,
7490         { "Day", "r3.setdate.day",
7491           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7492           NULL, HFILL }
7493       },
7494       { &hf_r3_setdate_dow,
7495         { "Day-Of-Week", "r3.setdate.dow",
7496           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_daynames_ext, 0x0,
7497           NULL, HFILL }
7498       },
7499       { &hf_r3_setdate_hours,
7500         { "Hours", "r3.setdate.hours",
7501           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7502           NULL, HFILL }
7503       },
7504       { &hf_r3_setdate_minutes,
7505         { "Minutes", "r3.setdate.minutes",
7506           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7507           NULL, HFILL }
7508       },
7509       { &hf_r3_setdate_seconds,
7510         { "Seconds", "r3.setdate.seconds",
7511           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7512           NULL, HFILL }
7513       },
7514 
7515       { &hf_r3_deleteusers,
7516         { "Delete Users", "r3.deleteusers",
7517           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_deleteusersnames_ext, 0x0,
7518           NULL, HFILL }
7519       },
7520 
7521       { &hf_r3_defineexception_number,
7522         { "Exception Number", "r3.defineexception.number",
7523           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7524           NULL, HFILL }
7525       },
7526       { &hf_r3_defineexception_startdate_month,
7527         { "Start Month", "r3.defineexception.start.month",
7528           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_monthnames_ext, 0x0,
7529           NULL, HFILL }
7530       },
7531       { &hf_r3_defineexception_startdate_day,
7532         { "Start Day", "r3.defineexception.start.day",
7533           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7534           NULL, HFILL }
7535       },
7536       { &hf_r3_defineexception_startdate_hours,
7537         { "Start Hours", "r3.defineexception.start.hours",
7538           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7539           NULL, HFILL }
7540       },
7541       { &hf_r3_defineexception_startdate_minutes,
7542         { "Start Minutes", "r3.defineexception.start.minutes",
7543           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7544           NULL, HFILL }
7545       },
7546       { &hf_r3_defineexception_enddate_month,
7547         { "End Month", "r3.defineexception.end.month",
7548           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_monthnames_ext, 0x0,
7549           NULL, HFILL }
7550       },
7551       { &hf_r3_defineexception_enddate_day,
7552         { "End Day", "r3.defineexception.end.day",
7553           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7554           NULL, HFILL }
7555       },
7556       { &hf_r3_defineexception_enddate_hours,
7557         { "End Hours", "r3.defineexception.end.hours",
7558           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7559           NULL, HFILL }
7560       },
7561       { &hf_r3_defineexception_enddate_minutes,
7562         { "End Minutes", "r3.defineexception.end.minutes",
7563           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7564           NULL, HFILL }
7565       },
7566 
7567       { &hf_r3_defineexceptiongroup_number,
7568         { "Define Exception Group Number", "r3.defineexceptiongroup.number",
7569           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7570           NULL, HFILL }
7571       },
7572       { &hf_r3_defineexceptiongroup_bits,
7573         { "Define Exception Group Bit Field", "r3.defineexceptiongroup.field",
7574           FT_NONE, BASE_NONE, NULL, 0x0,
7575           NULL, HFILL }
7576       },
7577 
7578       { &hf_r3_definecalendar_number,
7579         { "Define Calendar Number", "r3.definecalendar.number",
7580           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7581           NULL, HFILL }
7582       },
7583       { &hf_r3_definecalendar_bits,
7584         { "Define Calendar Bit Field", "r3.definecalendar.field",
7585           FT_NONE, BASE_NONE, NULL, 0x0,
7586           NULL, HFILL }
7587       },
7588 
7589       { &hf_r3_definetimezone_number,
7590         { "Timezone Number", "r3.definetimezone.number",
7591           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7592           NULL, HFILL }
7593       },
7594       { &hf_r3_definetimezone_starttime_hours,
7595         { "Start Hours", "r3.definetimezone.start.hours",
7596           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7597           NULL, HFILL }
7598       },
7599       { &hf_r3_definetimezone_starttime_minutes,
7600         { "Start Minutes", "r3.definetimezone.start.minutes",
7601           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7602           NULL, HFILL }
7603       },
7604       { &hf_r3_definetimezone_endtime_hours,
7605         { "End Hours", "r3.definetimezone.end.hours",
7606           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7607           NULL, HFILL }
7608       },
7609       { &hf_r3_definetimezone_endtime_minutes,
7610         { "End Minutes", "r3.definetimezone.end.minutes",
7611           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7612           NULL, HFILL }
7613       },
7614       { &hf_r3_definetimezone_daymap,
7615         { "Day Map", "r3.definetimezone.daymap",
7616           FT_UINT8, BASE_HEX, NULL, 0x0,
7617           NULL, HFILL }
7618       },
7619       { &hf_r3_definetimezone_daymap0,
7620         { "Sunday", "r3.definetimezone.daymap.sunday",
7621           FT_BOOLEAN, 8, TFS (&tfs_enabled_disabled), 0x00000001,
7622           NULL, HFILL }
7623       },
7624       { &hf_r3_definetimezone_daymap1,
7625         { "Monday", "r3.definetimezone.daymap.monday",
7626           FT_BOOLEAN, 8, TFS (&tfs_enabled_disabled), 0x00000002,
7627           NULL, HFILL }
7628       },
7629       { &hf_r3_definetimezone_daymap2,
7630         { "Tuesday", "r3.definetimezone.daymap.tuesday",
7631           FT_BOOLEAN, 8, TFS (&tfs_enabled_disabled), 0x00000004,
7632           NULL, HFILL }
7633       },
7634       { &hf_r3_definetimezone_daymap3,
7635         { "Wednesday", "r3.definetimezone.daymap.wednesday",
7636           FT_BOOLEAN, 8, TFS (&tfs_enabled_disabled), 0x00000008,
7637           NULL, HFILL }
7638       },
7639       { &hf_r3_definetimezone_daymap4,
7640         { "Thursday", "r3.definetimezone.daymap.thursday",
7641           FT_BOOLEAN, 8, TFS (&tfs_enabled_disabled), 0x00000010,
7642           NULL, HFILL }
7643       },
7644       { &hf_r3_definetimezone_daymap5,
7645         { "Friday", "r3.definetimezone.daymap.friday",
7646           FT_BOOLEAN, 8, TFS (&tfs_enabled_disabled), 0x00000020,
7647           NULL, HFILL }
7648       },
7649       { &hf_r3_definetimezone_daymap6,
7650         { "Saturday", "r3.definetimezone.daymap.saturday",
7651           FT_BOOLEAN, 8, TFS (&tfs_enabled_disabled), 0x00000040,
7652           NULL, HFILL }
7653       },
7654       { &hf_r3_definetimezone_exceptiongroup,
7655         { "Exception Group", "r3.definetimezone.exceptiongroup",
7656           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7657           NULL, HFILL }
7658       },
7659       { &hf_r3_definetimezone_mode,
7660         { "Mode", "r3.definetimezone.mode",
7661           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_timezonemodenames_ext, 0x0,
7662           NULL, HFILL }
7663       },
7664       { &hf_r3_definetimezone_calendar,
7665         { "Calendar", "r3.definetimezone.calendar",
7666           FT_NONE, BASE_NONE, NULL, 0x0,
7667           NULL, HFILL }
7668       },
7669 
7670       { &hf_r3_rmtauthretry_sequence,
7671         { "Remote Auth Retry Sequence", "r3.rmtauthretry.sequence",
7672           FT_UINT16, BASE_DEC_HEX, NULL, 0x0,
7673           NULL, HFILL }
7674       },
7675       { &hf_r3_rmtauthretry_retry,
7676         { "Remote Auth Retry Mode", "r3.rmtauthretry.mode",
7677           FT_BOOLEAN, BASE_NONE, TFS (&tfs_rmtauthretry_flags), 0x0,
7678           NULL, HFILL }
7679       },
7680 
7681       { &hf_r3_eventlogdump_starttime_year,
7682         { "Start Year", "r3.eventlogdump.start.year",
7683           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7684           NULL, HFILL }
7685       },
7686       { &hf_r3_eventlogdump_starttime_month,
7687         { "Start Month", "r3.eventlogdump.start.month",
7688           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_monthnames_ext, 0x0,
7689           NULL, HFILL }
7690       },
7691       { &hf_r3_eventlogdump_starttime_day,
7692         { "Start Day", "r3.eventlogdump.start.day",
7693           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7694           NULL, HFILL }
7695       },
7696       { &hf_r3_eventlogdump_starttime_hours,
7697         { "Start Hours", "r3.eventlogdump.start.hours",
7698           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7699           NULL, HFILL }
7700       },
7701       { &hf_r3_eventlogdump_starttime_minutes,
7702         { "Start Minutes", "r3.eventlogdump.start.minutes",
7703           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7704           NULL, HFILL }
7705       },
7706       { &hf_r3_eventlogdump_endtime_year,
7707         { "End Year", "r3.eventlogdump.end.year",
7708           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7709           NULL, HFILL }
7710       },
7711       { &hf_r3_eventlogdump_endtime_month,
7712         { "End Month", "r3.eventlogdump.end.month",
7713           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_monthnames_ext, 0x0,
7714           NULL, HFILL }
7715       },
7716       { &hf_r3_eventlogdump_endtime_day,
7717         { "End Day", "r3.eventlogdump.end.day",
7718           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7719           NULL, HFILL }
7720       },
7721       { &hf_r3_eventlogdump_endtime_hours,
7722         { "End Hours", "r3.eventlogdump.end.hours",
7723           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7724           NULL, HFILL }
7725       },
7726       { &hf_r3_eventlogdump_endtime_minutes,
7727         { "End Minutes", "r3.eventlogdump.end.minutes",
7728           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7729           NULL, HFILL }
7730       },
7731       { &hf_r3_eventlogdump_user,
7732         { "Filter User", "r3.eventlogdump.user",
7733           FT_UINT16, BASE_DEC_HEX, NULL, 0x0,
7734           NULL, HFILL }
7735       },
7736 
7737       { &hf_r3_declinedlogdump_starttime_year,
7738         { "Start Year", "r3.declinedlogdump.start.year",
7739           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7740           NULL, HFILL }
7741       },
7742       { &hf_r3_declinedlogdump_starttime_month,
7743         { "Start Month", "r3.declinedlogdump.start.month",
7744           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_monthnames_ext, 0x0,
7745           NULL, HFILL }
7746       },
7747       { &hf_r3_declinedlogdump_starttime_day,
7748         { "Start Day", "r3.declinedlogdump.start.day",
7749           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7750           NULL, HFILL }
7751       },
7752       { &hf_r3_declinedlogdump_starttime_hours,
7753         { "Start Hours", "r3.declinedlogdump.start.hours",
7754           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7755           NULL, HFILL }
7756       },
7757       { &hf_r3_declinedlogdump_starttime_minutes,
7758         { "Start Minutes", "r3.declinedlogdump.start.minutes",
7759           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7760           NULL, HFILL }
7761       },
7762       { &hf_r3_declinedlogdump_endtime_year,
7763         { "End Year", "r3.declinedlogdump.end.year",
7764           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7765           NULL, HFILL }
7766       },
7767       { &hf_r3_declinedlogdump_endtime_month,
7768         { "End Month", "r3.declinedlogdump.end.month",
7769           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_monthnames_ext, 0x0,
7770           NULL, HFILL }
7771       },
7772       { &hf_r3_declinedlogdump_endtime_day,
7773         { "End Day", "r3.declinedlogdump.end.day",
7774           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7775           NULL, HFILL }
7776       },
7777       { &hf_r3_declinedlogdump_endtime_hours,
7778         { "End Hours", "r3.declinedlogdump.end.hours",
7779           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7780           NULL, HFILL }
7781       },
7782       { &hf_r3_declinedlogdump_endtime_minutes,
7783         { "End Minutes", "r3.declinedlogdump.end.minutes",
7784           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7785           NULL, HFILL }
7786       },
7787 
7788       { &hf_r3_alarmlogdump_starttime_year,
7789         { "Start Year", "r3.alarmlogdump.start.year",
7790           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7791           NULL, HFILL }
7792       },
7793       { &hf_r3_alarmlogdump_starttime_month,
7794         { "Start Month", "r3.alarmlogdump.start.month",
7795           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_monthnames_ext, 0x0,
7796           NULL, HFILL }
7797       },
7798       { &hf_r3_alarmlogdump_starttime_day,
7799         { "Start Day", "r3.alarmlogdump.start.day",
7800           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7801           NULL, HFILL }
7802       },
7803       { &hf_r3_alarmlogdump_starttime_hours,
7804         { "Start Hours", "r3.alarmlogdump.start.hours",
7805           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7806           NULL, HFILL }
7807       },
7808       { &hf_r3_alarmlogdump_starttime_minutes,
7809         { "Start Minutes", "r3.alarmlogdump.start.minutes",
7810           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7811           NULL, HFILL }
7812       },
7813       { &hf_r3_alarmlogdump_endtime_year,
7814         { "End Year", "r3.alarmlogdump.end.year",
7815           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7816           NULL, HFILL }
7817       },
7818       { &hf_r3_alarmlogdump_endtime_month,
7819         { "End Month", "r3.alarmlogdump.end.month",
7820           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_monthnames_ext, 0x0,
7821           NULL, HFILL }
7822       },
7823       { &hf_r3_alarmlogdump_endtime_day,
7824         { "End Day", "r3.alarmlogdump.end.day",
7825           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7826           NULL, HFILL }
7827       },
7828       { &hf_r3_alarmlogdump_endtime_hours,
7829         { "End Hours", "r3.alarmlogdump.end.hours",
7830           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7831           NULL, HFILL }
7832       },
7833       { &hf_r3_alarmlogdump_endtime_minutes,
7834         { "End Minutes", "r3.alarmlogdump.end.minutes",
7835           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7836           NULL, HFILL }
7837       },
7838 
7839       { &hf_r3_nvramclearoptions,
7840         { "NVRAM Clean Options", "r3.nvramclear",
7841           FT_UINT16, BASE_HEX, NULL, 0x0,
7842           NULL, HFILL }
7843       },
7844       { &hf_r3_nvramclearoptions0,
7845         { "NVRAMCLEAROPTIONS_CFGINSTALLER", "r3.nvramclear.cfginstaller",
7846           FT_BOOLEAN, 16, TFS (&tfs_enabled_disabled), 0x00000001,
7847           NULL, HFILL }
7848       },
7849       { &hf_r3_nvramclearoptions1,
7850         { "NVRAMCLEAROPTIONS_CFGADMIN", "r3.nvramclear.cfgadmin",
7851           FT_BOOLEAN, 16, TFS (&tfs_enabled_disabled), 0x00000002,
7852           NULL, HFILL }
7853       },
7854       { &hf_r3_nvramclearoptions2,
7855         { "NVRAMCLEAROPTIONS_EXCEPTIONS", "r3.nvramclear.exceptions",
7856           FT_BOOLEAN, 16, TFS (&tfs_enabled_disabled), 0x00000004,
7857           NULL, HFILL }
7858       },
7859       { &hf_r3_nvramclearoptions3,
7860         { "NVRAMCLEAROPTIONS_EXCEPTIONGROUPS", "r3.nvramclear.exceptiongroups",
7861           FT_BOOLEAN, 16, TFS (&tfs_enabled_disabled), 0x00000008,
7862           NULL, HFILL }
7863       },
7864       { &hf_r3_nvramclearoptions4,
7865         { "NVRAMCLEAROPTIONS_CALENDARS", "r3.nvramclear.calendars",
7866           FT_BOOLEAN, 16, TFS (&tfs_enabled_disabled), 0x00000010,
7867           NULL, HFILL }
7868       },
7869       { &hf_r3_nvramclearoptions5,
7870         { "NVRAMCLEAROPTIONS_TIMEZONES", "r3.nvramclear.timezones",
7871           FT_BOOLEAN, 16, TFS (&tfs_enabled_disabled), 0x00000020,
7872           NULL, HFILL }
7873       },
7874       { &hf_r3_nvramclearoptions6,
7875         { "NVRAMCLEAROPTIONS_FILTERS", "r3.nvramclear.filters",
7876           FT_BOOLEAN, 16, TFS (&tfs_enabled_disabled), 0x00000040,
7877           NULL, HFILL }
7878       },
7879       { &hf_r3_nvramclearoptions7,
7880         { "NVRAMCLEAROPTIONS_EVENTLOG", "r3.nvramclear.eventlog",
7881           FT_BOOLEAN, 16, TFS (&tfs_enabled_disabled), 0x00000080,
7882           NULL, HFILL }
7883       },
7884       { &hf_r3_nvramclearoptions8,
7885         { "NVRAMCLEAROPTIONS_USERDATA", "r3.nvramclear.userdata",
7886           FT_BOOLEAN, 16, TFS (&tfs_enabled_disabled), 0x00000100,
7887           NULL, HFILL }
7888       },
7889       { &hf_r3_nvramclearoptions9,
7890         { "NVRAMCLEAROPTIONS_DECLINEDLOG", "r3.nvramclear.declinedlog",
7891           FT_BOOLEAN, 16, TFS (&tfs_enabled_disabled), 0x00000200,
7892           NULL, HFILL }
7893       },
7894       { &hf_r3_nvramclearoptions10,
7895         { "NVRAMCLEAROPTIONS_ALARMLOG", "r3.nvramclear.alarmlog",
7896           FT_BOOLEAN, 16, TFS (&tfs_enabled_disabled), 0x00000400,
7897           NULL, HFILL }
7898       },
7899       { &hf_r3_nvramclearoptions11,
7900         { "NVRAMCLEAROPTIONS_LRUCACHE", "r3.nvramclear.lrucache",
7901           FT_BOOLEAN, 16, TFS (&tfs_enabled_disabled), 0x00000800,
7902           NULL, HFILL }
7903       },
7904       { &hf_r3_nvramclearoptions12,
7905         { "NVRAMCLEAROPTIONS_DBHASH", "r3.nvramclear.dbhash",
7906           FT_BOOLEAN, 16, TFS (&tfs_enabled_disabled), 0x00001000,
7907           NULL, HFILL }
7908       },
7909       { &hf_r3_nvramclearoptions13,
7910         { "NVRAMCLEAROPTIONS_CFGSYSTEM", "r3.nvramclear.cfgsystem",
7911           FT_BOOLEAN, 16, TFS (&tfs_enabled_disabled), 0x00002000,
7912           NULL, HFILL }
7913       },
7914       { &hf_r3_nvramclearoptions14,
7915         { "NVRAMCLEAROPTIONS_UNUSED", "r3.nvramclear.unused",
7916           FT_BOOLEAN, 16, TFS (&tfs_enabled_disabled), 0x00004000,
7917           NULL, HFILL }
7918       },
7919       { &hf_r3_nvramclearoptions15,
7920         { "NVRAMCLEAROPTIONS_USEBACKUP", "r3.nvramclear.usebackup",
7921           FT_BOOLEAN, 16, TFS (&tfs_enabled_disabled), 0x00008000,
7922           NULL, HFILL }
7923       },
7924 
7925       { &hf_r3_writeeventlog_user,
7926         { "User", "r3.writeeventlog.user",
7927           FT_UINT16, BASE_DEC_HEX, NULL, 0x0,
7928           NULL, HFILL }
7929       },
7930       { &hf_r3_writeeventlog_event,
7931         { "Event", "r3.writeeventlog.event",
7932           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_eventnames_ext, 0x0,
7933           NULL, HFILL }
7934       },
7935 
7936       { &hf_r3_powertableselection,
7937         { "Table", "r3.powertableselection",
7938           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_powertablenames_ext, 0x0,
7939           NULL, HFILL }
7940       },
7941 
7942       { &hf_r3_filter_type,
7943         { "Type", "r3.filter.type",
7944           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_filtertypenames_ext, 0x0,
7945           NULL, HFILL }
7946       },
7947       { &hf_r3_filter_list,
7948         { "Event", "r3.filter.event",
7949           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_filtereventnames_ext, 0x0,
7950           NULL, HFILL }
7951       },
7952 
7953       { &hf_r3_alarm_length,
7954         { "Length", "r3.alarm.length",
7955           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7956           NULL, HFILL }
7957       },
7958       { &hf_r3_alarm_id,
7959         { "ID", "r3.alarm.id",
7960           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_alarmidnames_ext, 0x0,
7961           NULL, HFILL }
7962       },
7963       { &hf_r3_alarm_state,
7964         { "State", "r3.alarm.state",
7965           FT_BOOLEAN, BASE_NONE, TFS (&tfs_enabled_disabled), 0x0,
7966           NULL, HFILL }
7967       },
7968 
7969       /* XXX: start: Originally missing: Best guess */
7970       { &hf_r3_dpac_action,
7971         { "Dpac Action", "r3.dpac.action",
7972           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7973           NULL, HFILL }
7974       },
7975 
7976       { &hf_r3_dpac_waittime,
7977         { "Dpac Waittime", "r3.dpac.waittime",
7978           FT_UINT16, BASE_DEC_HEX, NULL, 0x0,
7979           NULL, HFILL }
7980       },
7981 
7982       { &hf_r3_dpac_command,
7983         { "Dpac Command", "r3.dpac.command",
7984           FT_BYTES, BASE_NONE, NULL, 0x0,
7985           NULL, HFILL }
7986       },
7987 
7988       { &hf_r3_dpacreply_stuff,
7989         { "Dpac Reply Stuff", "r3.dpacreply.stuff",
7990           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7991           NULL, HFILL }
7992       },
7993 
7994       { &hf_r3_dpacreply_length,
7995         { "Dpac Reply Length", "r3.dpacreply.length",
7996           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
7997           NULL, HFILL }
7998       },
7999 
8000       { &hf_r3_dpacreply_reply,
8001         { "Dpac Reply", "r3.dpacreply.reply",
8002           FT_BYTES, BASE_NONE, NULL, 0x0,
8003           NULL, HFILL }
8004       },
8005       /* XXX: end: Originally missing --- */
8006 
8007       { &hf_r3_mfgfield_length,
8008         { "Field Length", "r3.mfgfield.length",
8009           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
8010           NULL, HFILL }
8011       },
8012       { &hf_r3_mfgfield,
8013         { "Field", "r3.mfgfield.field",
8014           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_mfgfieldnames_ext, 0x0,
8015           NULL, HFILL }
8016       },
8017 #if 0
8018       { &hf_r3_mfgfield_data,
8019         { "Field Data", "r3.mfgfield.data",
8020           FT_NONE, BASE_NONE, NULL, 0x0,
8021           NULL, HFILL }
8022       },
8023 #endif
8024 
8025       { &hf_r3_mfgsetserialnumber,
8026         { "Serial Number", "r3.mfgsetserialnumber",
8027           FT_STRING, BASE_NONE, NULL, 0x0,
8028           NULL, HFILL }
8029       },
8030       { &hf_r3_mfgsetcryptkey,
8031         { "Crypt Key", "r3.mfgsetcryptkey",
8032           FT_BYTES, BASE_NONE, NULL, 0x0,
8033           NULL, HFILL }
8034       },
8035       { &hf_r3_mfgdumpnvram,
8036         { "NVRAM Section", "r3.mfgnvramdump",
8037           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_mfgnvramdumpnames_ext, 0x0,
8038           NULL, HFILL }
8039       },
8040       { &hf_r3_mfgremoteunlock,
8041         { "Remote Unlock", "r3.mfgremoteunlock",
8042           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_mfgremoteunlocknames_ext, 0x0,
8043           NULL, HFILL }
8044       },
8045       { &hf_r3_mfgtestpreserve,
8046         { "Preserve Mode", "r3.mfgtestpreserve",
8047           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_mfgtestpreservenames_ext, 0x0,
8048           NULL, HFILL }
8049       },
8050 
8051       { &hf_r3_adc [0],
8052         { "ADC 0", "r3.adc.0",
8053           FT_UINT8, BASE_HEX, NULL, 0x0,
8054           NULL, HFILL }
8055       },
8056       { &hf_r3_adc [1],
8057         { "ADC 1", "r3.adc.1",
8058           FT_UINT8, BASE_HEX, NULL, 0x0,
8059           NULL, HFILL }
8060       },
8061       { &hf_r3_adc [2],
8062         { "ADC 2", "r3.adc.2",
8063           FT_UINT8, BASE_HEX, NULL, 0x0,
8064           NULL, HFILL }
8065       },
8066       { &hf_r3_adc [3],
8067         { "ADC 3", "r3.adc.3",
8068           FT_UINT8, BASE_HEX, NULL, 0x0,
8069           NULL, HFILL }
8070       },
8071       { &hf_r3_adc [4],
8072         { "ADC 4", "r3.adc.4",
8073           FT_UINT8, BASE_HEX, NULL, 0x0,
8074           NULL, HFILL }
8075       },
8076       { &hf_r3_adc [5],
8077         { "ADC 5", "r3.adc.5",
8078           FT_UINT8, BASE_HEX, NULL, 0x0,
8079           NULL, HFILL }
8080       },
8081       { &hf_r3_adc [6],
8082         { "ADC 6", "r3.adc.6",
8083           FT_UINT8, BASE_HEX, NULL, 0x0,
8084           NULL, HFILL }
8085       },
8086       { &hf_r3_adc [7],
8087         { "ADC 7", "r3.adc.7",
8088           FT_UINT8, BASE_HEX, NULL, 0x0,
8089           NULL, HFILL }
8090       },
8091 
8092       { &hf_r3_hardwareid_board,
8093         { "Board ID", "r3.hardwareid.board",
8094           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
8095           NULL, HFILL }
8096       },
8097       { &hf_r3_hardwareid_cpuid,
8098         { "CPU ID", "r3.hardwareid.cpuid",
8099           FT_UINT16, BASE_DEC_HEX, NULL, 0x0,
8100           NULL, HFILL }
8101       },
8102       { &hf_r3_hardwareid_cpurev,
8103         { "CPU Rev", "r3.hardwareid.cpurev",
8104           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
8105           NULL, HFILL }
8106       },
8107 
8108       { &hf_r3_testkeypad,
8109         { "Keypad Char", "r3.test.keypad",
8110           FT_UINT8, BASE_HEX, NULL, 0x0,
8111           NULL, HFILL }
8112       },
8113       { &hf_r3_testmagcard,
8114         { "Mag Card", "r3.test.magcard",
8115           FT_STRING, BASE_NONE, NULL, 0x0,
8116           NULL, HFILL }
8117       },
8118       { &hf_r3_testproxcard,
8119         { "Prox Card", "r3.test.proxcard",
8120           FT_STRING, BASE_NONE, NULL, 0x0,
8121           NULL, HFILL }
8122       },
8123 
8124       { &hf_r3_nvramdump_record,
8125         { "Record Number", "r3.nvramdump.record",
8126           FT_UINT16, BASE_DEC_HEX, NULL, 0x0,
8127           NULL, HFILL }
8128       },
8129       { &hf_r3_nvramdump_length,
8130         { "Record Length", "r3.nvramdump.length",
8131           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
8132           NULL, HFILL }
8133       },
8134       { &hf_r3_nvramdump_data,
8135         { "Record Data", "r3.nvramdump.data",
8136           FT_NONE, BASE_NONE, NULL, 0x0,
8137           NULL, HFILL }
8138       },
8139 
8140       { &hf_r3_nvramdumprle_record,
8141         { "Record Number", "r3.nvramdumprle.record",
8142           FT_UINT24, BASE_DEC_HEX, NULL, 0x0,
8143           NULL, HFILL }
8144       },
8145       { &hf_r3_nvramdumprle_length,
8146         { "Record Length", "r3.nvramdumprle.length",
8147           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
8148           NULL, HFILL }
8149       },
8150       { &hf_r3_nvramdumprle_data,
8151         { "Record Data", "r3.nvramdumprle.data",
8152           FT_NONE, BASE_NONE, NULL, 0x0,
8153           NULL, HFILL }
8154       },
8155 
8156       { &hf_r3_iopins_lat,
8157         { "LAT", "r3.iopins.lat",
8158           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8159           NULL, HFILL }
8160       },
8161       { &hf_r3_iopins_port,
8162         { "PORT", "r3.iopins.port",
8163           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8164           NULL, HFILL }
8165       },
8166       { &hf_r3_iopins_tris,
8167         { "TRIS", "r3.iopins.tris",
8168           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8169           NULL, HFILL }
8170       },
8171 
8172       { &hf_r3_mortisepins_s1,
8173         { "Mortise Pin S1", "r3.mortisepins.s1",
8174           FT_BOOLEAN, 8, TFS (&tfs_high_low), 0x00000001,
8175           NULL, HFILL }
8176       },
8177       { &hf_r3_mortisepins_s2,
8178         { "Mortise Pin S2", "r3.mortisepins.s2",
8179           FT_BOOLEAN, 8, TFS (&tfs_high_low), 0x00000002,
8180           NULL, HFILL }
8181       },
8182       { &hf_r3_mortisepins_s3,
8183         { "Mortise Pin S3", "r3.mortisepins.s3",
8184           FT_BOOLEAN, 8, TFS (&tfs_high_low), 0x00000004,
8185           NULL, HFILL }
8186       },
8187       { &hf_r3_mortisepins_s4,
8188         { "Mortise Pin S4", "r3.mortisepins.s4",
8189           FT_BOOLEAN, 8, TFS (&tfs_high_low), 0x00000008,
8190           NULL, HFILL }
8191       },
8192 
8193       { &hf_r3_checksumresults ,
8194         { "Checksum Results", "r3.checksumresults",
8195           FT_NONE, BASE_NONE, NULL, 0x0,
8196           NULL, HFILL }
8197       },
8198       { &hf_r3_checksumresults_field,
8199         { "Field", "r3.checksumresults.field",
8200           FT_UINT8, BASE_HEX|BASE_EXT_STRING, & r3_checksumresultnames_ext, 0x0,
8201           NULL, HFILL }
8202       },
8203       { &hf_r3_checksumresults_length,
8204         { "Length", "r3.checksumresults.length",
8205           FT_UINT8, BASE_HEX, NULL, 0x0,
8206           NULL, HFILL }
8207       },
8208       { &hf_r3_checksumresults_state,
8209         { "State", "r3.checksumresults.state",
8210           FT_BOOLEAN, BASE_NONE, TFS (&tfs_errornoerror_flags), 0x0,
8211           NULL, HFILL }
8212       },
8213 
8214       { &hf_r3_forceoptions_item,
8215         { "Item", "r3.forceoptions.item",
8216           FT_UINT8, BASE_HEX_DEC|BASE_EXT_STRING, &r3_forceitemnames_ext, 0x0,
8217           NULL, HFILL }
8218       },
8219       { &hf_r3_forceoptions_length,
8220         { "Length", "r3.forceoptions.length",
8221           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8222           NULL, HFILL }
8223       },
8224       { &hf_r3_forceoptions_state_8,
8225         { "State", "r3.forceoptions.state",
8226           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8227           NULL, HFILL }
8228       },
8229       { &hf_r3_forceoptions_state_16,
8230         { "State", "r3.forceoptions.state",
8231           FT_UINT16, BASE_HEX_DEC, NULL, 0x0,
8232           NULL, HFILL }
8233       },
8234       { &hf_r3_forceoptions_state_24,
8235         { "State", "r3.forceoptions.state",
8236           FT_UINT24, BASE_HEX_DEC, NULL, 0x0,
8237           NULL, HFILL }
8238       },
8239       { &hf_r3_forceoptions_state_32,
8240         { "State", "r3.forceoptions.state",
8241           FT_UINT32, BASE_HEX_DEC, NULL, 0x0,
8242           NULL, HFILL }
8243       },
8244 
8245       { &hf_r3_peekpoke_operation,
8246         { "Operation", "r3.peekpoke.operation",
8247           FT_UINT8, BASE_HEX_DEC|BASE_EXT_STRING, &r3_peekpokenames_ext, 0x0,
8248           NULL, HFILL }
8249       },
8250       { &hf_r3_peekpoke_address,
8251         { "Address", "r3.peekpoke.address",
8252           FT_UINT16, BASE_HEX_DEC, NULL, 0x0,
8253           NULL, HFILL }
8254       },
8255       { &hf_r3_peekpoke_length,
8256         { "Length", "r3.peekpoke.length",
8257           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8258           NULL, HFILL }
8259       },
8260       { &hf_r3_peekpoke_poke8,
8261         { "8 Bit Value", "r3.peekpoke.poke8",
8262           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8263           NULL, HFILL }
8264       },
8265       { &hf_r3_peekpoke_poke16,
8266         { "16 Bit Value", "r3.peekpoke.poke16",
8267           FT_UINT16, BASE_HEX_DEC, NULL, 0x0,
8268           NULL, HFILL }
8269       },
8270       { &hf_r3_peekpoke_poke24,
8271         { "24 Bit Value", "r3.peekpoke.poke24",
8272           FT_UINT24, BASE_HEX_DEC, NULL, 0x0,
8273           NULL, HFILL }
8274       },
8275       { &hf_r3_peekpoke_poke32,
8276         { "32 Bit Value", "r3.peekpoke.poke32",
8277           FT_UINT32, BASE_HEX_DEC, NULL, 0x0,
8278           NULL, HFILL }
8279       },
8280       { &hf_r3_peekpoke_pokestring,
8281         { "String Value", "r3.peekpoke.pokestring",
8282           FT_BYTES, BASE_NONE, NULL, 0x0,
8283           NULL, HFILL }
8284       },
8285 
8286       { &hf_r3_firmwaredownload_length,
8287         { "Length", "r3.firmwaredownload.length",
8288           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8289           NULL, HFILL }
8290       },
8291       { &hf_r3_firmwaredownload_record,
8292         { "Record Number", "r3.firmwaredownload.record",
8293           FT_UINT16, BASE_HEX_DEC, NULL, 0x0,
8294           NULL, HFILL }
8295       },
8296       { &hf_r3_firmwaredownload_action,
8297         { "Action", "r3.firmwaredownload.action",
8298           FT_UINT8, BASE_HEX_DEC|BASE_EXT_STRING, &r3_downloadfirmwarenames_ext, 0x0,
8299           NULL, HFILL }
8300       },
8301       { &hf_r3_firmwaredownload_timeout,
8302         { "Timeout", "r3.firmwaredownload.timeout",
8303           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8304           NULL, HFILL }
8305       },
8306       { &hf_r3_firmwaredownload_nvram,
8307         { "NVRAM", "r3.firmwaredownload.nvram",
8308           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8309           NULL, HFILL }
8310       },
8311       { &hf_r3_firmwaredownload_address,
8312         { "Address", "r3.firmwaredownload.address",
8313           FT_UINT32, BASE_HEX_DEC, NULL, 0x0,
8314           NULL, HFILL }
8315       },
8316       { &hf_r3_firmwaredownload_bytes,
8317         { "Bytes", "r3.firmwaredownload.bytes",
8318           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8319           NULL, HFILL }
8320       },
8321       { &hf_r3_firmwaredownload_data,
8322         { "Data", "r3.firmwaredownload.data",
8323           FT_NONE, BASE_NONE, NULL, 0x0,
8324           NULL, HFILL }
8325       },
8326       { &hf_r3_firmwaredownload_crc,
8327         { "CRC", "r3.firmwaredownload.crc",
8328           FT_UINT16, BASE_HEX, NULL, 0x0,
8329           NULL, HFILL }
8330       },
8331       { &hf_r3_firmwaredownload_crc_bad,
8332         { "Bad CRC", "r3.firmwaredownload.crc_bad",
8333           FT_BOOLEAN, BASE_NONE, NULL, 0x0,
8334           NULL, HFILL }
8335       },
8336 
8337       { &hf_r3_nvramchecksumvalue,
8338         { "Value", "r3.nvramchecksum.value",
8339           FT_UINT32, BASE_HEX, NULL, 0x0,
8340           NULL, HFILL }
8341       },
8342       { &hf_r3_nvramchecksumvalue_fixup,
8343         { "Fixup", "r3.nvramchecksum.fixup",
8344           FT_UINT32, BASE_HEX, NULL, 0x0,
8345           NULL, HFILL }
8346       },
8347 
8348       { &hf_r3_capabilities,
8349         { "Capability", "r3.capabilities",
8350           FT_NONE, BASE_NONE, NULL, 0x0,
8351           NULL, HFILL }
8352       },
8353       { &hf_r3_capabilities_length,
8354         { "Length", "r3.capabilities.length",
8355           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8356           NULL, HFILL }
8357       },
8358       { &hf_r3_capabilities_type,
8359         { "Type", "r3.capabilities.type",
8360           FT_UINT8, BASE_HEX_DEC|BASE_EXT_STRING, &r3_capabilitiesnames_ext, 0x0,
8361           NULL, HFILL }
8362       },
8363       { &hf_r3_capabilities_value,
8364         { "Value", "r3.capabilities.value",
8365           FT_UINT16, BASE_HEX_DEC, NULL, 0x0,
8366           NULL, HFILL }
8367       },
8368 
8369       { &hf_r3_lockstate,
8370         { "Lock State", "r3.lockstate",
8371           FT_UINT24, BASE_HEX, NULL, 0x0,
8372           NULL, HFILL }
8373       },
8374 
8375       { &hf_r3_lockstate_passage,
8376         { "Passage", "r3.lockstate.passage",
8377           FT_BOOLEAN, 24, NULL, 0x00000001,
8378           NULL, HFILL }
8379       },
8380       { &hf_r3_lockstate_panic,
8381         { "Panic", "r3.lockstate.panic",
8382           FT_BOOLEAN, 24, NULL, 0x00000002,
8383           NULL, HFILL }
8384       },
8385       { &hf_r3_lockstate_lockout,
8386         { "Lockout", "r3.lockstate.lockout",
8387           FT_BOOLEAN, 24, NULL, 0x00000004,
8388           NULL, HFILL }
8389       },
8390       { &hf_r3_lockstate_relock,
8391         { "Relock", "r3.lockstate.relock",
8392           FT_BOOLEAN, 24, NULL, 0x00000008,
8393           NULL, HFILL }
8394       },
8395       { &hf_r3_lockstate_autoopen,
8396         { "Auto Open", "r3.lockstate.autoopen",
8397           FT_BOOLEAN, 24, NULL, 0x00000010,
8398           NULL, HFILL }
8399       },
8400       { &hf_r3_lockstate_nextauto,
8401         { "Next Auto", "r3.lockstate.nextauto",
8402           FT_BOOLEAN, 24, NULL, 0x00000020,
8403           NULL, HFILL }
8404       },
8405       { &hf_r3_lockstate_lockstate,
8406         { "Lock State", "r3.lockstate.lockstate",
8407           FT_BOOLEAN, 24, NULL, 0x00000040,
8408           NULL, HFILL }
8409       },
8410       { &hf_r3_lockstate_wantstate,
8411         { "Want State", "r3.lockstate.wantstate",
8412           FT_BOOLEAN, 24, NULL, 0x00000080,
8413           NULL, HFILL }
8414       },
8415       { &hf_r3_lockstate_remote,
8416         { "Remote", "r3.lockstate.remote",
8417           FT_BOOLEAN, 24, NULL, 0x00000100,
8418           NULL, HFILL }
8419       },
8420       { &hf_r3_lockstate_update,
8421         { "Update", "r3.lockstate.update",
8422           FT_BOOLEAN, 24, NULL, 0x00000200,
8423           NULL, HFILL }
8424       },
8425       { &hf_r3_lockstate_exceptionspresent,
8426         { "Exceptions Present", "r3.lockstate.exceptionspresent",
8427           FT_BOOLEAN, 24, NULL, 0x00000400,
8428           NULL, HFILL }
8429       },
8430       { &hf_r3_lockstate_exceptionsactive,
8431         { "Exceptions Active", "r3.lockstate.exceptionsactive",
8432           FT_BOOLEAN, 24, NULL, 0x00000800,
8433           NULL, HFILL }
8434       },
8435       { &hf_r3_lockstate_timezonespresent,
8436         { "Timezones Presents", "r3.lockstate.timezonespresent",
8437           FT_BOOLEAN, 24, NULL, 0x00001000,
8438           NULL, HFILL }
8439       },
8440       { &hf_r3_lockstate_timezonesactive,
8441         { "Timezones Active", "r3.lockstate.timezonesactive",
8442           FT_BOOLEAN, 24, NULL, 0x00002000,
8443           NULL, HFILL }
8444       },
8445       { &hf_r3_lockstate_autounlockspresent,
8446         { "Auto Unlocks Present", "r3.lockstate.autounlockspresent",
8447           FT_BOOLEAN, 24, NULL, 0x00004000,
8448           NULL, HFILL }
8449       },
8450       { &hf_r3_lockstate_autounlocksactive,
8451         { "Auto Unlocks Active", "r3.lockstate.autounlocksactive",
8452           FT_BOOLEAN, 24, NULL, 0x00008000,
8453           NULL, HFILL }
8454       },
8455       { &hf_r3_lockstate_uapmspresent,
8456         { "UAPMs Present", "r3.lockstate.uapmspresent",
8457           FT_BOOLEAN, 24, NULL, 0x00010000,
8458           NULL, HFILL }
8459       },
8460       { &hf_r3_lockstate_uapmsactive,
8461         { "UAPMs Active", "r3.lockstate.uapmsactive",
8462           FT_BOOLEAN, 24, NULL, 0x00020000,
8463           NULL, HFILL }
8464       },
8465       { &hf_r3_lockstate_uapmrelockspresent,
8466         { "UAPM Relocks Present", "r3.lockstate.uapmrelockspresent",
8467           FT_BOOLEAN, 24, NULL, 0x00040000,
8468           NULL, HFILL }
8469       },
8470       { &hf_r3_lockstate_uapmreslocksactive,
8471         { "UAPM Relocks Active", "r3.lockstate.uapmreslocksactive",
8472           FT_BOOLEAN, 24, NULL, 0x00080000,
8473           NULL, HFILL }
8474       },
8475       { &hf_r3_lockstate_nvramprotect,
8476         { "NVRAM Protect", "r3.lockstate.nvramprotect",
8477           FT_BOOLEAN, 24, NULL, 0x00100000,
8478           NULL, HFILL }
8479       },
8480       { &hf_r3_lockstate_nvramchecksum,
8481         { "MVRAM Checksum", "r3.lockstate.nvramchecksum",
8482           FT_BOOLEAN, 24, NULL, 0x00200000,
8483           NULL, HFILL }
8484       },
8485 
8486 #if 0
8487       { &hf_r3_mortisestatelog,
8488         { "Mortise State Log", "r3.mortisestatelog",
8489           FT_NONE, BASE_NONE, NULL, 0x0,
8490           NULL, HFILL }
8491       },
8492 #endif
8493       { &hf_r3_mortisestatelog_pointer,
8494         { "Event Pointer", "r3.mortisestatelog.pointer",
8495           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8496           NULL, HFILL }
8497       },
8498       { &hf_r3_mortisestatelog_mortisetype,
8499         { "Mortise Type", "r3.mortisestatelog.mortisetype",
8500           FT_UINT8, BASE_HEX_DEC|BASE_EXT_STRING, &r3_mortisetypenames_ext, 0x0,
8501           NULL, HFILL }
8502       },
8503       { &hf_r3_mortisestatelog_waiting,
8504         { "Waiting For Door Closed", "r3.mortisestatelog.waiting",
8505           FT_BOOLEAN, BASE_NONE, TFS (&tfs_true_false ), 0x00,
8506           NULL, HFILL }
8507       },
8508       { &hf_r3_mortisestatelog_state,
8509         { "State", "r3.mortisestatelog.state",
8510           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8511           NULL, HFILL }
8512       },
8513       { &hf_r3_mortisestatelog_last,
8514         { "Last State", "r3.mortisestatelog.laststate",
8515           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8516           NULL, HFILL }
8517       },
8518       { &hf_r3_mortisestatelog_event,
8519         { "Event", "r3.mortisestatelog.event",
8520           FT_UINT8, BASE_HEX_DEC|BASE_EXT_STRING, &r3_mortiseeventnames_ext, 0x0,
8521           NULL, HFILL }
8522       },
8523 
8524       { &hf_r3_timerchain_newtick,
8525         { "New Tick", "r3.timerchain.newtick",
8526           FT_UINT16, BASE_HEX_DEC, NULL, 0x0,
8527           NULL, HFILL }
8528       },
8529       { &hf_r3_timerchain_currentboundary,
8530         { "Current Boundary", "r3.timerchain.currentboundary",
8531           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8532           NULL, HFILL }
8533       },
8534       { &hf_r3_timerchain_tasktag,
8535         { "Task Tag", "r3.timerchain.tasktag",
8536           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8537           NULL, HFILL }
8538       },
8539       { &hf_r3_timerchain_address,
8540         { "Address", "r3.timerchain.address",
8541           FT_UINT16, BASE_HEX_DEC, NULL, 0x0,
8542           NULL, HFILL }
8543       },
8544       { &hf_r3_timerchain_reload,
8545         { "Reload", "r3.timerchain.reload",
8546           FT_UINT16, BASE_HEX_DEC, NULL, 0x0,
8547           NULL, HFILL }
8548       },
8549       { &hf_r3_timerchain_boundary,
8550         { "Boundary", "r3.timerchain.boundary",
8551           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8552           NULL, HFILL }
8553       },
8554       { &hf_r3_timerchain_count,
8555         { "Count", "r3.timerchain.count",
8556           FT_UINT16, BASE_HEX_DEC, NULL, 0x0,
8557           NULL, HFILL }
8558       },
8559       { &hf_r3_timerchain_flags,
8560         { "Flags", "r3.timerchain.flags",
8561           FT_UINT32, BASE_HEX, NULL, 0x0,
8562           NULL, HFILL }
8563       },
8564 
8565       { &hf_r3_taskflags_taskid,
8566         { "Task ID", "r3.taskflags.taskid",
8567           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8568           NULL, HFILL }
8569       },
8570       { &hf_r3_taskflags_flags,
8571         { "Flags", "r3.taskflags.flags",
8572           FT_UINT32, BASE_HEX, NULL, 0x0,
8573           NULL, HFILL }
8574       },
8575 
8576       { &hf_r3_checkpointlog_entryptr,
8577         { "Entry Pointer", "r3.checkpointlog.entrypointer",
8578           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8579           NULL, HFILL }
8580       },
8581       { &hf_r3_checkpointlog_rcon,
8582         { "RCON", "r3.checkpointlog.rcon",
8583           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8584           NULL, HFILL }
8585       },
8586       { &hf_r3_checkpointlog_checkpoint,
8587         { "Checkpoint", "r3.checkpointlog.checkpoint",
8588           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8589           NULL, HFILL }
8590       },
8591 
8592       { &hf_r3_cpuregisters_intcon,
8593         { "INTCON", "r3.cpuregisters.intcon",
8594           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8595           NULL, HFILL }
8596       },
8597       { &hf_r3_cpuregisters_intcon2,
8598         { "INTCON2", "r3.cpuregisters.intcon2",
8599           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8600           NULL, HFILL }
8601       },
8602       { &hf_r3_cpuregisters_intcon3,
8603         { "INTCON3", "r3.cpuregisters.intcon3",
8604           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8605           NULL, HFILL }
8606       },
8607       { &hf_r3_cpuregisters_pir1,
8608         { "PIR1", "r3.cpuregisters.pir1",
8609           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8610           NULL, HFILL }
8611       },
8612       { &hf_r3_cpuregisters_pir2,
8613         { "PIR2", "r3.cpuregisters.pir2",
8614           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8615           NULL, HFILL }
8616       },
8617       { &hf_r3_cpuregisters_pir3,
8618         { "PIR3", "r3.cpuregisters.pir3",
8619           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8620           NULL, HFILL }
8621       },
8622       { &hf_r3_cpuregisters_pie1,
8623         { "PIE1", "r3.cpuregisters.pie1",
8624           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8625           NULL, HFILL }
8626       },
8627       { &hf_r3_cpuregisters_pie2,
8628         { "PIE2", "r3.cpuregisters.pie2",
8629           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8630           NULL, HFILL }
8631       },
8632       { &hf_r3_cpuregisters_pie3,
8633         { "PIE3", "r3.cpuregisters.pie3",
8634           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8635           NULL, HFILL }
8636       },
8637       { &hf_r3_cpuregisters_ipr1,
8638         { "IPR1", "r3.cpuregisters.ipr1",
8639           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8640           NULL, HFILL }
8641       },
8642       { &hf_r3_cpuregisters_ipr2,
8643         { "IPR2", "r3.cpuregisters.ipr2",
8644           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8645           NULL, HFILL }
8646       },
8647       { &hf_r3_cpuregisters_ipr3,
8648         { "IPR3", "r3.cpuregisters.ipr3",
8649           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8650           NULL, HFILL }
8651       },
8652       { &hf_r3_cpuregisters_rcon,
8653         { "RCON", "r3.cpuregisters.rcon",
8654           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8655           NULL, HFILL }
8656       },
8657       { &hf_r3_cpuregisters_osccon,
8658         { "OSCCON", "r3.cpuregisters.osccon",
8659           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8660           NULL, HFILL }
8661       },
8662       { &hf_r3_cpuregisters_rcsta,
8663         { "RCSTA", "r3.cpuregisters.rcsta",
8664           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8665           NULL, HFILL }
8666       },
8667       { &hf_r3_cpuregisters_txsta,
8668         { "TXSTA", "r3.cpuregisters.txsta",
8669           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8670           NULL, HFILL }
8671       },
8672       { &hf_r3_cpuregisters_rcsta2,
8673         { "RCSTA2", "r3.cpuregisters.rcsta2",
8674           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8675           NULL, HFILL }
8676       },
8677       { &hf_r3_cpuregisters_txsta2,
8678         { "TXSTA2", "r3.cpuregisters.txsta2",
8679           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8680           NULL, HFILL }
8681       },
8682       { &hf_r3_cpuregisters_wdtcon,
8683         { "WDTCON", "r3.cpuregisters.wdtcon",
8684           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8685           NULL, HFILL }
8686       },
8687 
8688       { &hf_r3_cpuregisters_intcon_rbif,
8689         { "INTCON.RBIF", "r3.cpuregisters.intcon.rbif",
8690           FT_BOOLEAN, 8, NULL, 0x01,
8691           NULL, HFILL }
8692       },
8693       { &hf_r3_cpuregisters_intcon_int0if,
8694         { "INTCON.INT0IF", "r3.cpuregisters.intcon.int0if",
8695           FT_BOOLEAN, 8, NULL, 0x02,
8696           NULL, HFILL }
8697       },
8698       { &hf_r3_cpuregisters_intcon_tmr0if,
8699         { "INTCON.TMR0IF", "r3.cpuregisters.intcon.tmr0if",
8700           FT_BOOLEAN, 8, NULL, 0x04,
8701           NULL, HFILL }
8702       },
8703       { &hf_r3_cpuregisters_intcon_rbie,
8704         { "INTCON.RBIE", "r3.cpuregisters.intcon.rbie",
8705           FT_BOOLEAN, 8, NULL, 0x08,
8706           NULL, HFILL }
8707       },
8708       { &hf_r3_cpuregisters_intcon_int0ie,
8709         { "INTCON.INT0IE", "r3.cpuregisters.intcon.int0ie",
8710           FT_BOOLEAN, 8, NULL, 0x10,
8711           NULL, HFILL }
8712       },
8713       { &hf_r3_cpuregisters_intcon_tmr0ie,
8714         { "INTCON.TMR0IE", "r3.cpuregisters.intcon.tmr0ie",
8715           FT_BOOLEAN, 8, NULL, 0x20,
8716           NULL, HFILL }
8717       },
8718       { &hf_r3_cpuregisters_intcon_giel,
8719         { "INTCON.GIEL", "r3.cpuregisters.intcon.giel",
8720           FT_BOOLEAN, 8, NULL, 0x40,
8721           NULL, HFILL }
8722       },
8723       { &hf_r3_cpuregisters_intcon_gieh,
8724         { "INTCON.GIEH", "r3.cpuregisters.intcon.gieh",
8725           FT_BOOLEAN, 8, NULL, 0x80,
8726           NULL, HFILL }
8727       },
8728       { &hf_r3_cpuregisters_intcon2_rbip,
8729         { "INTCON2.RBIP", "r3_cpuregisters_intcon2_rbip",
8730           FT_BOOLEAN, 8, NULL, 0x01,
8731           NULL, HFILL }
8732       },
8733       { &hf_r3_cpuregisters_intcon2_int3ip,
8734         { "INTCON2.INT3IP", "r3_cpuregisters_intcon2_int3ip",
8735           FT_BOOLEAN, 8, NULL, 0x02,
8736           NULL, HFILL }
8737       },
8738       { &hf_r3_cpuregisters_intcon2_tmr0ip,
8739         { "INTCON2.TMR0IP", "r3_cpuregisters_intcon2_tmr0ip",
8740           FT_BOOLEAN, 8, NULL, 0x04,
8741           NULL, HFILL }
8742       },
8743       { &hf_r3_cpuregisters_intcon2_intedg3,
8744         { "INTCON2.INTEDG3", "r3_cpuregisters_intcon2_intedg3",
8745           FT_BOOLEAN, 8, NULL, 0x08,
8746           NULL, HFILL }
8747       },
8748       { &hf_r3_cpuregisters_intcon2_intedg2,
8749         { "INTCON2.INTEDG2", "r3_cpuregisters_intcon2_intedg2",
8750           FT_BOOLEAN, 8, NULL, 0x10,
8751           NULL, HFILL }
8752       },
8753       { &hf_r3_cpuregisters_intcon2_intedg1,
8754         { "INTCON2.INTEDG1", "r3_cpuregisters_intcon2_intedg1",
8755           FT_BOOLEAN, 8, NULL, 0x20,
8756           NULL, HFILL }
8757       },
8758       { &hf_r3_cpuregisters_intcon2_intedg0,
8759         { "INTCON2.INTEDG0", "r3_cpuregisters_intcon2_intedg0",
8760           FT_BOOLEAN, 8, NULL, 0x40,
8761           NULL, HFILL }
8762       },
8763       { &hf_r3_cpuregisters_intcon2_rbpu,
8764         { "INTCON2.RBPU", "r3_cpuregisters_intcon2_rbpu",
8765           FT_BOOLEAN, 8, NULL, 0x80,
8766           NULL, HFILL }
8767       },
8768       { &hf_r3_cpuregisters_intcon3_int1if,
8769         { "INTCON3.INT1IF", "r3.cpuregisters.intcon3.int1if",
8770           FT_BOOLEAN, 8, NULL, 0x01,
8771           NULL, HFILL }
8772       },
8773       { &hf_r3_cpuregisters_intcon3_int2if,
8774         { "INTCON3.INT2IF", "r3.cpuregisters.intcon3.int2if",
8775           FT_BOOLEAN, 8, NULL, 0x02,
8776           NULL, HFILL }
8777       },
8778       { &hf_r3_cpuregisters_intcon3_int3if,
8779         { "INTCON3.INT3IF", "r3.cpuregisters.intcon3.int3if",
8780           FT_BOOLEAN, 8, NULL, 0x04,
8781           NULL, HFILL }
8782       },
8783       { &hf_r3_cpuregisters_intcon3_int1ie,
8784         { "INTCON3.INT1IE", "r3.cpuregisters.intcon3.int1ie",
8785           FT_BOOLEAN, 8, NULL, 0x08,
8786           NULL, HFILL }
8787       },
8788       { &hf_r3_cpuregisters_intcon3_int2ie,
8789         { "INTCON3.INT2IE", "r3.cpuregisters.intcon3.int2ie",
8790           FT_BOOLEAN, 8, NULL, 0x10,
8791           NULL, HFILL }
8792       },
8793       { &hf_r3_cpuregisters_intcon3_int3ie,
8794         { "INTCON3.INT3IE", "r3.cpuregisters.intcon3.int3ie",
8795           FT_BOOLEAN, 8, NULL, 0x20,
8796           NULL, HFILL }
8797       },
8798       { &hf_r3_cpuregisters_intcon3_int1ip,
8799         { "INTCON3.INT1IP", "r3.cpuregisters.intcon3.int1ip",
8800           FT_BOOLEAN, 8, NULL, 0x40,
8801           NULL, HFILL }
8802       },
8803       { &hf_r3_cpuregisters_intcon3_int2ip,
8804         { "INTCON3.INT2IP", "r3.cpuregisters.intcon3.int2ip",
8805           FT_BOOLEAN, 8, NULL, 0x80,
8806           NULL, HFILL }
8807       },
8808       { &hf_r3_cpuregisters_pir1_tmr1if,
8809         { "PIR1.TMR1IF", "r3.cpuregisters.pir1.tmr1if",
8810           FT_BOOLEAN, 8, NULL, 0x01,
8811           NULL, HFILL }
8812       },
8813       { &hf_r3_cpuregisters_pir1_tmr2if,
8814         { "PIR1.TMR2IF", "r3.cpuregisters.pir1.tmr2if",
8815           FT_BOOLEAN, 8, NULL, 0x02,
8816           NULL, HFILL }
8817       },
8818       { &hf_r3_cpuregisters_pir1_ccp1if,
8819         { "PIR1.CCP1IF", "r3.cpuregisters.pir1.ccp1if",
8820           FT_BOOLEAN, 8, NULL, 0x04,
8821           NULL, HFILL }
8822       },
8823       { &hf_r3_cpuregisters_pir1_ssp1if,
8824         { "PIR1.SSP1IF", "r3.cpuregisters.pir1.ssp1if",
8825           FT_BOOLEAN, 8, NULL, 0x08,
8826           NULL, HFILL }
8827       },
8828       { &hf_r3_cpuregisters_pir1_tx1if,
8829         { "PIR1.TX1IF", "r3.cpuregisters.pir1.tx1if",
8830           FT_BOOLEAN, 8, NULL, 0x10,
8831           NULL, HFILL }
8832       },
8833       { &hf_r3_cpuregisters_pir1_rc1if,
8834         { "PIR1.RC1IF", "r3.cpuregisters.pir1.rc1if",
8835           FT_BOOLEAN, 8, NULL, 0x20,
8836           NULL, HFILL }
8837       },
8838       { &hf_r3_cpuregisters_pir1_adif,
8839         { "PIR1.ADIF", "r3.cpuregisters.pir1.adif",
8840           FT_BOOLEAN, 8, NULL, 0x40,
8841           NULL, HFILL }
8842       },
8843       { &hf_r3_cpuregisters_pir1_pspif,
8844         { "PIR1.PSPIF", "r3.cpuregisters.pir1.pspif",
8845           FT_BOOLEAN, 8, NULL, 0x80,
8846           NULL, HFILL }
8847       },
8848       { &hf_r3_cpuregisters_pir2_ccp2if,
8849         { "PIR2.CCP2IF", "r3.cpuregisters.pir2.ccp2if",
8850           FT_BOOLEAN, 8, NULL, 0x01,
8851           NULL, HFILL }
8852       },
8853       { &hf_r3_cpuregisters_pir2_tmr3if,
8854         { "PIR2.TMR3IF", "r3.cpuregisters.pir2.tmr3if",
8855           FT_BOOLEAN, 8, NULL, 0x02,
8856           NULL, HFILL }
8857       },
8858       { &hf_r3_cpuregisters_pir2_hlvdif,
8859         { "PIR2.HLVDIF", "r3.cpuregisters.pir2.hlvdif",
8860           FT_BOOLEAN, 8, NULL, 0x04,
8861           NULL, HFILL }
8862       },
8863       { &hf_r3_cpuregisters_pir2_bcl1if,
8864         { "PIR2.BCL1IF", "r3.cpuregisters.pir2.bcl1if",
8865           FT_BOOLEAN, 8, NULL, 0x08,
8866           NULL, HFILL }
8867       },
8868       { &hf_r3_cpuregisters_pir2_eeif,
8869         { "PIR2.EEIF", "r3.cpuregisters.pir2.eeif",
8870           FT_BOOLEAN, 8, NULL, 0x10,
8871           NULL, HFILL }
8872       },
8873       { &hf_r3_cpuregisters_pir2_unused5,
8874         { "PIR2.UNUSED5", "r3.cpuregisters.pir2.unused5",
8875           FT_BOOLEAN, 8, NULL, 0x20,
8876           NULL, HFILL }
8877       },
8878       { &hf_r3_cpuregisters_pir2_cmif,
8879         { "PIR2.CMIF", "r3.cpuregisters.pir2.cmif",
8880           FT_BOOLEAN, 8, NULL, 0x40,
8881           NULL, HFILL }
8882       },
8883       { &hf_r3_cpuregisters_pir2_oscfif,
8884         { "PIR2.OSCFIF", "r3.cpuregisters.pir2.oscfif",
8885           FT_BOOLEAN, 8, NULL, 0x80,
8886           NULL, HFILL }
8887       },
8888       { &hf_r3_cpuregisters_pir3_ccp3if,
8889         { "PIR3.CCP3IF", "r3.cpuregisters.pir3.ccp3if",
8890           FT_BOOLEAN, 8, NULL, 0x01,
8891           NULL, HFILL }
8892       },
8893       { &hf_r3_cpuregisters_pir3_ccp4if,
8894         { "PIR3.CCP4IF", "r3.cpuregisters.pir3.ccp4if",
8895           FT_BOOLEAN, 8, NULL, 0x02,
8896           NULL, HFILL }
8897       },
8898       { &hf_r3_cpuregisters_pir3_ccp5if,
8899         { "PIR3.CCP5IF", "r3.cpuregisters.pir3.ccp5if",
8900           FT_BOOLEAN, 8, NULL, 0x04,
8901           NULL, HFILL }
8902       },
8903       { &hf_r3_cpuregisters_pir3_tmr4if,
8904         { "PIR3.TMR4IF", "r3.cpuregisters.pir3.tmr4if",
8905           FT_BOOLEAN, 8, NULL, 0x08,
8906           NULL, HFILL }
8907       },
8908       { &hf_r3_cpuregisters_pir3_tx2if,
8909         { "PIR3.TX2IF", "r3.cpuregisters.pir3.tx2if",
8910           FT_BOOLEAN, 8, NULL, 0x10,
8911           NULL, HFILL }
8912       },
8913       { &hf_r3_cpuregisters_pir3_rc2if,
8914         { "PIR3.RC2IF", "r3.cpuregisters.pir3.rc2if",
8915           FT_BOOLEAN, 8, NULL, 0x20,
8916           NULL, HFILL }
8917       },
8918       { &hf_r3_cpuregisters_pir3_bcl2if,
8919         { "PIR3.BCL2IF", "r3.cpuregisters.pir3.bcl2if",
8920           FT_BOOLEAN, 8, NULL, 0x40,
8921           NULL, HFILL }
8922       },
8923       { &hf_r3_cpuregisters_pir3_ssp2if,
8924         { "PIR3.SSP2IF", "r3.cpuregisters.pir3.ssp2if",
8925           FT_BOOLEAN, 8, NULL, 0x80,
8926           NULL, HFILL }
8927       },
8928       { &hf_r3_cpuregisters_pie1_tmr1ie,
8929         { "PIE1.TMR1IE", "r3.cpuregisters.pie1.tmr1ie",
8930           FT_BOOLEAN, 8, NULL, 0x01,
8931           NULL, HFILL }
8932       },
8933       { &hf_r3_cpuregisters_pie1_tmr2ie,
8934         { "PIE1.TMR2IE", "r3.cpuregisters.pie1.tmr2ie",
8935           FT_BOOLEAN, 8, NULL, 0x02,
8936           NULL, HFILL }
8937       },
8938       { &hf_r3_cpuregisters_pie1_ccp1ie,
8939         { "PIE1.CCP1IE", "r3.cpuregisters.pie1.ccp1ie",
8940           FT_BOOLEAN, 8, NULL, 0x04,
8941           NULL, HFILL }
8942       },
8943       { &hf_r3_cpuregisters_pie1_ssp1ie,
8944         { "PIE1.SSP1IE", "r3.cpuregisters.pie1.ssp1ie",
8945           FT_BOOLEAN, 8, NULL, 0x08,
8946           NULL, HFILL }
8947       },
8948       { &hf_r3_cpuregisters_pie1_tx1ie,
8949         { "PIE1.TX1IE", "r3.cpuregisters.pie1.tx1ie",
8950           FT_BOOLEAN, 8, NULL, 0x10,
8951           NULL, HFILL }
8952       },
8953       { &hf_r3_cpuregisters_pie1_rc1ie,
8954         { "PIE1.RC1IE", "r3.cpuregisters.pie1.rc1ie",
8955           FT_BOOLEAN, 8, NULL, 0x20,
8956           NULL, HFILL }
8957       },
8958       { &hf_r3_cpuregisters_pie1_adie,
8959         { "PIE1.ADIE", "r3.cpuregisters.pie1.adie",
8960           FT_BOOLEAN, 8, NULL, 0x40,
8961           NULL, HFILL }
8962       },
8963       { &hf_r3_cpuregisters_pie1_pspie,
8964         { "PIE1.PSPIE", "r3.cpuregisters.pie1.pspie",
8965           FT_BOOLEAN, 8, NULL, 0x80,
8966           NULL, HFILL }
8967       },
8968       { &hf_r3_cpuregisters_pie2_oscfie,
8969         { "PIE2.OSCFIE", "r3.cpuregisters.pie2.oscfie",
8970           FT_BOOLEAN, 8, NULL, 0x01,
8971           NULL, HFILL }
8972       },
8973       { &hf_r3_cpuregisters_pie2_cmie,
8974         { "PIE2.CMIE", "r3.cpuregisters.pie2.cmie",
8975           FT_BOOLEAN, 8, NULL, 0x02,
8976           NULL, HFILL }
8977       },
8978       { &hf_r3_cpuregisters_pie2_unused2,
8979         { "PIE2.UNUSED2", "r3.cpuregisters.pie2.unused2",
8980           FT_BOOLEAN, 8, NULL, 0x04,
8981           NULL, HFILL }
8982       },
8983       { &hf_r3_cpuregisters_pie2_eeie,
8984         { "PIE2.EEIE", "r3.cpuregisters.pie2.eeie",
8985           FT_BOOLEAN, 8, NULL, 0x08,
8986           NULL, HFILL }
8987       },
8988       { &hf_r3_cpuregisters_pie2_bcl1ie,
8989         { "PIE2.BCL1IE", "r3.cpuregisters.pie2.bcl1ie",
8990           FT_BOOLEAN, 8, NULL, 0x10,
8991           NULL, HFILL }
8992       },
8993       { &hf_r3_cpuregisters_pie2_hlvdie,
8994         { "PIE2.HLVDIE", "r3.cpuregisters.pie2.hlvdie",
8995           FT_BOOLEAN, 8, NULL, 0x20,
8996           NULL, HFILL }
8997       },
8998       { &hf_r3_cpuregisters_pie2_tmr3ie,
8999         { "PIE2.TMR3IE", "r3.cpuregisters.pie2.tmr3ie",
9000           FT_BOOLEAN, 8, NULL, 0x40,
9001           NULL, HFILL }
9002       },
9003       { &hf_r3_cpuregisters_pie2_ccp2ie,
9004         { "PIE2.CCP2IE", "r3.cpuregisters.pie2.ccp2ie",
9005           FT_BOOLEAN, 8, NULL, 0x80,
9006           NULL, HFILL }
9007       },
9008       { &hf_r3_cpuregisters_pie3_ccp3ie,
9009         { "PIE3.CCP3IE", "r3.cpuregisters.pie3.ccp3ie",
9010           FT_BOOLEAN, 8, NULL, 0x01,
9011           NULL, HFILL }
9012       },
9013       { &hf_r3_cpuregisters_pie3_ccp4ie,
9014         { "PIE3.CCP4IE", "r3.cpuregisters.pie3.ccp4ie",
9015           FT_BOOLEAN, 8, NULL, 0x02,
9016           NULL, HFILL }
9017       },
9018       { &hf_r3_cpuregisters_pie3_ccp5ie,
9019         { "PIE3.CCP5IE", "r3.cpuregisters.pie3.ccp5ie",
9020           FT_BOOLEAN, 8, NULL, 0x04,
9021           NULL, HFILL }
9022       },
9023       { &hf_r3_cpuregisters_pie3_tmr4ie,
9024         { "PIE3.TMR4IE", "r3.cpuregisters.pie3.tmr4ie",
9025           FT_BOOLEAN, 8, NULL, 0x08,
9026           NULL, HFILL }
9027       },
9028       { &hf_r3_cpuregisters_pie3_tx2ie,
9029         { "PIE3.TX2IE", "r3.cpuregisters.pie3.tx2ie",
9030           FT_BOOLEAN, 8, NULL, 0x10,
9031           NULL, HFILL }
9032       },
9033       { &hf_r3_cpuregisters_pie3_rc2ie,
9034         { "PIE3.RC2IE", "r3.cpuregisters.pie3.rc2ie",
9035           FT_BOOLEAN, 8, NULL, 0x20,
9036           NULL, HFILL }
9037       },
9038       { &hf_r3_cpuregisters_pie3_bcl2ie,
9039         { "PIE3.BCL2IE", "r3.cpuregisters.pie3.bcl2ie",
9040           FT_BOOLEAN, 8, NULL, 0x40,
9041           NULL, HFILL }
9042       },
9043       { &hf_r3_cpuregisters_pie3_ssp2ie,
9044         { "PIE3.SSP2IE", "r3.cpuregisters.pie3.ssp2ie",
9045           FT_BOOLEAN, 8, NULL, 0x80,
9046           NULL, HFILL }
9047       },
9048       { &hf_r3_cpuregisters_ipr1_tmr1ip,
9049         { "IPR1.TMR1IP", "r3.cpuregisters.ipr1.tmr1ip",
9050           FT_BOOLEAN, 8, NULL, 0x01,
9051           NULL, HFILL }
9052       },
9053       { &hf_r3_cpuregisters_ipr1_tmr2ip,
9054         { "IPR1.TMR2IP", "r3.cpuregisters.ipr1.tmr2ip",
9055           FT_BOOLEAN, 8, NULL, 0x02,
9056           NULL, HFILL }
9057       },
9058       { &hf_r3_cpuregisters_ipr1_ccp1ip,
9059         { "IPR1.CCP1IP", "r3.cpuregisters.ipr1.ccp1ip",
9060           FT_BOOLEAN, 8, NULL, 0x04,
9061           NULL, HFILL }
9062       },
9063       { &hf_r3_cpuregisters_ipr1_ssp1ip,
9064         { "IPR1.SSP1IP", "r3.cpuregisters.ipr1.ssp1ip",
9065           FT_BOOLEAN, 8, NULL, 0x08,
9066           NULL, HFILL }
9067       },
9068       { &hf_r3_cpuregisters_ipr1_tx1ip,
9069         { "IPR1.TX1IP", "r3.cpuregisters.ipr1.tx1ip",
9070           FT_BOOLEAN, 8, NULL, 0x10,
9071           NULL, HFILL }
9072       },
9073       { &hf_r3_cpuregisters_ipr1_rc1ip,
9074         { "IPR1.RC1IP", "r3.cpuregisters.ipr1.rc1ip",
9075           FT_BOOLEAN, 8, NULL, 0x20,
9076           NULL, HFILL }
9077       },
9078       { &hf_r3_cpuregisters_ipr1_adip,
9079         { "IPR1.ADIP", "r3.cpuregisters.ipr1.adip",
9080           FT_BOOLEAN, 8, NULL, 0x40,
9081           NULL, HFILL }
9082       },
9083       { &hf_r3_cpuregisters_ipr1_pspip,
9084         { "IPR1.PSPIP", "r3.cpuregisters.ipr1.pspip",
9085           FT_BOOLEAN, 8, NULL, 0x80,
9086           NULL, HFILL }
9087       },
9088       { &hf_r3_cpuregisters_ipr2_ccp2ip,
9089         { "IPR2.CCP2IP", "r3.cpuregisters.ipr2.ccp2ip",
9090           FT_BOOLEAN, 8, NULL, 0x01,
9091           NULL, HFILL }
9092       },
9093       { &hf_r3_cpuregisters_ipr2_tmr3ip,
9094         { "IPR2.TMR3IP", "r3.cpuregisters.ipr2.tmr3ip",
9095           FT_BOOLEAN, 8, NULL, 0x02,
9096           NULL, HFILL }
9097       },
9098       { &hf_r3_cpuregisters_ipr2_hlvdip,
9099         { "IPR2.HLVDIP", "r3.cpuregisters.ipr2.hlvdip",
9100           FT_BOOLEAN, 8, NULL, 0x04,
9101           NULL, HFILL }
9102       },
9103       { &hf_r3_cpuregisters_ipr2_bcl1ip,
9104         { "IPR2.BCL1IP", "r3.cpuregisters.ipr2.bcl1ip",
9105           FT_BOOLEAN, 8, NULL, 0x08,
9106           NULL, HFILL }
9107       },
9108       { &hf_r3_cpuregisters_ipr2_eeip,
9109         { "IPR2.EEIP", "r3.cpuregisters.ipr2.eeip",
9110           FT_BOOLEAN, 8, NULL, 0x10,
9111           NULL, HFILL }
9112       },
9113       { &hf_r3_cpuregisters_ipr2_unused5,
9114         { "IPR2.UNUSED5", "r3.cpuregisters.ipr2.unused5",
9115           FT_BOOLEAN, 8, NULL, 0x20,
9116           NULL, HFILL }
9117       },
9118       { &hf_r3_cpuregisters_ipr2_cmip,
9119         { "IPR2.CMIP", "r3.cpuregisters.ipr2.cmip",
9120           FT_BOOLEAN, 8, NULL, 0x40,
9121           NULL, HFILL }
9122       },
9123       { &hf_r3_cpuregisters_ipr2_oscfip,
9124         { "IPR2.OSCFIP", "r3.cpuregisters.ipr2.oscfip",
9125           FT_BOOLEAN, 8, NULL, 0x80,
9126           NULL, HFILL }
9127       },
9128       { &hf_r3_cpuregisters_ipr3_ccp2ip,
9129         { "IPR3.CCP2IP", "r3.cpuregisters.ipr3.ccp2ip",
9130           FT_BOOLEAN, 8, NULL, 0x01,
9131           NULL, HFILL }
9132       },
9133       { &hf_r3_cpuregisters_ipr3_ccp4ip,
9134         { "IPR3.CCP4IP", "r3.cpuregisters.ipr3.ccp4ip",
9135           FT_BOOLEAN, 8, NULL, 0x02,
9136           NULL, HFILL }
9137       },
9138       { &hf_r3_cpuregisters_ipr3_ccp5ip,
9139         { "IPR3.CCP5IP", "r3.cpuregisters.ipr3.ccp5ip",
9140           FT_BOOLEAN, 8, NULL, 0x04,
9141           NULL, HFILL }
9142       },
9143       { &hf_r3_cpuregisters_ipr3_tmr4ip,
9144         { "IPR3.TMR4IP", "r3.cpuregisters.ipr3.tmr4ip",
9145           FT_BOOLEAN, 8, NULL, 0x08,
9146           NULL, HFILL }
9147       },
9148       { &hf_r3_cpuregisters_ipr3_tx2ip,
9149         { "IPR3.TX2IP", "r3.cpuregisters.ipr3.tx2ip",
9150           FT_BOOLEAN, 8, NULL, 0x10,
9151           NULL, HFILL }
9152       },
9153       { &hf_r3_cpuregisters_ipr3_rc2ip,
9154         { "IPR3.RC2IP", "r3.cpuregisters.ipr3.rc2ip",
9155           FT_BOOLEAN, 8, NULL, 0x20,
9156           NULL, HFILL }
9157       },
9158       { &hf_r3_cpuregisters_ipr3_bcl2ip,
9159         { "IPR3.BCL2IP", "r3.cpuregisters.ipr3.bcl2ip",
9160           FT_BOOLEAN, 8, NULL, 0x40,
9161           NULL, HFILL }
9162       },
9163       { &hf_r3_cpuregisters_ipr3_ssp2ip,
9164         { "IPR3.SSP2IP", "r3.cpuregisters.ipr3.ssp2ip",
9165           FT_BOOLEAN, 8, NULL, 0x80,
9166           NULL, HFILL }
9167       },
9168       { &hf_r3_cpuregisters_rcon_bor,
9169         { "RCON./BOR", "r3.cpuregisters.rcon.bor",
9170           FT_BOOLEAN, 8, NULL, 0x01,
9171           NULL, HFILL }
9172       },
9173       { &hf_r3_cpuregisters_rcon_por,
9174         { "RCON./POR", "r3.cpuregisters.rcon.por",
9175           FT_BOOLEAN, 8, NULL, 0x02,
9176           NULL, HFILL }
9177       },
9178       { &hf_r3_cpuregisters_rcon_pd,
9179         { "RCON./PD", "r3.cpuregisters.rcon.pd",
9180           FT_BOOLEAN, 8, NULL, 0x04,
9181           NULL, HFILL }
9182       },
9183       { &hf_r3_cpuregisters_rcon_to,
9184         { "RCON./TO", "r3.cpuregisters.rcon.to",
9185           FT_BOOLEAN, 8, NULL, 0x08,
9186           NULL, HFILL }
9187       },
9188       { &hf_r3_cpuregisters_rcon_unused4,
9189         { "RCON.UNUSED4", "r3.cpuregisters.rcon.unused4",
9190           FT_BOOLEAN, 8, NULL, 0x10,
9191           NULL, HFILL }
9192       },
9193       { &hf_r3_cpuregisters_rcon_ri,
9194         { "RCON./RI", "r3.cpuregisters.rcon.ri",
9195           FT_BOOLEAN, 8, NULL, 0x20,
9196           NULL, HFILL }
9197       },
9198       { &hf_r3_cpuregisters_rcon_sboren,
9199         { "RCON.SBOREN", "r3.cpuregisters.rcon.sboren",
9200           FT_BOOLEAN, 8, NULL, 0x40,
9201           NULL, HFILL }
9202       },
9203       { &hf_r3_cpuregisters_rcon_ipen,
9204         { "RCON.IPEN", "r3.cpuregisters.rcon.ipen",
9205           FT_BOOLEAN, 8, NULL, 0x80,
9206           NULL, HFILL }
9207       },
9208       { &hf_r3_cpuregisters_osccon_scs0,
9209         { "OSCCON.SCS0", "r3.cpuregisters.osccon.scs0",
9210           FT_BOOLEAN, 8, NULL, 0x01,
9211           NULL, HFILL }
9212       },
9213       { &hf_r3_cpuregisters_osccon_scs1,
9214         { "OSCCON.SCS1", "r3.cpuregisters.osccon.scs1",
9215           FT_BOOLEAN, 8, NULL, 0x02,
9216           NULL, HFILL }
9217       },
9218       { &hf_r3_cpuregisters_osccon_iofs,
9219         { "OSCCON.IOFS", "r3.cpuregisters.osccon.iofs",
9220           FT_BOOLEAN, 8, NULL, 0x04,
9221           NULL, HFILL }
9222       },
9223       { &hf_r3_cpuregisters_osccon_osts,
9224         { "OSCCON.OSTS", "r3.cpuregisters.osccon.osts",
9225           FT_BOOLEAN, 8, NULL, 0x08,
9226           NULL, HFILL }
9227       },
9228       { &hf_r3_cpuregisters_osccon_ircf0,
9229         { "OSCCON.IRCF0", "r3.cpuregisters.osccon.ircf0",
9230           FT_BOOLEAN, 8, NULL, 0x10,
9231           NULL, HFILL }
9232       },
9233       { &hf_r3_cpuregisters_osccon_ircf1,
9234         { "OSCCON.IRCF1", "r3.cpuregisters.osccon.ircf1",
9235           FT_BOOLEAN, 8, NULL, 0x20,
9236           NULL, HFILL }
9237       },
9238       { &hf_r3_cpuregisters_osccon_ircf2,
9239         { "OSCCON.IRCF2", "r3.cpuregisters.osccon.ircf2",
9240           FT_BOOLEAN, 8, NULL, 0x40,
9241           NULL, HFILL }
9242       },
9243       { &hf_r3_cpuregisters_osccon_idlen,
9244         { "OSCCON.IDLEN", "r3.cpuregisters.osccon.idlen",
9245           FT_BOOLEAN, 8, NULL, 0x80,
9246           NULL, HFILL }
9247       },
9248       { &hf_r3_cpuregisters_rcsta_rx9d,
9249         { "RCSTA.RX9D", "r3.cpuregisters.rcsta.rx9d",
9250           FT_BOOLEAN, 8, NULL, 0x01,
9251           NULL, HFILL }
9252       },
9253       { &hf_r3_cpuregisters_rcsta_oerr,
9254         { "RCSTA.OERR", "r3.cpuregisters.rcsta.oerr",
9255           FT_BOOLEAN, 8, NULL, 0x02,
9256           NULL, HFILL }
9257       },
9258       { &hf_r3_cpuregisters_rcsta_ferr,
9259         { "RCSTA.FERR", "r3.cpuregisters.rcsta.ferr",
9260           FT_BOOLEAN, 8, NULL, 0x04,
9261           NULL, HFILL }
9262       },
9263       { &hf_r3_cpuregisters_rcsta_adden,
9264         { "RCSTA.ADDEN", "r3.cpuregisters.rcsta.adden",
9265           FT_BOOLEAN, 8, NULL, 0x08,
9266           NULL, HFILL }
9267       },
9268       { &hf_r3_cpuregisters_rcsta_cren,
9269         { "RCSTA.CREN", "r3.cpuregisters.rcsta.cren",
9270           FT_BOOLEAN, 8, NULL, 0x10,
9271           NULL, HFILL }
9272       },
9273       { &hf_r3_cpuregisters_rcsta_sren,
9274         { "RCSTA.SREN", "r3.cpuregisters.rcsta.sren",
9275           FT_BOOLEAN, 8, NULL, 0x20,
9276           NULL, HFILL }
9277       },
9278       { &hf_r3_cpuregisters_rcsta_rx9,
9279         { "RCSTA.RX9", "r3.cpuregisters.rcsta.rx9",
9280           FT_BOOLEAN, 8, NULL, 0x40,
9281           NULL, HFILL }
9282       },
9283       { &hf_r3_cpuregisters_rcsta_spen,
9284         { "RCSTA.SPEN", "r3.cpuregisters.rcsta.spen",
9285           FT_BOOLEAN, 8, NULL, 0x80,
9286           NULL, HFILL }
9287       },
9288       { &hf_r3_cpuregisters_txsta_tx9d,
9289         { "TXSTA.TX9D", "r3.cpuregisters.txsta.tx9d",
9290           FT_BOOLEAN, 8, NULL, 0x01,
9291           NULL, HFILL }
9292       },
9293       { &hf_r3_cpuregisters_txsta_trmt,
9294         { "TXSTA.TRMT", "r3.cpuregisters.txsta.trmt",
9295           FT_BOOLEAN, 8, NULL, 0x02,
9296           NULL, HFILL }
9297       },
9298       { &hf_r3_cpuregisters_txsta_brgh,
9299         { "TXSTA.BRGH", "r3.cpuregisters.txsta.brgh",
9300           FT_BOOLEAN, 8, NULL, 0x04,
9301           NULL, HFILL }
9302       },
9303       { &hf_r3_cpuregisters_txsta_sendb,
9304         { "TXSTA.SENDB", "r3.cpuregisters.txsta.sendb",
9305           FT_BOOLEAN, 8, NULL, 0x08,
9306           NULL, HFILL }
9307       },
9308       { &hf_r3_cpuregisters_txsta_sync,
9309         { "TXSTA.SYNC", "r3.cpuregisters.txsta.sync",
9310           FT_BOOLEAN, 8, NULL, 0x10,
9311           NULL, HFILL }
9312       },
9313       { &hf_r3_cpuregisters_txsta_txen,
9314         { "TXSTA.TXEN", "r3.cpuregisters.txsta.txen",
9315           FT_BOOLEAN, 8, NULL, 0x20,
9316           NULL, HFILL }
9317       },
9318       { &hf_r3_cpuregisters_txsta_tx9,
9319         { "TXSTA.TX9", "r3.cpuregisters.txsta.tx9",
9320           FT_BOOLEAN, 8, NULL, 0x40,
9321           NULL, HFILL }
9322       },
9323       { &hf_r3_cpuregisters_txsta_csrc,
9324         { "TXSTA.CSRC", "r3.cpuregisters.txsta.csrc",
9325           FT_BOOLEAN, 8, NULL, 0x80,
9326           NULL, HFILL }
9327       },
9328       { &hf_r3_cpuregisters_rcsta2_rx9d,
9329         { "RCSTA2.RX9D", "r3.cpuregisters.rcsta2.rx9d",
9330           FT_BOOLEAN, 8, NULL, 0x01,
9331           NULL, HFILL }
9332       },
9333       { &hf_r3_cpuregisters_rcsta2_oerr,
9334         { "RCSTA2.OERR", "r3.cpuregisters.rcsta2.oerr",
9335           FT_BOOLEAN, 8, NULL, 0x02,
9336           NULL, HFILL }
9337       },
9338       { &hf_r3_cpuregisters_rcsta2_ferr,
9339         { "RCSTA2.FERR", "r3.cpuregisters.rcsta2.ferr",
9340           FT_BOOLEAN, 8, NULL, 0x04,
9341           NULL, HFILL }
9342       },
9343       { &hf_r3_cpuregisters_rcsta2_adden,
9344         { "RCSTA2.ADDEN", "r3.cpuregisters.rcsta2.adden",
9345           FT_BOOLEAN, 8, NULL, 0x08,
9346           NULL, HFILL }
9347       },
9348       { &hf_r3_cpuregisters_rcsta2_cren,
9349         { "RCSTA2.CREN", "r3.cpuregisters.rcsta2.cren",
9350           FT_BOOLEAN, 8, NULL, 0x10,
9351           NULL, HFILL }
9352       },
9353       { &hf_r3_cpuregisters_rcsta2_sren,
9354         { "RCSTA2.SREN", "r3.cpuregisters.rcsta2.sren",
9355           FT_BOOLEAN, 8, NULL, 0x20,
9356           NULL, HFILL }
9357       },
9358       { &hf_r3_cpuregisters_rcsta2_rx9,
9359         { "RCSTA2.RX9", "r3.cpuregisters.rcsta2.rx9",
9360           FT_BOOLEAN, 8, NULL, 0x40,
9361           NULL, HFILL }
9362       },
9363       { &hf_r3_cpuregisters_rcsta2_spen,
9364         { "RCSTA2.SPEN", "r3.cpuregisters.rcsta2.spen",
9365           FT_BOOLEAN, 8, NULL, 0x80,
9366           NULL, HFILL }
9367       },
9368       { &hf_r3_cpuregisters_txsta2_tx9d,
9369         { "TXSTA2.TX9D", "r3.cpuregisters.txsta2.tx9d",
9370           FT_BOOLEAN, 8, NULL, 0x01,
9371           NULL, HFILL }
9372       },
9373       { &hf_r3_cpuregisters_txsta2_trmt,
9374         { "TXSTA2.TRMT", "r3.cpuregisters.txsta2.trmt",
9375           FT_BOOLEAN, 8, NULL, 0x02,
9376           NULL, HFILL }
9377       },
9378       { &hf_r3_cpuregisters_txsta2_brgh,
9379         { "TXSTA2.BRGH", "r3.cpuregisters.txsta2.brgh",
9380           FT_BOOLEAN, 8, NULL, 0x04,
9381           NULL, HFILL }
9382       },
9383       { &hf_r3_cpuregisters_txsta2_sendb,
9384         { "TXSTA2.SENDB", "r3.cpuregisters.txsta2.sendb",
9385           FT_BOOLEAN, 8, NULL, 0x08,
9386           NULL, HFILL }
9387       },
9388       { &hf_r3_cpuregisters_txsta2_sync,
9389         { "TXSTA2.SYNC", "r3.cpuregisters.txsta2.sync",
9390           FT_BOOLEAN, 8, NULL, 0x10,
9391           NULL, HFILL }
9392       },
9393       { &hf_r3_cpuregisters_txsta2_txen,
9394         { "TXSTA2.TXEN", "r3.cpuregisters.txsta2.txen",
9395           FT_BOOLEAN, 8, NULL, 0x20,
9396           NULL, HFILL }
9397       },
9398       { &hf_r3_cpuregisters_txsta2_tx9,
9399         { "TXSTA2.TX9", "r3.cpuregisters.txsta2.tx9",
9400           FT_BOOLEAN, 8, NULL, 0x40,
9401           NULL, HFILL }
9402       },
9403       { &hf_r3_cpuregisters_txsta2_csrc,
9404         { "TXSTA2.CSRC", "r3.cpuregisters.txsta2.csrc",
9405           FT_BOOLEAN, 8, NULL, 0x80,
9406           NULL, HFILL }
9407       },
9408       { &hf_r3_cpuregisters_wdtcon_swdten,
9409         { "WDTCON.SWDTEN", "r3.cpuregisters.wdtcon.swdten",
9410           FT_BOOLEAN, 8, NULL, 0x01,
9411           NULL, HFILL }
9412       },
9413       { &hf_r3_cpuregisters_wdtcon_unused1,
9414         { "WDTCON.UNUSED1", "r3.cpuregisters.wdtcon.unused1",
9415           FT_BOOLEAN, 8, NULL, 0x02,
9416           NULL, HFILL }
9417       },
9418       { &hf_r3_cpuregisters_wdtcon_unused2,
9419         { "WDTCON.UNUSED2", "r3.cpuregisters.wdtcon.unused2",
9420           FT_BOOLEAN, 8, NULL, 0x04,
9421           NULL, HFILL }
9422       },
9423       { &hf_r3_cpuregisters_wdtcon_unused3,
9424         { "WDTCON.UNUSED3", "r3.cpuregisters.wdtcon.unused3",
9425           FT_BOOLEAN, 8, NULL, 0x08,
9426           NULL, HFILL }
9427       },
9428       { &hf_r3_cpuregisters_wdtcon_unused4,
9429         { "WDTCON.UNUSED4", "r3.cpuregisters.wdtcon.unused4",
9430           FT_BOOLEAN, 8, NULL, 0x10,
9431           NULL, HFILL }
9432       },
9433       { &hf_r3_cpuregisters_wdtcon_unused5,
9434         { "WDTCON.UNUSED5", "r3.cpuregisters.wdtcon.unused5",
9435           FT_BOOLEAN, 8, NULL, 0x20,
9436           NULL, HFILL }
9437       },
9438       { &hf_r3_cpuregisters_wdtcon_unused6,
9439         { "WDTCON.UNUSED6", "r3.cpuregisters.wdtcon.unused6",
9440           FT_BOOLEAN, 8, NULL, 0x40,
9441           NULL, HFILL }
9442       },
9443       { &hf_r3_cpuregisters_wdtcon_unused7,
9444         { "WDTCON.UNUSED7", "r3.cpuregisters.wdtcon.unused7",
9445           FT_BOOLEAN, 8, NULL, 0x80,
9446           NULL, HFILL }
9447       },
9448 
9449       { &hf_r3_dumpm41t81_reg00,
9450         { "REG 0x00", "r3.m41t81.reg00",
9451           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
9452           NULL, HFILL }
9453       },
9454       { &hf_r3_dumpm41t81_reg01,
9455         { "REG 0x01", "r3.m41t81.reg01",
9456           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
9457           NULL, HFILL }
9458       },
9459       { &hf_r3_dumpm41t81_reg02,
9460         { "REG 0x02", "r3.m41t81.reg02",
9461           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
9462           NULL, HFILL }
9463       },
9464       { &hf_r3_dumpm41t81_reg03,
9465         { "REG 0x03", "r3.m41t81.reg03",
9466           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
9467           NULL, HFILL }
9468       },
9469       { &hf_r3_dumpm41t81_reg04,
9470         { "REG 0x04", "r3.m41t81.reg04",
9471           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
9472           NULL, HFILL }
9473       },
9474       { &hf_r3_dumpm41t81_reg05,
9475         { "REG 0x05", "r3.m41t81.reg05",
9476           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
9477           NULL, HFILL }
9478       },
9479       { &hf_r3_dumpm41t81_reg06,
9480         { "REG 0x06", "r3.m41t81.reg06",
9481           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
9482           NULL, HFILL }
9483       },
9484       { &hf_r3_dumpm41t81_reg07,
9485         { "REG 0x07", "r3.m41t81.reg07",
9486           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
9487           NULL, HFILL }
9488       },
9489       { &hf_r3_dumpm41t81_reg08,
9490         { "REG 0x08", "r3.m41t81.reg08",
9491           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
9492           NULL, HFILL }
9493       },
9494       { &hf_r3_dumpm41t81_reg09,
9495         { "REG 0x09", "r3.m41t81.reg09",
9496           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
9497           NULL, HFILL }
9498       },
9499       { &hf_r3_dumpm41t81_reg0a,
9500         { "REG 0x0a", "r3.m41t81.reg0a",
9501           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
9502           NULL, HFILL }
9503       },
9504       { &hf_r3_dumpm41t81_reg0b,
9505         { "REG 0x0b", "r3.m41t81.reg0b",
9506           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
9507           NULL, HFILL }
9508       },
9509       { &hf_r3_dumpm41t81_reg0c,
9510         { "REG 0x0c", "r3.m41t81.reg0c",
9511           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
9512           NULL, HFILL }
9513       },
9514       { &hf_r3_dumpm41t81_reg0d,
9515         { "REG 0x0d", "r3.m41t81.reg0d",
9516           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
9517           NULL, HFILL }
9518       },
9519       { &hf_r3_dumpm41t81_reg0e,
9520         { "REG 0x0e", "r3.m41t81.reg0e",
9521           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
9522           NULL, HFILL }
9523       },
9524       { &hf_r3_dumpm41t81_reg0f,
9525         { "REG 0x0f", "r3.m41t81.reg0f",
9526           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
9527           NULL, HFILL }
9528       },
9529       { &hf_r3_dumpm41t81_reg10,
9530         { "REG 0x10", "r3.m41t81.reg10",
9531           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
9532           NULL, HFILL }
9533       },
9534       { &hf_r3_dumpm41t81_reg11,
9535         { "REG 0x11", "r3.m41t81.reg11",
9536           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
9537           NULL, HFILL }
9538       },
9539       { &hf_r3_dumpm41t81_reg12,
9540         { "REG 0x12", "r3.m41t81.reg12",
9541           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
9542           NULL, HFILL }
9543       },
9544       { &hf_r3_dumpm41t81_reg13,
9545         { "REG 0x13", "r3.m41t81.reg13",
9546           FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
9547           NULL, HFILL }
9548       },
9549 
9550       { &hf_r3_dumpm41t81_reg00_sec1,
9551         { ".1 Seconds", "r3.m41t81.reg00.sec1",
9552           FT_UINT8, BASE_DEC, NULL, 0x0,
9553           NULL, HFILL }
9554       },
9555       { &hf_r3_dumpm41t81_reg00_sec01,
9556         { ".01 Seconds", "r3.m41t81.reg00.sec01",
9557           FT_UINT8, BASE_DEC, NULL, 0x0,
9558           NULL, HFILL }
9559       },
9560       { &hf_r3_dumpm41t81_reg01_st,
9561         { "ST", "r3.m41t81.reg01.st",
9562           FT_UINT8, BASE_DEC, NULL, 0x0,
9563           NULL, HFILL }
9564       },
9565       { &hf_r3_dumpm41t81_reg01_10sec,
9566         { "10 Seconds", "r3.m41t81.reg01.10sec",
9567           FT_UINT8, BASE_DEC, NULL, 0x0,
9568           NULL, HFILL }
9569       },
9570       { &hf_r3_dumpm41t81_reg01_1sec,
9571         { "1 Seconds", "r3.m41t81.reg01.1sec",
9572           FT_UINT8, BASE_DEC, NULL, 0x0,
9573           NULL, HFILL }
9574       },
9575       { &hf_r3_dumpm41t81_reg02_notused,
9576         { "(not used)", "r3.m41t81.reg02.notused",
9577           FT_UINT8, BASE_DEC, NULL, 0x0,
9578           NULL, HFILL }
9579       },
9580       { &hf_r3_dumpm41t81_reg02_10min,
9581         { "10 Minutes", "r3.m41t81.reg02.10min",
9582           FT_UINT8, BASE_DEC, NULL, 0x0,
9583           NULL, HFILL }
9584       },
9585       { &hf_r3_dumpm41t81_reg02_1min,
9586         { "1 Minutes", "r3.m41t81.reg02.1min",
9587           FT_UINT8, BASE_DEC, NULL, 0x0,
9588           NULL, HFILL }
9589       },
9590       { &hf_r3_dumpm41t81_reg03_cbe,
9591         { "CBE", "r3.m41t81.reg03.cbe",
9592           FT_UINT8, BASE_DEC, NULL, 0x0,
9593           NULL, HFILL }
9594       },
9595       { &hf_r3_dumpm41t81_reg03_cb,
9596         { "CB", "r3.m41t81.reg03.cb",
9597           FT_UINT8, BASE_DEC, NULL, 0x0,
9598           NULL, HFILL }
9599       },
9600       { &hf_r3_dumpm41t81_reg03_10hour,
9601         { "10 Hours", "r3.m41t81.reg03.10hour",
9602           FT_UINT8, BASE_DEC, NULL, 0x0,
9603           NULL, HFILL }
9604       },
9605       { &hf_r3_dumpm41t81_reg03_1hour,
9606         { "1 Hours", "r3.m41t81.reg03.1hour",
9607           FT_UINT8, BASE_DEC, NULL, 0x0,
9608           NULL, HFILL }
9609       },
9610       { &hf_r3_dumpm41t81_reg04_notused,
9611         { "(not used)", "r3.m41t81.reg04.notused",
9612           FT_UINT8, BASE_DEC, NULL, 0x0,
9613           NULL, HFILL }
9614       },
9615       { &hf_r3_dumpm41t81_reg04_dow,
9616         { "DOW", "r3.m41t81.reg04.dow",
9617           FT_UINT8, BASE_DEC, NULL, 0x0,
9618           NULL, HFILL }
9619       },
9620       { &hf_r3_dumpm41t81_reg05_notused,
9621         { "(not used)", "r3.m41t81.reg05.notused",
9622           FT_UINT8, BASE_DEC, NULL, 0x0,
9623           NULL, HFILL }
9624       },
9625       { &hf_r3_dumpm41t81_reg05_10day,
9626         { "10 Day", "r3.m41t81.reg05.10day",
9627           FT_UINT8, BASE_DEC, NULL, 0x0,
9628           NULL, HFILL }
9629       },
9630       { &hf_r3_dumpm41t81_reg05_1day,
9631         { "1 Day", "r3.m41t81.reg05.1day",
9632           FT_UINT8, BASE_DEC, NULL, 0x0,
9633           NULL, HFILL }
9634       },
9635       { &hf_r3_dumpm41t81_reg06_notused,
9636         { "(not used)", "r3.m41t81.reg06.notused",
9637           FT_UINT8, BASE_DEC, NULL, 0x0,
9638           NULL, HFILL }
9639       },
9640       { &hf_r3_dumpm41t81_reg06_10month,
9641         { "10 Month", "r3.m41t81.reg06.10month",
9642           FT_UINT8, BASE_DEC, NULL, 0x0,
9643           NULL, HFILL }
9644       },
9645       { &hf_r3_dumpm41t81_reg06_1month,
9646         { "1 Month", "r3.m41t81.reg06.1month",
9647           FT_UINT8, BASE_DEC, NULL, 0x0,
9648           NULL, HFILL }
9649       },
9650       { &hf_r3_dumpm41t81_reg07_10year,
9651         { "10 Year", "r3.m41t81.reg07.10year",
9652           FT_UINT8, BASE_DEC, NULL, 0x0,
9653           NULL, HFILL }
9654       },
9655       { &hf_r3_dumpm41t81_reg07_1year,
9656         { "1 Year", "r3.m41t81.reg07.1year",
9657           FT_UINT8, BASE_DEC, NULL, 0x0,
9658           NULL, HFILL }
9659       },
9660       { &hf_r3_dumpm41t81_reg08_out,
9661         { "OUT", "r3.m41t81.reg08.out",
9662           FT_UINT8, BASE_DEC, NULL, 0x0,
9663           NULL, HFILL }
9664       },
9665       { &hf_r3_dumpm41t81_reg08_ft,
9666         { "FT", "r3.m41t81.reg08.ft",
9667           FT_UINT8, BASE_DEC, NULL, 0x0,
9668           NULL, HFILL }
9669       },
9670       { &hf_r3_dumpm41t81_reg08_s,
9671         { "S", "r3.m41t81.reg08.s",
9672           FT_UINT8, BASE_DEC, NULL, 0x0,
9673           NULL, HFILL }
9674       },
9675       { &hf_r3_dumpm41t81_reg08_cal,
9676         { "CAL", "r3.m41t81.reg08.cal",
9677           FT_UINT8, BASE_DEC, NULL, 0x0,
9678           NULL, HFILL }
9679       },
9680       { &hf_r3_dumpm41t81_reg09_notused,
9681         { "(not used)", "r3.m41t81.reg09.notused",
9682           FT_UINT8, BASE_DEC, NULL, 0x0,
9683           NULL, HFILL }
9684       },
9685       { &hf_r3_dumpm41t81_reg09_bmb,
9686         { "BMB", "r3.m41t81.reg09.bmb",
9687           FT_UINT8, BASE_DEC, NULL, 0x0,
9688           NULL, HFILL }
9689       },
9690       { &hf_r3_dumpm41t81_reg09_rb,
9691         { "RB", "r3.m41t81.reg09.rb",
9692           FT_UINT8, BASE_DEC, NULL, 0x0,
9693           NULL, HFILL }
9694       },
9695       { &hf_r3_dumpm41t81_reg0a_afe,
9696         { "AFE", "r3.m41t81.reg0a.afe",
9697           FT_UINT8, BASE_DEC, NULL, 0x0,
9698           NULL, HFILL }
9699       },
9700       { &hf_r3_dumpm41t81_reg0a_sqwe,
9701         { "SQWE", "r3.m41t81.reg0a.sqwe",
9702           FT_UINT8, BASE_DEC, NULL, 0x0,
9703           NULL, HFILL }
9704       },
9705       { &hf_r3_dumpm41t81_reg0a_abe,
9706         { "ABE", "r3.m41t81.reg0a.abe",
9707           FT_UINT8, BASE_DEC, NULL, 0x0,
9708           NULL, HFILL }
9709       },
9710       { &hf_r3_dumpm41t81_reg0a_10monthalm,
9711         { "10 Month Alarm", "r3.m41t81.reg0a.10monthalm",
9712           FT_UINT8, BASE_DEC, NULL, 0x0,
9713           NULL, HFILL }
9714       },
9715       { &hf_r3_dumpm41t81_reg0a_1monthalm,
9716         { "1 Month Alarm", "r3.m41t81.reg0a.1monthalm",
9717           FT_UINT8, BASE_DEC, NULL, 0x0,
9718           NULL, HFILL }
9719       },
9720       { &hf_r3_dumpm41t81_reg0b_rpt5,
9721         { "RPT5", "r3.m41t81.reg0b.rpt5",
9722           FT_UINT8, BASE_DEC, NULL, 0x0,
9723           NULL, HFILL }
9724       },
9725       { &hf_r3_dumpm41t81_reg0b_rpt4,
9726         { "RPT4", "r3.m41t81.reg0b.rpt4",
9727           FT_UINT8, BASE_DEC, NULL, 0x0,
9728           NULL, HFILL }
9729       },
9730       { &hf_r3_dumpm41t81_reg0b_10dayalm,
9731         { "10 Day Alarm", "r3.m41t81.reg0b.10dayalm",
9732           FT_UINT8, BASE_DEC, NULL, 0x0,
9733           NULL, HFILL }
9734       },
9735       { &hf_r3_dumpm41t81_reg0b_1dayalm,
9736         { "1 Day Alarm", "r3.m41t81.reg0b.1dayalm",
9737           FT_UINT8, BASE_DEC, NULL, 0x0,
9738           NULL, HFILL }
9739       },
9740       { &hf_r3_dumpm41t81_reg0c_rpt3,
9741         { "RPT3", "r3.m41t81.reg0c.rpt3",
9742           FT_UINT8, BASE_DEC, NULL, 0x0,
9743           NULL, HFILL }
9744       },
9745       { &hf_r3_dumpm41t81_reg0c_ht,
9746         { "HT", "r3.m41t81.reg0c.ht",
9747           FT_UINT8, BASE_DEC, NULL, 0x0,
9748           NULL, HFILL }
9749       },
9750       { &hf_r3_dumpm41t81_reg0c_10houralm,
9751         { "10 Hour Alarm", "r3.m41t81.reg0c.10houralm",
9752           FT_UINT8, BASE_DEC, NULL, 0x0,
9753           NULL, HFILL }
9754       },
9755       { &hf_r3_dumpm41t81_reg0c_1houralm,
9756         { "1 Hour Alarm", "r3.m41t81.reg0c.1houralm",
9757           FT_UINT8, BASE_DEC, NULL, 0x0,
9758           NULL, HFILL }
9759       },
9760       { &hf_r3_dumpm41t81_reg0d_rpt2,
9761         { "RPT2", "r3.m41t81.reg0d.rpt2",
9762           FT_UINT8, BASE_DEC, NULL, 0x0,
9763           NULL, HFILL }
9764       },
9765       { &hf_r3_dumpm41t81_reg0d_10minalm,
9766         { "10 Min Alarm", "r3.m41t81.reg0d.10minalm",
9767           FT_UINT8, BASE_DEC, NULL, 0x0,
9768           NULL, HFILL }
9769       },
9770       { &hf_r3_dumpm41t81_reg0d_1minalm,
9771         { "1 Min Alarm", "r3.m41t81.reg0d.1minalm",
9772           FT_UINT8, BASE_DEC, NULL, 0x0,
9773           NULL, HFILL }
9774       },
9775       { &hf_r3_dumpm41t81_reg0e_rpt1,
9776         { "RPT1", "r3.m41t81.reg0e.rpt1",
9777           FT_UINT8, BASE_DEC, NULL, 0x0,
9778           NULL, HFILL }
9779       },
9780       { &hf_r3_dumpm41t81_reg0e_10secalm,
9781         { "10 Sec Alarm", "r3.m41t81.reg0e.10secalm",
9782           FT_UINT8, BASE_DEC, NULL, 0x0,
9783           NULL, HFILL }
9784       },
9785       { &hf_r3_dumpm41t81_reg0e_1secalm,
9786         { "1 Sec Alarm", "r3.m41t81.reg0e.1secalm",
9787           FT_UINT8, BASE_DEC, NULL, 0x0,
9788           NULL, HFILL }
9789       },
9790       { &hf_r3_dumpm41t81_reg0f_wdf,
9791         { "WDF", "r3.m41t81.reg0f.wdf",
9792           FT_UINT8, BASE_DEC, NULL, 0x0,
9793           NULL, HFILL }
9794       },
9795       { &hf_r3_dumpm41t81_reg0f_af,
9796         { "AF", "r3.m41t81.reg0f.af",
9797           FT_UINT8, BASE_DEC, NULL, 0x0,
9798           NULL, HFILL }
9799       },
9800       { &hf_r3_dumpm41t81_reg0f_notused,
9801         { "(not used)", "r3.m41t81.reg0f.notused",
9802           FT_UINT8, BASE_DEC, NULL, 0x0,
9803           NULL, HFILL }
9804       },
9805       { &hf_r3_dumpm41t81_reg10_notused,
9806         { "(not used)", "r3.m41t81.reg10.notused",
9807           FT_UINT8, BASE_DEC, NULL, 0x0,
9808           NULL, HFILL }
9809       },
9810       { &hf_r3_dumpm41t81_reg11_notused,
9811         { "(not used)", "r3.m41t81.reg11.notused",
9812           FT_UINT8, BASE_DEC, NULL, 0x0,
9813           NULL, HFILL }
9814       },
9815       { &hf_r3_dumpm41t81_reg12_notused,
9816         { "(not used)", "r3.m41t81.reg12.notused",
9817           FT_UINT8, BASE_DEC, NULL, 0x0,
9818           NULL, HFILL }
9819       },
9820       { &hf_r3_dumpm41t81_reg13_rs,
9821         { "RS", "r3.m41t81.reg13.rs",
9822           FT_UINT8, BASE_DEC, NULL, 0x0,
9823           NULL, HFILL }
9824       },
9825       { &hf_r3_dumpm41t81_reg13_notused,
9826         { "(not used)", "r3.m41t81.reg13.notused",
9827           FT_UINT8, BASE_DEC, NULL, 0x0,
9828           NULL, HFILL }
9829       },
9830       { &hf_r3_sn_manufacturer,
9831         { "Manufacturer", "r3.sn.manufacturer",
9832           FT_STRING, BASE_NONE, NULL, 0x0,
9833           NULL, HFILL }
9834       },
9835       { &hf_r3_sn_year,
9836         { "Year", "r3.sn.year",
9837           FT_STRING, BASE_NONE, NULL, 0x0,
9838           NULL, HFILL }
9839       },
9840       { &hf_r3_sn_week,
9841         { "Week", "r3.sn.week",
9842           FT_STRING, BASE_NONE, NULL, 0x0,
9843           NULL, HFILL }
9844       },
9845       { &hf_r3_sn_model,
9846         { "Model", "r3.sn.model",
9847           FT_STRING, BASE_NONE, NULL, 0x0,
9848           NULL, HFILL }
9849       },
9850       { &hf_r3_sn_sequence,
9851         { "Sequence", "r3.sn.sequence",
9852           FT_STRING, BASE_NONE, NULL, 0x0,
9853           NULL, HFILL }
9854       },
9855       { &hf_r3_sn_group,
9856         { "Group", "r3.sn.group",
9857           FT_STRING, BASE_NONE, NULL, 0x0,
9858           NULL, HFILL }
9859       },
9860       { &hf_r3_sn_nid,
9861         { "NID", "r3.sn.nid",
9862           FT_STRING, BASE_NONE, NULL, 0x0,
9863           NULL, HFILL }
9864       },
9865       { &hf_r3_sn_hid,
9866         { "HID", "r3.sn.hid",
9867           FT_STRING, BASE_NONE, NULL, 0x0,
9868           NULL, HFILL }
9869       },
9870       { &hf_r3_sn_power_supply,
9871         { "Power Supply", "r3.sn.power_supply",
9872           FT_STRING, BASE_NONE, NULL, 0x0,
9873           NULL, HFILL }
9874       },
9875       { &hf_r3_sn_mortise,
9876         { "Mortise", "r3.sn.mortise",
9877           FT_STRING, BASE_NONE, NULL, 0x0,
9878           NULL, HFILL }
9879       },
9880       { &hf_r3_debuglog_recordnumber,
9881         { "Record Number", "r3.debuglog.recordnumber",
9882           FT_UINT16, BASE_HEX_DEC, NULL, 0x0,
9883           NULL, HFILL }
9884       },
9885       { &hf_r3_debuglog_flags,
9886         { "Flags", "r3.debuglog.flags",
9887           FT_UINT32, BASE_HEX, NULL, 0x0,
9888           NULL, HFILL }
9889       },
9890       { &hf_r3_debuglog_tick,
9891         { "Tick", "r3.debuglog.tick",
9892           FT_UINT16, BASE_HEX_DEC, NULL, 0x0,
9893           NULL, HFILL }
9894       },
9895 
9896       { &hf_r3_adduserparamtype,
9897         { "Upstream Field", "r3.manageuser",
9898           FT_NONE, BASE_NONE, NULL, 0x0,
9899           NULL, HFILL }
9900       },
9901       { &hf_r3_adduserparamtypelength,
9902         { "Field Length", "r3.manageuser.length",
9903           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
9904           NULL, HFILL }
9905       },
9906       { &hf_r3_adduserparamtypetype,
9907         { "Field Type", "r3.manageuser.type",
9908           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_adduserparamtypenames_ext, 0x0,
9909           NULL, HFILL }
9910       },
9911 #if 0
9912       { &hf_r3_adduserparamtypedatalen,
9913         { "Data Length", "r3.manageuser.datalen",
9914           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
9915           NULL, HFILL }
9916       },
9917       { &hf_r3_adduserparamtypeerror,
9918         { "Error", "r3.manageuser.error",
9919           FT_STRING, BASE_NONE, NULL, 0x0,
9920           NULL, HFILL }
9921       },
9922 #endif
9923       { &hf_r3_adduserparamtypearray [ADDUSERPARAMTYPE_DISPOSITION],
9924         { "Disposition", "r3.manageuser.disposition",
9925           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_dispositionnames_ext, 0x0,
9926           NULL, HFILL }
9927       },
9928       { &hf_r3_adduserparamtypearray [ADDUSERPARAMTYPE_USERNO],
9929         { "User Number", "r3.manageuser.usernumber",
9930           FT_UINT16, BASE_DEC_HEX, NULL, 0x0,
9931           NULL, HFILL }
9932       },
9933       { &hf_r3_adduserparamtypearray [ADDUSERPARAMTYPE_ACCESSALWAYS],
9934         { "Access Always", "r3.manageuser.accessalways",
9935           FT_BOOLEAN, BASE_NONE, NULL, 0x0,
9936           NULL, HFILL }
9937       },
9938       { &hf_r3_adduserparamtypearray [ADDUSERPARAMTYPE_ACCESSMODE],
9939         { "Access Mode", "r3.manageuser.accessmode",
9940           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_accessmodenames_ext, 0x0,
9941           NULL, HFILL }
9942       },
9943       { &hf_r3_adduserparamtypearray [ADDUSERPARAMTYPE_CACHED],
9944         { "Cached", "r3.manageuser.cached",
9945           FT_BOOLEAN, BASE_NONE, NULL, 0x0,
9946           NULL, HFILL }
9947       },
9948       { &hf_r3_adduserparamtypearray [ADDUSERPARAMTYPE_USERTYPE],
9949         { "User Type", "r3.manageuser.usertype",
9950           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_usertypenames_ext, 0x0,
9951           NULL, HFILL }
9952       },
9953       { &hf_r3_adduserparamtypearray [ADDUSERPARAMTYPE_PRIMARYFIELD],
9954         { "Primary Field", "r3.manageuser.primaryfield",
9955           FT_BYTES, BASE_NONE, NULL, 0x0,
9956           NULL, HFILL }
9957       },
9958       { &hf_r3_adduserparamtypearray [ADDUSERPARAMTYPE_PRIMARYFIELDTYPE],
9959         { "Primary Field Type", "r3.manageuser.primaryfieldtype",
9960           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_ppmisourcenames_ext, 0x0,
9961           NULL, HFILL }
9962       },
9963       { &hf_r3_adduserparamtypearray [ADDUSERPARAMTYPE_AUXFIELD],
9964         { "Aux Field", "r3.manageuser.auxfield",
9965           FT_BYTES, BASE_NONE, NULL, 0x0,
9966           NULL, HFILL }
9967       },
9968       { &hf_r3_adduserparamtypearray [ADDUSERPARAMTYPE_AUXFIELDTYPE],
9969         { "Aux Field Type", "r3.manageuser.auxfieldtype",
9970           FT_UINT8, BASE_DEC_HEX|BASE_EXT_STRING, &r3_ppmisourcenames_ext, 0x0,
9971           NULL, HFILL }
9972       },
9973       { &hf_r3_adduserparamtypearray [ADDUSERPARAMTYPE_USECOUNT],
9974         { "Use Count", "r3.manageuser.usecount",
9975           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
9976           NULL, HFILL }
9977       },
9978       { &hf_r3_adduserparamtypearray [ADDUSERPARAMTYPE_EXCEPTIONGROUP],
9979         { "Exception Group", "r3.manageuser.exceptiongroup",
9980           FT_UINT8, BASE_DEC_HEX, NULL, 0x0,
9981           NULL, HFILL }
9982       },
9983       { &hf_r3_adduserparamtypearray [ADDUSERPARAMTYPE_EXPIREON],
9984         { "Expire On", "r3.manageuser.expireon",
9985           FT_UINT24, BASE_HEX, NULL, 0x0,
9986           NULL, HFILL }
9987       },
9988       { &hf_r3_adduserparamtypearray [ADDUSERPARAMTYPE_TIMEZONE],
9989         { "Timezone", "r3.manageuser.timezone",
9990           FT_UINT32, BASE_HEX, NULL, 0x0,
9991           NULL, HFILL }
9992       }
9993     };
9994 
9995   /* Setup protocol subtree array */
9996   static gint *ett [] =
9997     {
9998       &ett_r3,
9999       &ett_r3header,
10000       &ett_r3tail,
10001       &ett_r3payload,
10002       &ett_r3cmd,
10003       &ett_r3configitem,
10004       &ett_r3upstreamcommand,
10005       &ett_r3upstreamfield,
10006       &ett_r3timezone,
10007       &ett_r3expireon,
10008       &ett_r3datetime,
10009       &ett_r3eventlogrecord,
10010       &ett_r3declinedlogrecord,
10011       &ett_r3alarmlogrecord,
10012       &ett_r3debugmsg,
10013       &ett_r3defineexceptionstartdate,
10014       &ett_r3defineexceptionenddate,
10015       &ett_r3defineexceptiongroupbits,
10016       &ett_r3definecalendarmonth [1],
10017       &ett_r3definecalendarmonth [2],
10018       &ett_r3definecalendarmonth [3],
10019       &ett_r3definecalendarmonth [4],
10020       &ett_r3definecalendarmonth [5],
10021       &ett_r3definecalendarmonth [6],
10022       &ett_r3definecalendarmonth [7],
10023       &ett_r3definecalendarmonth [8],
10024       &ett_r3definecalendarmonth [9],
10025       &ett_r3definecalendarmonth [10],
10026       &ett_r3definecalendarmonth [11],
10027       &ett_r3definecalendarmonth [12],
10028       &ett_r3definetimezonestarttime,
10029       &ett_r3definetimezoneendtime,
10030       &ett_r3definetimezonedaymap,
10031       &ett_r3eventlogdumpstarttime,
10032       &ett_r3eventlogdumpendtime,
10033       &ett_r3declinedlogdumpstarttime,
10034       &ett_r3declinedlogdumpendtime,
10035       &ett_r3alarmlogdumpstarttime,
10036       &ett_r3alarmlogdumpendtime,
10037       &ett_r3clearnvram,
10038       &ett_r3filters,
10039       &ett_r3alarmlist,
10040       &ett_r3alarmcfg,
10041       &ett_r3commandmfg,
10042       &ett_r3serialnumber,
10043       &ett_r3iopins,
10044       &ett_r3checksumresults,
10045       &ett_r3checksumresultsfield,
10046       &ett_r3forceoptions,
10047       &ett_r3peekpoke,
10048       &ett_r3downloadfirmware,
10049       &ett_r3capabilities,
10050       &ett_r3lockstate,
10051       &ett_r3mortisestatelog,
10052       &ett_r3timerchain,
10053       &ett_r3taskflags,
10054       &ett_r3taskflagsentry,
10055       &ett_r3checkpointlog,
10056       &ett_r3checkpointlogentry,
10057       &ett_r3cpuregisters,
10058       &ett_r3cpuregister,
10059       &ett_r3m41t81registers,
10060       &ett_r3m41t81register,
10061       &ett_r3debuglogrecord,
10062       &ett_r3setdatetime,
10063       &ett_r3manageuser
10064     };
10065 
10066   static ei_register_info ei[] = {
10067     { &ei_r3_malformed_length, { "r3.malformed_length", PI_MALFORMED, PI_ERROR, "Malformed length", EXPFILL }},
10068     { &ei_r3_reserved_upstream_command_value, { "r3.reserved_upstream_command_value", PI_UNDECODED, PI_WARN, "\"Reserved\" Upstream Command value", EXPFILL }},
10069     { &ei_r3_mfgfield, { "r3.mfgfield.field.unknown", PI_UNDECODED, PI_WARN, "Unknown manufacturing command value", EXPFILL }},
10070     { &ei_r3_mfgfield_too_many_adc_values, { "r3.mfgfield.too_many_adc_values", PI_PROTOCOL, PI_WARN, "MFG Field: too many adc values", EXPFILL }},
10071     { &ei_r3_peekpoke_operation, { "r3.peekpoke.operation.unknown", PI_UNDECODED, PI_WARN, "Unknown peekpoke operation value", EXPFILL }},
10072     { &ei_r3_response_hasdata_octet_1, { "r3.response_hasdata.octet_1_not_cmd_response", PI_PROTOCOL, PI_WARN, "Octet 1 not CMD_RESPONSE", EXPFILL }},
10073     { &ei_r3_response_hasdata_octet_2, { "r3.response_hasdata.octet_2_not_response_hasdata", PI_PROTOCOL, PI_WARN, "Octet 2 not RESPONSE_HASDATA", EXPFILL }},
10074     { &ei_r3_response_hasdata_octet_3, { "r3.response_hasdata.octet_3_ge_upstreamcommand_last", PI_PROTOCOL, PI_WARN, "Octet 3 >= UPSTREAMCOMMAND_LAST", EXPFILL }},
10075     { &ei_r3_firmwaredownload_action, { "r3.firmwaredownload.action.unknown", PI_PROTOCOL, PI_WARN, "Unknown Firmware download action", EXPFILL }},
10076     { &ei_r3_cmd_downloadfirmwaretimeout, { "r3.command.downloadfirmwaretimeout", PI_UNDECODED, PI_WARN, "Download Firmware Timeout", EXPFILL }},
10077     { &ei_r3_unknown_command_value, { "r3.command.unknown", PI_UNDECODED, PI_WARN, "Unknown command value", EXPFILL }},
10078   };
10079 
10080   expert_module_t* expert_r3;
10081 
10082   proto_r3 = proto_register_protocol ("Assa Abloy R3", "R3", "r3");
10083   r3_handle = register_dissector ("r3", dissect_r3, proto_r3);
10084   proto_register_field_array (proto_r3, hf, array_length (hf));
10085   proto_register_subtree_array (ett, array_length (ett));
10086   expert_r3 = expert_register_protocol(proto_r3);
10087   expert_register_field_array(expert_r3, ei, array_length(ei));
10088 }
10089 
proto_reg_handoff_r3(void)10090 void proto_reg_handoff_r3 (void)
10091 {
10092   dissector_add_uint_range_with_preference("tcp.port", ASSA_R3_PORT_RANGE, r3_handle);
10093 }
10094 
10095 /*
10096  * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
10097  *
10098  * Local Variables:
10099  * c-basic-offset: 2
10100  * tab-width: 8
10101  * indent-tabs-mode: nil
10102  * End:
10103  *
10104  * vi: set shiftwidth=2 tabstop=8 expandtab:
10105  * :indentSize=2:tabSize=8:noTabs=true:
10106  */
10107