d02f507a0a58a41a4e7c14ead0698e28098d83e3
[obnox/wireshark/wip.git] / epan / dissectors / packet-bacapp.h
1 /* packet-bacapp.h
2  * Routines for BACnet (APDU) dissection
3  * Copyright 2004, Herbert Lischka <lischka@kieback-peter.de>, Berlin
4  *
5  * $Id$
6  *
7  * Ethereal - Network traffic analyzer
8  * By Gerald Combs <gerald@ethereal.com>
9  * Copyright 1998 Gerald Combs
10  *
11  * Copied from README.developer,v 1.23
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software
25  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26  */
27
28 #ifndef __BACAPP_H__
29 #define __BACAPP_H__
30
31 #ifdef HAVE_CONFIG_H
32 # include "config.h"
33 #if HAVE_ICONV_H
34 #include <iconv.h>
35 #endif
36 #endif
37
38 #include <stdio.h>
39 #include <stdlib.h>
40 #include <string.h>
41
42 #include <glib.h>
43
44 #include <epan/packet.h>
45
46 #ifndef min
47 #define min(a,b) (((a)<(b))?(a):(b))
48 #endif
49
50 #ifndef max
51 #define max(a,b) (((a)>(b))?(a):(b))
52 #endif
53
54 #ifndef FAULT
55 #define FAULT                   proto_tree_add_text(subtree, tvb, offset, tvb_length(tvb) - offset, "something is going wrong here !!"); \
56                         offset = tvb_length(tvb);
57 #endif
58
59 #ifndef false
60 #define false 0
61 #endif
62 #ifndef true
63 #define true 1
64 #endif
65
66 /* BACnet PDU Types */
67 #define BACAPP_TYPE_CONFIRMED_SERVICE_REQUEST 0
68 #define BACAPP_TYPE_UNCONFIRMED_SERVICE_REQUEST 1
69 #define BACAPP_TYPE_SIMPLE_ACK 2
70 #define BACAPP_TYPE_COMPLEX_ACK 3
71 #define BACAPP_TYPE_SEGMENT_ACK 4
72 #define BACAPP_TYPE_ERROR 5
73 #define BACAPP_TYPE_REJECT 6
74 #define BACAPP_TYPE_ABORT 7
75 #define MAX_BACAPP_TYPE 8
76
77 #define BACAPP_SEGMENTED_REQUEST 0x08
78 #define BACAPP_MORE_SEGMENTS 0x04
79 #define BACAPP_SEGMENTED_RESPONSE 0x02
80 #define BACAPP_SEGMENT_NAK 0x02
81 #define BACAPP_SENT_BY 0x01
82
83
84 /**
85  * dissect_bacapp ::= CHOICE {
86  *  confirmed-request-PDU       [0] BACnet-Confirmed-Request-PDU,
87  *  unconfirmed-request-PDU     [1] BACnet-Unconfirmed-Request-PDU,
88  *  simpleACK-PDU               [2] BACnet-SimpleACK-PDU,
89  *  complexACK-PDU              [3] BACnet-ComplexACK-PDU,
90  *  segmentACK-PDU              [4] BACnet-SegmentACK-PDU,
91  *  error-PDU                   [5] BACnet-Error-PDU,
92  *  reject-PDU                  [6] BACnet-Reject-PDU,
93  *  abort-PDU                   [7] BACnet-Abort-PDU
94  * }
95  * @param tvb
96  * @param pinfo
97  * @param tree
98  */
99 void
100 dissect_bacapp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
101
102 /**
103  * ConfirmedRequest-PDU ::= SEQUENCE {
104  *      pdu-type                                        [0] Unsigned (0..15), -- 0 for this PDU Type
105  *  segmentedMessage                    [1] BOOLEAN,
106  *  moreFollows                                 [2] BOOLEAN,
107  *  segmented-response-accepted [3] BOOLEAN,
108  *  reserved                                    [4] Unsigned (0..3), -- must be set zero
109  *  max-segments-accepted               [5] Unsigned (0..7), -- as per 20.1.2.4
110  *  max-APDU-length-accepted    [5] Unsigned (0..15), -- as per 20.1.2.5
111  *  invokeID                                    [6] Unsigned (0..255),
112  *  sequence-number                             [7] Unsigned (0..255) OPTIONAL, -- only if segmented msg
113  *  proposed-window-size                [8] Unsigned (0..127) OPTIONAL, -- only if segmented msg
114  *  service-choice                              [9] BACnetConfirmedServiceChoice,
115  *  service-request                             [10] BACnet-Confirmed-Service-Request OPTIONAL
116  * }
117  * @param tvb
118  * @param pinfo
119  * @param tree 
120  * @param offset
121  * @return modified offset
122  */
123 static guint
124 fConfirmedRequestPDU(tvbuff_t *tvb, proto_tree *tree, guint offset);
125
126 /**
127  * @param tvb
128  * @param tree 
129  * @param offset
130  * @param ack - indocates whether working on request or ack
131  * @param svc - output variable to return service choice
132  * @param tt  - output varable to return service choice item
133  * @return modified offset
134  */
135 static guint
136 fStartConfirmed(tvbuff_t *tvb, proto_tree *tree, guint offset, guint8 ack,
137                                 gint *svc, proto_item **tt);
138
139 /**
140  * Unconfirmed-Request-PDU ::= SEQUENCE {
141  *      pdu-type                [0] Unsigned (0..15), -- 1 for this PDU type
142  *  reserved            [1] Unsigned (0..15), -- must be set zero
143  *  service-choice      [2] BACnetUnconfirmedServiceChoice,
144  *  service-request     [3] BACnetUnconfirmedServiceRequest -- Context-specific tags 0..3 are NOT used in header encoding
145  * }
146  * @param tvb
147  * @param tree 
148  * @param offset
149  * @return modified offset
150  */
151 static guint
152 fUnconfirmedRequestPDU(tvbuff_t *tvb, proto_tree *tree, guint offset);
153
154 /**
155  * SimpleACK-PDU ::= SEQUENCE {
156  *      pdu-type                [0] Unsigned (0..15), -- 2 for this PDU type
157  *  reserved            [1] Unsigned (0..15), -- must be set zero
158  *  invokeID            [2] Unsigned (0..255),
159  *  service-ACK-choice  [3] BACnetUnconfirmedServiceChoice -- Context-specific tags 0..3 are NOT used in header encoding
160  * }
161  * @param tvb
162  * @param tree 
163  * @param offset
164  * @return modified offset
165  */
166 static guint
167 fSimpleAckPDU(tvbuff_t *tvb, proto_tree *tree, guint offset);
168
169 /**
170  * ComplexACK-PDU ::= SEQUENCE {
171  *      pdu-type                                [0] Unsigned (0..15), -- 3 for this PDU Type
172  *  segmentedMessage            [1] BOOLEAN,
173  *  moreFollows                         [2] BOOLEAN,
174  *  reserved                            [3] Unsigned (0..3), -- must be set zero
175  *  invokeID                            [4] Unsigned (0..255),
176  *  sequence-number                     [5] Unsigned (0..255) OPTIONAL, -- only if segmented msg
177  *  proposed-window-size        [6] Unsigned (0..127) OPTIONAL, -- only if segmented msg
178  *  service-ACK-choice          [7] BACnetConfirmedServiceChoice,
179  *  service-ACK                         [8] BACnet-Confirmed-Service-Request  -- Context-specific tags 0..8 are NOT used in header encoding
180  * }
181  * @param tvb
182  * @param tree 
183  * @param offset
184  * @return modified offset
185  */
186 static guint
187 fComplexAckPDU(tvbuff_t *tvb, proto_tree *tree, guint offset);
188
189 /**
190  * SegmentACK-PDU ::= SEQUENCE {
191  *      pdu-type                                [0] Unsigned (0..15), -- 4 for this PDU Type
192  *  reserved                            [1] Unsigned (0..3), -- must be set zero
193  *  negative-ACK                        [2] BOOLEAN,
194  *  server                                      [3] BOOLEAN,
195  *  original-invokeID           [4] Unsigned (0..255),
196  *  sequence-number                     [5] Unsigned (0..255),
197  *  actual-window-size          [6] Unsigned (0..127)
198  * }
199  * @param tvb
200  * @param tree 
201  * @param offset
202  * @return modified offset
203  */
204 static guint
205 fSegmentAckPDU(tvbuff_t *tvb, proto_tree *tree, guint offset);
206
207 /**
208  * Error-PDU ::= SEQUENCE {
209  *      pdu-type                                [0] Unsigned (0..15), -- 5 for this PDU Type
210  *  reserved                            [1] Unsigned (0..3), -- must be set zero
211  *  original-invokeID           [2] Unsigned (0..255),
212  *  error-choice                        [3] BACnetConfirmedServiceChoice,
213  *  error                                       [4] BACnet-Error
214  * }
215  * @param tvb
216  * @param tree 
217  * @param offset
218  * @return modified offset
219  */
220 static guint
221 fErrorPDU(tvbuff_t *tvb, proto_tree *tree, guint offset);
222
223 /**
224  * Reject-PDU ::= SEQUENCE {
225  *      pdu-type                                [0] Unsigned (0..15), -- 6 for this PDU Type
226  *  reserved                            [1] Unsigned (0..3), -- must be set zero
227  *  original-invokeID           [2] Unsigned (0..255),
228  *  reject-reason                       [3] BACnetRejectReason
229  * }
230  * @param tvb
231  * @param tree 
232  * @param offset
233  * @return modified offset
234  */
235 static guint
236 fRejectPDU(tvbuff_t *tvb, proto_tree *tree, guint offset);
237
238 /**
239  * Abort-PDU ::= SEQUENCE {
240  *      pdu-type                                [0] Unsigned (0..15), -- 7 for this PDU Type
241  *  reserved                            [1] Unsigned (0..3), -- must be set zero
242  *  server                                      [2] BOOLEAN,
243  *  original-invokeID           [3] Unsigned (0..255),
244  *  abort-reason                        [4] BACnetAbortReason
245  * }
246  * @param tvb
247  * @param tree 
248  * @param offset
249  * @return modified offset
250  */
251 static guint
252 fAbortPDU(tvbuff_t *tvb, proto_tree *tree, guint offset);
253
254 /**
255  * 20.2.4, adds the label with max 64Bit unsigned Integer Value to tree
256  * @param tvb 
257  * @param tree 
258  * @param offset 
259  * @param label 
260  * @return modified offset
261  */
262 static guint
263 fUnsignedTag (tvbuff_t *tvb, proto_tree *tree, guint offset, const gchar *label);
264
265 /**
266  * 20.2.5, adds the label with max 64Bit signed Integer Value to tree
267  * @param tvb 
268  * @param tree 
269  * @param offset 
270  * @param label 
271  * @return modified offset
272  */
273 static guint
274 fSignedTag (tvbuff_t *tvb, proto_tree *tree, guint offset, const gchar *label);
275
276 /**
277  * 20.2.8, adds the label with Octet String to tree; if lvt == 0 then lvt = restOfFrame
278  * @param tvb 
279  * @param tree 
280  * @param offset 
281  * @param label 
282  * @param lvt length of String
283  * @return modified offset
284  */
285 static guint
286 fOctetString (tvbuff_t *tvb, proto_tree *tree, guint offset, const gchar *label, guint32 lvt);
287
288 /**
289  * 20.2.12, adds the label with Date Value to tree
290  * @param tvb 
291  * @param tree 
292  * @param offset 
293  * @param label 
294  * @return modified offset
295  */
296 static guint
297 fDate    (tvbuff_t *tvb, proto_tree *tree, guint offset, const gchar *label);
298
299 /**
300  * 20.2.13, adds the label with Time Value to tree
301  * @param tvb 
302  * @param tree 
303  * @param offset 
304  * @param label 
305  * @return modified offset
306  */
307 static guint
308 fTime (tvbuff_t *tvb, proto_tree *tree, guint offset, const gchar *label);
309
310 /**
311  * 20.2.14, adds Object Identifier to tree
312  * use BIG ENDIAN: Bits 31..22 Object Type, Bits 21..0 Instance Number
313  * @param tvb 
314  * @param tree 
315  * @param offset 
316  * @return modified offset
317  */
318 static guint
319 fObjectIdentifier (tvbuff_t *tvb, proto_tree *tree, guint offset);
320
321 /**
322  * BACnet-Confirmed-Service-Request ::= CHOICE {
323  * }
324  * @param tvb
325  * @param tree
326  * @param offset
327  * @param service_choice
328  * @return offset
329  */
330 static guint
331 fConfirmedServiceRequest (tvbuff_t *tvb, proto_tree *tree, guint offset, gint service_choice);
332
333 /**
334  * BACnet-Confirmed-Service-ACK ::= CHOICE {
335  * }
336  * @param tvb
337  * @param tree
338  * @param offset
339  * @param service_choice
340  * @return offset
341  */
342 static guint
343 fConfirmedServiceAck (tvbuff_t *tvb, proto_tree *tree, guint offset, gint service_choice);
344
345 /**
346  * AcknowledgeAlarm-Request ::= SEQUENCE {
347  *      acknowledgingProcessIdentifier  [0]     Unsigned32,
348  *      eventObjectIdentifier   [1] BACnetObjectIdentifer,
349  *      eventStateAcknowledge   [2] BACnetEventState,
350  *      timeStamp       [3] BACnetTimeStamp,
351  *      acknowledgementSource   [4] Character String,
352  *  timeOfAcknowledgement       [5] BACnetTimeStamp
353  * }
354  * @param tvb 
355  * @param tree
356  * @param offset 
357  * @return modified offset
358  */
359 static guint
360 fAcknowledgeAlarmRequest (tvbuff_t *tvb, proto_tree *tree, guint offset);
361
362 /**
363  * ConfirmedCOVNotification-Request ::= SEQUENCE {
364  *      subscriberProcessIdentifier     [0]     Unsigned32,
365  *      initiatingDeviceIdentifier      [1] BACnetObjectIdentifer,
366  *      monitoredObjectIdentifier       [2] BACnetObjectIdentifer,
367  *      timeRemaining   [3] unsigned,
368  *      listOfValues    [4] SEQUENCE OF BACnetPropertyValues
369  * }
370  * @param tvb 
371  * @param tree
372  * @param offset 
373  * @return modified offset
374  */
375 static guint
376 fConfirmedCOVNotificationRequest (tvbuff_t *tvb, proto_tree *tree, guint offset);
377
378 /**
379  * ConfirmedEventNotification-Request ::= SEQUENCE {
380  *      ProcessIdentifier       [0]     Unsigned32,
381  *      initiatingDeviceIdentifier      [1] BACnetObjectIdentifer,
382  *      eventObjectIdentifier   [2] BACnetObjectIdentifer,
383  *      timeStamp       [3] BACnetTimeStamp,
384  *      notificationClass       [4] unsigned,
385  *      priority        [5] unsigned8,
386  *      eventType       [6] BACnetEventType,
387  *      messageText     [7] CharacterString OPTIONAL,
388  *      notifyType      [8] BACnetNotifyType,
389  *      ackRequired     [9] BOOLEAN OPTIONAL,
390  *      fromState       [10] BACnetEventState OPTIONAL,
391  *      toState [11] BACnetEventState,
392  *      eventValues     [12] BACnetNotificationParameters OPTIONAL
393  * }
394  * @param tvb 
395  * @param tree
396  * @param offset 
397  * @return modified offset
398  */
399 static guint
400 fConfirmedEventNotificationRequest (tvbuff_t *tvb, proto_tree *tree, guint offset);
401
402 /**
403  * GetAlarmSummary-ACK ::= SEQUENCE OF SEQUENCE {
404  *      objectIdentifier        BACnetObjectIdentifer,
405  *      alarmState      BACnetEventState,
406  *      acknowledgedTransitions  BACnetEventTransitionBits
407  * }
408  * @param tvb 
409  * @param tree
410  * @param offset 
411  * @return modified offset
412  */
413 static guint
414 fGetAlarmSummaryAck (tvbuff_t *tvb, proto_tree *tree, guint offset);
415
416 /**
417  * GetEnrollmentSummary-Request ::= SEQUENCE {
418  *      acknowledgmentFilter    [0]     ENUMERATED {
419  *      all (0),
420  *      acked   (1),
421  *      not-acked   (2)
422  *      },
423  *      enrollmentFilter        [1] BACnetRecipientProcess OPTIONAL,
424  *      eventStateFilter        [2] ENUMERATED {
425  *      offnormal   (0),
426  *      fault   (1),
427  *      normal  (2),
428  *      all (3),
429  *      active  (4)
430  *      },
431  *      eventTypeFilter [3] BACnetEventType OPTIONAL,
432  *      priorityFilter  [4] SEQUENCE {
433  *      minPriority [0] Unsigned8,
434  *      maxPriority [1] Unsigned8
435  *      } OPTIONAL,
436  *  notificationClassFilter     [5] Unsigned OPTIONAL
437  * }
438  * @param tvb 
439  * @param tree
440  * @param offset 
441  * @return modified offset
442  */
443 static guint
444 fGetEnrollmentSummaryRequest (tvbuff_t *tvb, proto_tree *tree, guint offset);
445
446 /**
447  * GetEnrollmentSummary-ACK ::= SEQUENCE OF SEQUENCE {
448  *      objectIdentifier        BACnetObjectIdentifer,
449  *      eventType       BACnetEventType,
450  *      eventState      BACnetEventState,
451  *      priority    Unsigned8,
452  *  notificationClass   Unsigned OPTIONAL
453  * }
454  * @param tvb 
455  * @param tree
456  * @param offset 
457  * @return modified offset
458  */
459 static guint
460 fGetEnrollmentSummaryAck (tvbuff_t *tvb, proto_tree *tree, guint offset);
461
462 /**
463  * GetEventInformation-Request ::= SEQUENCE {
464  *      lastReceivedObjectIdentifier    [0] BACnetObjectIdentifer
465  * }
466  * @param tvb 
467  * @param tree
468  * @param offset 
469  * @return modified offset
470  */
471 static guint
472 fGetEventInformationRequest (tvbuff_t *tvb, proto_tree *tree, guint offset);
473
474 /**
475  * GetEventInformation-ACK ::= SEQUENCE {
476  *      listOfEventSummaries    [0] listOfEventSummaries,
477  *  moreEvents  [1] BOOLEAN
478  * }
479  * @param tvb 
480  * @param tree
481  * @param offset 
482  * @return modified offset
483  */
484 static guint
485 fGetEventInformationACK (tvbuff_t *tvb, proto_tree *tree, guint offset);
486
487 /**
488  * LifeSafetyOperation-Request ::= SEQUENCE {
489  *      requestingProcessIdentifier     [0]     Unsigned32
490  *      requestingSource        [1] CharacterString
491  *      request [2] BACnetLifeSafetyOperation
492  *      objectIdentifier        [3] BACnetObjectIdentifier OPTIONAL
493  * }
494  * @param tvb 
495  * @param tree
496  * @param offset 
497  * @return modified offset
498  */
499 static guint
500 fLifeSafetyOperationRequest(tvbuff_t *tvb, proto_tree *tree, guint offset, const gchar *label);
501
502 /**
503  * SubscribeCOV-Request ::= SEQUENCE {
504  *      subscriberProcessIdentifier     [0]     Unsigned32
505  *      monitoredObjectIdentifier       [1] BACnetObjectIdentifier
506  *      issueConfirmedNotifications     [2] BOOLEAN OPTIONAL
507  *      lifetime        [3] Unsigned OPTIONAL
508  * }
509  * @param tvb 
510  * @param tree 
511  * @param offset 
512  * @param label 
513  * @param src
514  * @return modified offset
515  */
516 static guint
517 fSubscribeCOVRequest(tvbuff_t *tvb, proto_tree *tree, guint offset);
518
519 /**
520  * SubscribeCOVProperty-Request ::= SEQUENCE {
521  *      subscriberProcessIdentifier     [0]     Unsigned32
522  *      monitoredObjectIdentifier       [1] BACnetObjectIdentifier
523  *      issueConfirmedNotifications     [2] BOOLEAN OPTIONAL
524  *      lifetime        [3] Unsigned OPTIONAL
525  *      monitoredPropertyIdentifier     [4] BACnetPropertyReference OPTIONAL
526  *      covIncrement    [5] Unsigned OPTIONAL
527  * }
528  * @param tvb 
529  * @param tree 
530  * @param offset 
531  * @return modified offset
532  */
533 static guint
534 fSubscribeCOVPropertyRequest(tvbuff_t *tvb, proto_tree *tree, guint offset);
535
536 /**
537  * AtomicReadFile-Request ::= SEQUENCE {
538  *      fileIdentifier  BACnetObjectIdentifier,
539  *  accessMethod        CHOICE {
540  *      streamAccess    [0] SEQUENCE {
541  *              fileStartPosition       INTEGER,
542  *                      requestedOctetCount     Unsigned
543  *                      },
544  *              recordAccess    [1] SEQUENCE {
545  *                      fileStartRecord INTEGER,
546  *                      requestedRecordCount    Unsigned
547  *                      }
548  *              }
549  * }
550  * @param tvb 
551  * @param tree 
552  * @param offset 
553  * @return modified offset
554  */
555 static guint
556 fAtomicReadFileRequest(tvbuff_t *tvb, proto_tree *tree, guint offset);
557
558 /**
559  * AtomicWriteFile-ACK ::= SEQUENCE {
560  *      endOfFile       BOOLEAN,
561  *  accessMethod        CHOICE {
562  *      streamAccess    [0] SEQUENCE {
563  *              fileStartPosition       INTEGER,
564  *                      fileData        OCTET STRING
565  *                      },
566  *              recordAccess    [1] SEQUENCE {
567  *                      fileStartRecord INTEGER,
568  *                      returnedRecordCount     Unsigned,
569  *                      fileRecordData  SEQUENCE OF OCTET STRING
570  *                      }
571  *              }
572  * }
573  * @param tvb 
574  * @param tree 
575  * @param offset 
576  * @return modified offset
577  */
578 static guint
579 fAtomicReadFileAck (tvbuff_t *tvb, proto_tree *tree, guint offset);
580
581 /**
582  * AtomicWriteFile-Request ::= SEQUENCE {
583  *      fileIdentifier  BACnetObjectIdentifier,
584  *  accessMethod        CHOICE {
585  *      streamAccess    [0] SEQUENCE {
586  *              fileStartPosition       INTEGER,
587  *                      fileData        OCTET STRING
588  *                      },
589  *              recordAccess    [1] SEQUENCE {
590  *                      fileStartRecord INTEGER,
591  *                      recordCount     Unsigned,
592  *                      fileRecordData  SEQUENCE OF OCTET STRING
593  *                      }
594  *              }
595  * }
596  * @param tvb 
597  * @param tree 
598  * @param offset 
599  * @return modified offset
600  */
601 static guint
602 fAtomicWriteFileRequest(tvbuff_t *tvb, proto_tree *tree, guint offset);
603
604 /**
605  * AtomicWriteFile-ACK ::= SEQUENCE {
606  *              fileStartPosition       [0] INTEGER,
607  *              fileStartRecord [1] INTEGER,
608  * }
609  * @param tvb 
610  * @param tree 
611  * @param offset 
612  * @return modified offset
613  */
614 static guint
615 fAtomicWriteFileAck (tvbuff_t *tvb, proto_tree *tree, guint offset);
616
617 /**
618  * AddListElement-Request ::= SEQUENCE {
619  *      objectIdentifier        [0] BACnetObjectIdentifier,
620  *  propertyIdentifier  [1] BACnetPropertyIdentifier,
621  *  propertyArrayIndex  [2] Unsigned OPTIONAL, -- used only with array datatype
622  *  listOfElements  [3] ABSTRACT-SYNTAX.&Type
623  * }
624  * @param tvb 
625  * @param tree
626  * @param offset 
627  * @return modified offset
628  */
629 static guint
630 fAddListElementRequest(tvbuff_t *tvb, proto_tree *tree, guint offset);
631
632 /**
633  * CreateObject-Request ::= SEQUENCE {
634  *      objectSpecifier [0] ObjectSpecifier,
635  *  listOfInitialValues [1] SEQUENCE OF BACnetPropertyValue OPTIONAL
636  * }
637  * @param tvb 
638  * @param tree 
639  * @param offset 
640  * @return modified offset
641  */
642 static guint
643 fCreateObjectRequest(tvbuff_t *tvb, proto_tree *subtree, guint offset);
644
645 /**
646  * CreateObject-Request ::= BACnetObjectIdentifier
647  * @param tvb 
648  * @param tree 
649  * @param offset 
650  * @return modified offset
651  */
652 static guint
653 fCreateObjectAck (tvbuff_t *tvb, proto_tree *tree, guint offset);
654
655 /**
656  * DeleteObject-Request ::= SEQUENCE {
657  *      ObjectIdentifier        BACnetObjectIdentifer
658  * }
659  * @param tvb 
660  * @param tree
661  * @param offset 
662  * @return modified offset
663  */
664 static guint
665 fDeleteObjectRequest(tvbuff_t *tvb, proto_tree *tree, guint offset);
666
667 /**
668  * ReadProperty-Request ::= SEQUENCE {
669  *      objectIdentifier        [0]     BACnetObjectIdentifier,
670  *      propertyIdentifier      [1] BACnetPropertyIdentifier,
671  *      propertyArrayIndex      [2] Unsigned OPTIONAL, -- used only with array datatype
672  * }
673  * @param tvb 
674  * @param tree 
675  * @param offset 
676  * @return modified offset
677  */
678 static guint
679 fReadPropertyRequest(tvbuff_t *tvb, proto_tree *tree, guint offset);
680
681 /**
682  * ReadProperty-ACK ::= SEQUENCE {
683  *      objectIdentifier        [0]     BACnetObjectIdentifier,
684  *      propertyIdentifier      [1] BACnetPropertyIdentifier,
685  *      propertyArrayIndex      [2] Unsigned OPTIONAL, -- used only with array datatype
686  *      propertyValue   [3] ABSTRACT-SYNTAX.&Type
687  * }
688  * @param tvb 
689  * @param tree 
690  * @param offset 
691  * @return modified offset
692  */
693 static guint
694 fReadPropertyAck (tvbuff_t *tvb, proto_tree *tree, guint offset);
695
696 /**
697  * ReadPropertyConditional-Request ::= SEQUENCE {
698  *      objectSelectionCriteria [0] objectSelectionCriteria,
699  *      listOfPropertyReferences        [1] SEQUENCE OF BACnetPropertyReference OPTIONAL
700  * }
701  * @param tvb 
702  * @param tree 
703  * @param offset 
704  * @return modified offset
705  */
706 static guint
707 fReadPropertyConditionalRequest(tvbuff_t *tvb, proto_tree *subtree, guint offset);
708
709 /**
710  * ReadPropertyConditional-ACK ::= SEQUENCE {
711  *      listOfPReadAccessResults        SEQUENCE OF ReadAccessResult OPTIONAL
712  * }
713  * @param tvb 
714  * @param tree 
715  * @param offset 
716  * @return modified offset
717  */
718 static guint
719 fReadPropertyConditionalAck (tvbuff_t *tvb, proto_tree *tree, guint offset);
720
721 /**
722  * ReadPropertyMultiple-Request ::= SEQUENCE {
723  *  listOfReadAccessSpecs       SEQUENCE OF ReadAccessSpecification
724  * }
725  * @param tvb
726  * @param tree
727  * @param offset
728  * @return offset modified
729  */
730 static guint
731 fReadPropertyMultipleRequest(tvbuff_t *tvb, proto_tree *subtree, guint offset);
732
733 /**
734  * ReadPropertyMultiple-Ack ::= SEQUENCE {
735  *  listOfReadAccessResults     SEQUENCE OF ReadAccessResult
736  * }
737  * @param tvb
738  * @param tree
739  * @param offset
740  * @return offset modified
741  */
742 static guint
743 fReadPropertyMultipleAck (tvbuff_t *tvb, proto_tree *tree, guint offset);
744
745 /**
746  * ReadRange-Request ::= SEQUENCE {
747  *      objectIdentifier        [0] BACnetObjectIdentifier,
748  *  propertyIdentifier  [1] BACnetPropertyIdentifier,
749  *  propertyArrayIndex  [2] Unsigned OPTIONAL, -- used only with array datatype
750  *      range   CHOICE {
751  *              byPosition      [3] SEQUENCE {
752  *                      referencedIndex Unsigned,
753  *                      count INTEGER
754  *                      },
755  *              byTime  [4] SEQUENCE {
756  *                      referenceTime BACnetDateTime,
757  *                      count INTEGER
758  *                      },
759  *              timeRange       [5] SEQUENCE {
760  *                      beginningTime BACnetDateTime,
761  *                      endingTime BACnetDateTime
762  *                      },
763  *              } OPTIONAL
764  * }
765  * @param tvb 
766  * @param tree 
767  * @param offset 
768  * @return modified offset
769  */
770 static guint
771 fReadRangeRequest (tvbuff_t *tvb, proto_tree *tree, guint offset);
772
773 /**
774  * ReadRange-ACK ::= SEQUENCE {
775  *      objectIdentifier        [0] BACnetObjectIdentifier,
776  *  propertyIdentifier  [1] BACnetPropertyIdentifier,
777  *  propertyArrayIndex  [2] Unsigned OPTIONAL, -- used only with array datatype
778  *  resultFlags [3] BACnetResultFlags,
779  *  itemCount   [4] Unsigned,
780  *  itemData    [5] SEQUENCE OF ABSTRACT-SYNTAX.&Type
781  * }
782  * @param tvb 
783  * @param tree 
784  * @param offset 
785  * @return modified offset
786  */
787 static guint
788 fReadRangeAck (tvbuff_t *tvb, proto_tree *tree, guint offset);
789
790 /**
791  * RemoveListElement-Request ::= SEQUENCE {
792  *      objectIdentifier        [0]     BACnetObjectIdentifier,
793  *      propertyIdentifier      [1] BACnetPropertyIdentifier,
794  *      propertyArrayIndex      [2] Unsigned OPTIONAL, -- used only with array datatype
795  *      listOfElements  [3] ABSTRACT-SYNTAX.&Type
796  * }
797  * @param tvb 
798  * @param tree 
799  * @param offset 
800  * @return modified offset
801  */
802 static guint
803 fRemoveListElementRequest(tvbuff_t *tvb, proto_tree *tree, guint offset);
804
805 /**
806  * WriteProperty-Request ::= SEQUENCE {
807  *      objectIdentifier        [0]     BACnetObjectIdentifier,
808  *      propertyIdentifier      [1] BACnetPropertyIdentifier,
809  *      propertyArrayIndex      [2] Unsigned OPTIONAL, -- used only with array datatype
810  *      propertyValue   [3] ABSTRACT-SYNTAX.&Type
811  *  priority    [4] Unsigned8 (1..16) OPTIONAL --used only when property is commandable
812  * }
813  * @param tvb 
814  * @param tree 
815  * @param offset 
816  * @return modified offset
817  */
818 static guint
819 fWritePropertyRequest(tvbuff_t *tvb, proto_tree *tree, guint offset);
820
821 /**
822  * WritePropertyMultiple-Request ::= SEQUENCE {
823  *      listOfWriteAccessSpecifications SEQUENCE OF WriteAccessSpecification
824  * }
825  * @param tvb 
826  * @param tree 
827  * @param offset 
828  * @return modified offset
829  */
830 static guint
831 fWritePropertyMultipleRequest(tvbuff_t *tvb, proto_tree *tree, guint offset);
832
833 /**
834  * DeviceCommunicationControl-Request ::= SEQUENCE {
835  *      timeDuration    [0] Unsigned16 OPTIONAL,
836  *  enable-disable      [1] ENUMERATED {
837  *              enable (0),
838  *              disable (1)
839  *              },
840  *  password    [2] CharacterString (SIZE(1..20)) OPTIONAL
841  * }
842  * @param tvb 
843  * @param tree
844  * @param offset 
845  * @return modified offset
846  */
847 static guint
848 fDeviceCommunicationControlRequest(tvbuff_t *tvb, proto_tree *tree, guint offset);
849
850 /**
851  * ConfirmedPrivateTransfer-Request ::= SEQUENCE {
852  *      vendorID        [0]     Unsigned,
853  *      serviceNumber   [1] Unsigned,
854  *      serviceParameters       [2] ABSTRACT-SYNTAX.&Type OPTIONAL
855  * }
856  * @param tvb 
857  * @param tree 
858  * @param offset 
859  * @return modified offset
860  */
861 static guint
862 fConfirmedPrivateTransferRequest(tvbuff_t *tvb, proto_tree *tree, guint offset);
863
864 /**
865  * ConfirmedPrivateTransfer-ACK ::= SEQUENCE {
866  *      vendorID        [0]     Unsigned,
867  *      serviceNumber   [1] Unsigned,
868  *      resultBlock     [2] ABSTRACT-SYNTAX.&Type OPTIONAL
869  * }
870  * @param tvb 
871  * @param tree 
872  * @param offset 
873  * @return modified offset
874  */
875 static guint
876 fConfirmedPrivateTransferAck(tvbuff_t *tvb, proto_tree *tree, guint offset);
877
878 /**
879  * ConfirmedTextMessage-Request ::=  SEQUENCE {
880  *  textMessageSourceDevice [0] BACnetObjectIdentifier,
881  *  messageClass [1] CHOICE {
882  *      numeric [0] Unsigned,
883  *      character [1] CharacterString
884  *      } OPTIONAL,
885  *  messagePriority [2] ENUMERATED {
886  *      normal (0),
887  *      urgent (1)
888  *      },
889  *  message [3] CharacterString
890  * }
891  * @param tvb 
892  * @param tree
893  * @param offset 
894  * @return modified offset
895  */
896 static guint
897 fConfirmedTextMessageRequest(tvbuff_t *tvb, proto_tree *tree, guint offset);
898
899 /**
900  * ReinitializeDevice-Request ::= SEQUENCE {
901  *  reinitializedStateOfDevice  [0] ENUMERATED {
902  *              coldstart (0),
903  *              warmstart (1),
904  *              startbackup (2),
905  *              endbackup (3),
906  *              startrestore (4),
907  *              endrestore (5),
908  *              abortrestor (6)
909  *              },
910  *  password    [1] CharacterString (SIZE(1..20)) OPTIONAL
911  * }
912  * @param tvb 
913  * @param tree
914  * @param offset 
915  * @return modified offset
916  */
917 static guint
918 fReinitializeDeviceRequest(tvbuff_t *tvb, proto_tree *tree, guint offset);
919
920 /**
921  * VTOpen-Request ::= SEQUENCE {
922  *  vtClass     BACnetVTClass,
923  *  localVTSessionIdentifier    Unsigned8
924  * }
925  * @param tvb 
926  * @param tree
927  * @param offset 
928  * @return modified offset
929  */
930 static guint
931 fVtOpenRequest(tvbuff_t *tvb, proto_tree *tree, guint offset);
932
933 /**
934  * VTOpen-ACK ::= SEQUENCE {
935  *  remoteVTSessionIdentifier   Unsigned8
936  * }
937  * @param tvb 
938  * @param tree
939  * @param offset 
940  * @return modified offset
941  */
942 static guint
943 fVtOpenAck (tvbuff_t *tvb, proto_tree *tree, guint offset);
944
945 /**
946  * VTClose-Request ::= SEQUENCE {
947  *  listOfRemoteVTSessionIdentifiers    SEQUENCE OF Unsigned8
948  * }
949  * @param tvb 
950  * @param tree
951  * @param offset 
952  * @return modified offset
953  */
954 static guint
955 fVtCloseRequest (tvbuff_t *tvb, proto_tree *tree, guint offset);
956
957 /**
958  * VTData-Request ::= SEQUENCE {
959  *  vtSessionIdentifier Unsigned8,
960  *  vtNewData   OCTET STRING,
961  *  vtDataFlag  Unsigned (0..1)
962  * }
963  * @param tvb 
964  * @param tree
965  * @param offset 
966  * @return modified offset
967  */
968 static guint
969 fVtDataRequest (tvbuff_t *tvb, proto_tree *tree, guint offset);
970
971 /**
972  * VTData-ACK ::= SEQUENCE {
973  *  allNewDataAccepted  [0] BOOLEAN,
974  *  acceptedOctetCount  [1] Unsigned OPTIONAL -- present only if allNewDataAccepted = FALSE
975  * }
976  * @param tvb 
977  * @param tree
978  * @param offset 
979  * @return modified offset
980  */
981 static guint
982 fVtDataAck (tvbuff_t *tvb, proto_tree *tree, guint offset);
983
984 /**
985  * Authenticate-Request ::= SEQUENCE {
986  *  pseudoRandomNumber  [0] Unsigned32,
987  *  excpectedInvokeID   [1] Unsigned8 OPTIONAL,
988  *  operatorName        [2] CharacterString OPTIONAL,
989  *  operatorPassword    [3] CharacterString (SIZE(1..20)) OPTIONAL,
990  *  startEncypheredSession      [4] BOOLEAN OPTIONAL
991  * }
992  * @param tvb 
993  * @param tree
994  * @param offset 
995  * @return modified offset
996  */
997 static guint
998 fAuthenticateRequest (tvbuff_t *tvb, proto_tree *tree, guint offset);
999
1000 /**
1001  * Authenticate-ACK ::= SEQUENCE {
1002  *  modifiedRandomNumber        Unsigned32,
1003  * }
1004  * @param tvb 
1005  * @param tree
1006  * @param offset 
1007  * @return modified offset
1008  */
1009 static guint
1010 fAuthenticateAck (tvbuff_t *tvb, proto_tree *tree, guint offset);
1011
1012 /**
1013  * RequestKey-Request ::= SEQUENCE {
1014  *  requestingDeviceIdentifier  BACnetObjectIdentifier,
1015  *  requestingDeviceAddress     BACnetAddress,
1016  *  remoteDeviceIdentifier      BACnetObjectIdentifier,
1017  *  remoteDeviceAddress BACnetAddress
1018  * }
1019  * @param tvb 
1020  * @param tree
1021  * @param offset 
1022  * @return modified offset
1023  */
1024 static guint
1025 fRequestKeyRequest (tvbuff_t *tvb, proto_tree *tree, guint offset);
1026
1027 /**
1028  * Unconfirmed-Service-Request ::= CHOICE {
1029  * }
1030  * @param tvb 
1031  * @param tree 
1032  * @param offset
1033  * @param service_choice
1034  * @return modified offset
1035  */
1036 static guint
1037 fUnconfirmedServiceRequest (tvbuff_t *tvb, proto_tree *tree, guint offset, gint service_choice);
1038
1039 /**
1040  * UnconfirmedCOVNotification-Request ::= SEQUENCE {
1041  *      subscriberProcessIdentifier     [0]     Unsigned32,
1042  *      initiatingDeviceIdentifier      [1] BACnetObjectIdentifer,
1043  *      monitoredObjectIdentifier       [2] BACnetObjectIdentifer,
1044  *      timeRemaining   [3] unsigned,
1045  *      listOfValues    [4] SEQUENCE OF BACnetPropertyValues
1046  * }
1047  * @param tvb 
1048  * @param tree
1049  * @param offset 
1050  * @return modified offset
1051  */
1052 static guint
1053 fUnconfirmedCOVNotificationRequest (tvbuff_t *tvb, proto_tree *tree, guint offset);
1054
1055 /**
1056  * UnconfirmedEventNotification-Request ::= SEQUENCE {
1057  *      ProcessIdentifier       [0]     Unsigned32,
1058  *      initiatingDeviceIdentifier      [1] BACnetObjectIdentifer,
1059  *      eventObjectIdentifier   [2] BACnetObjectIdentifer,
1060  *      timeStamp       [3] BACnetTimeStamp,
1061  *      notificationClass       [4] unsigned,
1062  *      priority        [5] unsigned8,
1063  *      eventType       [6] BACnetEventType,
1064  *      messageText     [7] CharacterString OPTIONAL,
1065  *      notifyType      [8] BACnetNotifyType,
1066  *      ackRequired     [9] BOOLEAN OPTIONAL,
1067  *      fromState       [10] BACnetEventState OPTIONAL,
1068  *      toState [11] BACnetEventState,
1069  *      eventValues     [12] BACnetNotificationParameters OPTIONAL
1070  * }
1071  * @param tvb 
1072  * @param tree
1073  * @param offset 
1074  * @return modified offset
1075  */
1076 static guint
1077 fUnconfirmedEventNotificationRequest (tvbuff_t *tvb, proto_tree *tree, guint offset);
1078
1079 /**
1080  * I-Am-Request ::= SEQUENCE {
1081  *      aAmDeviceIdentifier     BACnetObjectIdentifier,
1082  *  maxAPDULengthAccepted       Unsigned,
1083  *      segmentationSupported   BACnetSegmentation,
1084  *      vendorID        Unsigned
1085  * }
1086  * @param tvb 
1087  * @param tree 
1088  * @param offset 
1089  * @return modified offset
1090  */
1091 static guint
1092 fIAmRequest  (tvbuff_t *tvb, proto_tree *tree, guint offset);
1093
1094
1095 /**
1096  * I-Have-Request ::= SEQUENCE {
1097  *      deviceIdentifier        BACnetObjectIdentifier,
1098  *  objectIdentifier    BACnetObjectIdentifier,
1099  *      objectName      CharacterString
1100  * }
1101  * @param tvb 
1102  * @param tree 
1103  * @param offset 
1104  * @return modified offset
1105  */
1106 static guint
1107 fIHaveRequest  (tvbuff_t *tvb, proto_tree *tree, guint offset);
1108
1109 /**
1110  * UnconfirmedPrivateTransfer-Request ::= SEQUENCE {
1111  *      vendorID        [0]     Unsigned,
1112  *      serviceNumber   [1] Unsigned,
1113  *      serviceParameters       [2] ABSTRACT-SYNTAX.&Type OPTIONAL
1114  * }
1115  * @param tvb 
1116  * @param tree 
1117  * @param offset 
1118  * @return modified offset
1119  */
1120 static guint
1121 fUnconfirmedPrivateTransferRequest(tvbuff_t *tvb, proto_tree *tree, guint offset);
1122
1123 /**
1124  * UnconfirmedTextMessage-Request ::=  SEQUENCE {
1125  *  textMessageSourceDevice [0] BACnetObjectIdentifier,
1126  *  messageClass [1] CHOICE {
1127  *      numeric [0] Unsigned,
1128  *      character [1] CharacterString
1129  *      } OPTIONAL,
1130  *  messagePriority [2] ENUMERATED {
1131  *      normal (0),
1132  *      urgent (1)
1133  *      },
1134  *  message [3] CharacterString
1135  * }
1136  * @param tvb 
1137  * @param tree
1138  * @param offset 
1139  * @return modified offset
1140  */
1141 static guint
1142 fUnconfirmedTextMessageRequest(tvbuff_t *tvb, proto_tree *tree, guint offset);
1143
1144 /**
1145  * TimeSynchronization-Request ::=  SEQUENCE {
1146  *  BACnetDateTime
1147  * }
1148  * @param tvb 
1149  * @param tree
1150  * @param offset 
1151  * @return modified offset
1152  */
1153 static guint
1154 fTimeSynchronizationRequest  (tvbuff_t *tvb, proto_tree *tree, guint offset);
1155
1156 /**
1157  * UTCTimeSynchronization-Request ::=  SEQUENCE {
1158  *  BACnetDateTime
1159  * }
1160  * @param tvb 
1161  * @param tree
1162  * @param offset 
1163  * @return modified offset
1164  */
1165 static guint
1166 fUTCTimeSynchronizationRequest  (tvbuff_t *tvb, proto_tree *tree, guint offset);
1167
1168 /**
1169  * Who-Has-Request ::=  SEQUENCE {
1170  *  limits SEQUENCE {
1171  *      deviceInstanceRangeLowLimit [0] Unsigned (0..4194303),
1172  *      deviceInstanceRangeHighLimit [1] Unsigned (0..4194303)
1173  *      } OPTIONAL,
1174  *  object CHOICE {
1175  *      objectIdentifier [2] BACnetObjectIdentifier,
1176  *      objectName [3] CharacterString
1177  *      }
1178  * }
1179  * @param tvb 
1180  * @param tree
1181  * @param offset 
1182  * @return modified offset
1183  */
1184 static guint
1185 fWhoHas (tvbuff_t *tvb, proto_tree *tree, guint offset);
1186
1187 /**
1188  * Who-Is-Request ::= SEQUENCE {
1189  *      deviceInstanceRangeLowLimit     [0] Unsigned (0..4194303) OPTIONAL, -- must be used as a pair, see 16.9,
1190  *      deviceInstanceRangeHighLimit    [0] Unsigned (0..4194303) OPTIONAL, -- must be used as a pair, see 16.9,
1191  * }
1192  * @param tvb 
1193  * @param tree 
1194  * @param offset 
1195  * @return modified offset
1196  */
1197 static guint
1198 fWhoIsRequest  (tvbuff_t *tvb, proto_tree *tree, guint offset);
1199
1200 /**
1201  * BACnet-Error ::= CHOICE {
1202  *  addListElement          [8] ChangeList-Error,
1203  *  removeListElement       [9] ChangeList-Error,
1204  *  writePropertyMultiple   [16] WritePropertyMultiple-Error,
1205  *  confirmedPrivatTransfer [18] ConfirmedPrivateTransfer-Error,
1206  *  vtClose                 [22] VTClose-Error,
1207  *  readRange               [26] ObjectAccessService-Error
1208  *                      [default] Error
1209  * }
1210  * @param tvb
1211  * @param tree 
1212  * @param offset
1213  * @param service
1214  * @return modified offset
1215  */
1216 static guint
1217 fBACnetError(tvbuff_t *tvb, proto_tree *tree, guint offset, guint service);
1218
1219 /**
1220  * Dissect a BACnetError in a context tag
1221  *
1222  * @param tvb
1223  * @param tree 
1224  * @param offset
1225  * @return modified offset
1226  */
1227 static guint fContextTaggedError(tvbuff_t *tvb, proto_tree *tree, guint offset);
1228
1229 /**
1230  * ChangeList-Error ::= SEQUENCE {
1231  *    errorType     [0] Error,
1232  *    firstFailedElementNumber  [1] Unsigned
1233  *    }
1234  * }
1235  * @param tvb
1236  * @param tree 
1237  * @param offset
1238  * @return modified offset
1239  */
1240 static guint
1241 fChangeListError(tvbuff_t *tvb, proto_tree *tree, guint offset);
1242
1243 /**
1244  * CreateObject-Error ::= SEQUENCE {
1245  *    errorType     [0] Error,
1246  *    firstFailedElementNumber  [1] Unsigned
1247  *    }
1248  * }
1249  * @param tvb
1250  * @param tree 
1251  * @param offset
1252  * @return modified offset
1253  */
1254 static guint
1255 fCreateObjectError(tvbuff_t *tvb, proto_tree *tree, guint offset);
1256
1257 /**
1258  * ConfirmedPrivateTransfer-Error ::= SEQUENCE {
1259  *    errorType     [0] Error,
1260  *    vendorID      [1] Unsigned,
1261  *    serviceNumber [2] Unsigned,
1262  *    errorParameters   [3] ABSTRACT-SYNTAX.&Type OPTIONAL
1263  *    }
1264  * }
1265  * @param tvb
1266  * @param tree 
1267  * @param offset
1268  * @return modified offset
1269  */
1270 static guint
1271 fConfirmedPrivateTransferError(tvbuff_t *tvb, proto_tree *tree, guint offset);
1272
1273 /**
1274  * WritePropertyMultiple-Error ::= SEQUENCE {
1275  *    errorType     [0] Error,
1276  *    firstFailedWriteAttempt  [1] Unsigned
1277  *    }
1278  * }
1279  * @param tvb
1280  * @param tree 
1281  * @param offset
1282  * @return modified offset
1283  */
1284 static guint
1285 fWritePropertyMultipleError(tvbuff_t *tvb, proto_tree *tree, guint offset);
1286
1287 /**
1288  * VTClose-Error ::= SEQUENCE {
1289  *    errorType     [0] Error,
1290  *    listOfVTSessionIdentifiers  [1] SEQUENCE OF Unsigned8 OPTIONAL
1291  *    }
1292  * }
1293  * @param tvb
1294  * @param tree 
1295  * @param offset
1296  * @return modified offset
1297  */
1298 static guint
1299 fVTCloseError(tvbuff_t *tvb, proto_tree *tree, guint offset);
1300
1301 /**
1302  * BACnet Application Types chapter 20.2.1
1303  * @param tvb 
1304  * @param tree 
1305  * @param offset 
1306  * @param label 
1307  * @return modified offset
1308  */
1309 static guint
1310 fApplicationTypes   (tvbuff_t *tvb, proto_tree *tree, guint offset, const gchar *label);
1311
1312 /**
1313  * BACnetActionCommand ::= SEQUENCE {
1314  *  deviceIdentifier    [0] BACnetObjectIdentifier OPTIONAL,
1315  *  objectIdentifier    [1] BACnetObjectIdentifier,
1316  *  propertyIdentifier  [2] BACnetPropertyIdentifier,
1317  *  propertyArrayIndex  [3] Unsigned OPTIONAL, -- used only with array datatype
1318  *  propertyValue       [4] ABSTRACT-SYNTAX.&Type,
1319  *  priority            [5] Unsigned (1..16) OPTIONAL, -- used only when property is commandable
1320  *  postDelay           [6] Unsigned OPTIONAL,
1321  *  quitOnFailure       [7] BOOLEAN,
1322  *  writeSuccessful     [8] BOOLEAN
1323  * }
1324  * @param tvb 
1325  * @param tree 
1326  * @param offset 
1327  * @return modified offset
1328  */
1329 static guint
1330 fActionCommand (tvbuff_t *tvb, proto_tree *tree, guint offset);
1331
1332 /**
1333  * BACnetActionList ::= SEQUENCE {
1334  *  action  [0] SEQUENCE of BACnetActionCommand
1335  * }
1336  * @param tvb 
1337  * @param tree 
1338  * @param offset 
1339  * @return modified offset
1340  */
1341 static guint
1342 fActionList (tvbuff_t *tvb, proto_tree *tree, guint offset);
1343
1344 /** BACnetAddress ::= SEQUENCE {
1345  *  network-number  Unsigned16, -- A value 0 indicates the local network
1346  *  mac-address     OCTET STRING -- A string of length 0 indicates a broadcast
1347  * }
1348  * @param tvb 
1349  * @param tree 
1350  * @param offset 
1351  * @return modified offset
1352  */
1353 static guint
1354 fAddress (tvbuff_t *tvb, proto_tree *tree, guint offset);
1355
1356 /**
1357  * BACnetAddressBinding ::= SEQUENCE {
1358  *      deviceObjectID  BACnetObjectIdentifier
1359  *      deviceAddress   BacnetAddress
1360  * }
1361  * @param tvb 
1362  * @param tree 
1363  * @param offset 
1364  * @return modified offset
1365  */
1366 static guint
1367 fAddressBinding (tvbuff_t *tvb, proto_tree *tree, guint offset);
1368
1369 /**
1370  * BACnetCalendaryEntry ::= CHOICE {
1371  *      date        [0] Date,
1372  *      dateRange   [1] BACnetDateRange,
1373  *  weekNDay    [2] BacnetWeekNday
1374  * }
1375  * @param tvb 
1376  * @param tree 
1377  * @param offset 
1378  * @return modified offset
1379  */
1380 static guint
1381 fCalendaryEntry (tvbuff_t *tvb, proto_tree *tree, guint offset);
1382
1383 #if 0
1384 /**
1385  * BACnetClientCOV ::= CHOICE {
1386  *      real-increment  REAL,
1387  *      default-increment   NULL
1388  * }
1389  * @param tvb 
1390  * @param tree 
1391  * @param offset 
1392  * @return modified offset
1393  */
1394 static guint
1395 fClientCOV (tvbuff_t *tvb, proto_tree *tree, guint offset);
1396 #endif
1397
1398 /**
1399  * BACnetDailySchedule ::= SEQUENCE {
1400  *  day-schedule    [0] SENQUENCE OF BACnetTimeValue
1401  * }
1402  * @param tvb 
1403  * @param tree 
1404  * @param offset 
1405  * @return modified offset
1406  */
1407 static guint
1408 fDailySchedule (tvbuff_t *tvb, proto_tree *tree, guint offset);
1409
1410 /**
1411  * BACnetWeeklySchedule ::= SEQUENCE {
1412  *  week-schedule    SENQUENCE SIZE (7) OF BACnetDailySchedule
1413  * }
1414  * @param tvb 
1415  * @param tree 
1416  * @param offset 
1417  * @return modified offset
1418  */
1419 static guint
1420 fWeeklySchedule (tvbuff_t *tvb, proto_tree *tree, guint offset);
1421
1422 /**
1423  * BACnetDateRange ::= SEQUENCE {
1424  *  StartDate   Date,
1425  *  EndDate     Date
1426  * }
1427  * @param tvb 
1428  * @param tree 
1429  * @param offset 
1430  * @return modified offset
1431  */
1432 static guint
1433 fDateRange (tvbuff_t *tvb, proto_tree *tree, guint offset);
1434
1435 /**
1436  * BACnetDateTime ::= SEQUENCE {
1437  *  date   Date,
1438  *  time   Time
1439  * }
1440  * @param tvb 
1441  * @param tree 
1442  * @param offset 
1443  * @param label 
1444  * @return modified offset
1445  */
1446 static guint
1447 fDateTime (tvbuff_t *tvb, proto_tree *tree, guint offset, const gchar *label);
1448
1449 #if 0
1450 /**
1451  * BACnetDestination ::= SEQUENCE {
1452  *  validDays   BACnetDaysOfWeek,
1453  *  fromTime    Time,
1454  *  toTime      Time,
1455  *  recipient   BACnetRecipient,
1456  *  processIdentifier   Unsigned32,
1457  *  issueConfirmedNotifications BOOLEAN,
1458  *  transitions BACnetEventTransitionBits
1459  * }
1460  * @param tvb 
1461  * @param tree 
1462  * @param offset 
1463  * @return modified offset
1464  */
1465 static guint
1466 fDestination (tvbuff_t *tvb, proto_tree *tree, guint offset);
1467 #endif
1468
1469 #if 0
1470 /**
1471  * BACnetDeviceObjectPropertyReference ::= SEQUENCE {
1472  *  objectIdentifier    [0] BACnetObjectIdentifier,
1473  *  propertyIdentifier  [1] BACnetPropertyIdentifier,
1474  *  propertyArrayIndex  [2] Unsigend OPTIONAL,
1475  *  deviceIdentifier    [3] BACnetObjectIdentifier OPTIONAL
1476  * }
1477  * @param tvb 
1478  * @param tree 
1479  * @param offset 
1480  * @return modified offset
1481  */
1482 static guint
1483 fDeviceObjectPropertyReference (tvbuff_t *tvb, proto_tree *tree, guint offset);
1484 #endif
1485
1486 #if 0
1487 /**
1488  * BACnetDeviceObjectReference ::= SEQUENCE {
1489  *  deviceIdentifier    [0] BACnetObjectIdentifier OPTIONAL,
1490  *  objectIdentifier    [1] BACnetObjectIdentifier
1491  * }
1492  * @param tvb 
1493  * @param tree 
1494  * @param offset 
1495  * @return modified offset
1496  */
1497 static guint
1498 fDeviceObjectReference (tvbuff_t *tvb, proto_tree *tree, guint offset);
1499 #endif
1500
1501 #if 0
1502 /**
1503  * BACnetEventParameter ::= CHOICE {
1504  *      change-of-bitstring [0] SEQUENCE {
1505  *      time-delay [0] Unsigned,
1506  *      bitmask [1] BIT STRING,
1507  *      list-of-bitstring-values [2] SEQUENCE OF BIT STRING
1508  *      },
1509  *  change-of-state [1] SEQUENCE {
1510  *      time-delay [0] Unsigned,
1511  *      list-of-values [1] SEQUENCE OF BACnetPropertyStates
1512  *      },
1513  *   change-of-value [2] SEQUENCE {
1514  *      time-delay [0] Unsigned,
1515  *      cov-criteria [1] CHOICE {
1516  *              bitmask [0] BIT STRING,
1517  *              referenced-property-increment [1] REAL
1518  *                      }
1519  *              },
1520  *      command-failure [3] SEQUENCE {
1521  *              time-delay [0] Unsigned,
1522  *              feedback-property-reference [1] BACnetDeviceObjectPropertyReference
1523  *              },
1524  *      floating-limit [4] SEQUENCE {
1525  *              time-delay [0] Unsigned,
1526  *              setpoint-reference [1] BACnetDeviceObjectPropertyReference,
1527  *              low-diff-limit [2] REAL,
1528  *              high-diff-limit [3] REAL,
1529  *              deadband [4] REAL
1530  *              },
1531  *      out-of-range [5] SEQUENCE {
1532  *              time-delay [0] Unsigned,
1533  *              low-limit [1] REAL,
1534  *              high-limit [2] REAL,
1535  *              deadband [3] REAL
1536  *              },
1537  *      buffer-ready [7] SEQUENCE {
1538  *              notification-threshold [0] Unsigned,
1539  *              previous-notification-count [1] Unsigned32
1540  *              }
1541  *      change-of-life-safety [8] SEQUENCE {
1542  *              time-delay [0] Unsigned,
1543  *              list-of-life-safety-alarm-values [1] SEQUENCE OF BACnetLifeSafetyState,
1544  *              list-of-alarm-values [2] SEQUENCE OF BACnetLifeSafetyState,
1545  *              mode-property-reference [3] BACnetDeviceObjectPropertyReference
1546  *              }
1547  *      }
1548  * @param tvb 
1549  * @param tree 
1550  * @param offset 
1551  * @return modified offset
1552  */
1553 static guint
1554 fEventParameter (tvbuff_t *tvb, proto_tree *tree, guint offset);
1555 #endif
1556
1557
1558 #if 0
1559 /**
1560  * BACnetLogRecord ::= SEQUENCE {
1561  *      timestamp [0] BACnetDateTime,
1562  *      logDatum [1] CHOICE {
1563  *              log-status [0] BACnetLogStatus,
1564  *              boolean-value [1] BOOLEAN,
1565  *              real-value [2] REAL,
1566  *              enum-value [3] ENUMERATED, -- Optionally limited to 32 bits
1567  *              unsigned-value [4] Unsigned, -- Optionally limited to 32 bits
1568  *              signed-value [5] INTEGER, -- Optionally limited to 32 bits
1569  *              bitstring-value [6] BIT STRING,-- Optionally limited to 32 bits
1570  *              null-value [7] NULL,
1571  *              failure [8] Error,
1572  *              time-change [9] REAL,
1573  *              any-value [10] ABSTRACT-SYNTAX.&Type -- Optional
1574  *              }
1575  *      statusFlags [2] BACnetStatusFlags OPTIONAL
1576  * }
1577  * @param tvb 
1578  * @param tree 
1579  * @param offset 
1580  * @return modified offset
1581  */
1582 static guint
1583 fLogRecord (tvbuff_t *tvb, proto_tree *tree, guint offset);
1584 #endif
1585
1586 /**
1587  * BACnetNotificationParameters ::= CHOICE {
1588  *      change-of-bitstring     [0]     SEQUENCE {
1589  *      referenced-bitstring    [0] BIT STRING,
1590  *      status-flags    [1] BACnetStatusFlags
1591  *      },
1592  *  change-of-state [1] SEQUENCE {
1593  *      new-state   [0] BACnetPropertyStatus,
1594  *      status-flags    [1] BACnetStatusFlags
1595  *      },
1596  *  change-of-value [2] SEQUENCE {
1597  *      new-value   [0] CHOICE {
1598  *          changed-bits   [0] BIT STRING,
1599  *          changed-value    [1] REAL
1600  *          },
1601  *      status-flags    [1] BACnetStatusFlags
1602  *      },
1603  *  command-failure [3] SEQUENCE {
1604  *      command-value   [0] ABSTRACT-SYNTAX.&Type, -- depends on ref property
1605  *      status-flags    [1] BACnetStatusFlags
1606  *      feedback-value    [2] ABSTRACT-SYNTAX.&Type -- depends on ref property
1607  *      },
1608  *  floating-limit [4]  SEQUENCE {
1609  *      reference-value   [0] REAL,
1610  *      status-flags    [1] BACnetStatusFlags
1611  *      setpoint-value   [2] REAL,
1612  *      error-limit   [3] REAL
1613  *      },
1614  *  out-of-range [5]    SEQUENCE {
1615  *      exceeding-value   [0] REAL,
1616  *      status-flags    [1] BACnetStatusFlags
1617  *      deadband   [2] REAL,
1618  *      exceeded-limit   [0] REAL
1619  *      },
1620  *  complex-event-type  [6] SEQUENCE OF BACnetPropertyValue,
1621  *  buffer-ready [7]    SEQUENCE {
1622  *      buffer-device   [0] BACnetObjectIdentifier,
1623  *      buffer-object    [1] BACnetObjectIdentifier
1624  *      previous-notification   [2] BACnetDateTime,
1625  *      current-notification   [3] BACnetDateTime
1626  *      },
1627  *  change-of-life-safety [8]   SEQUENCE {
1628  *      new-state   [0] BACnetLifeSafetyState,
1629  *      new-mode    [1] BACnetLifeSafetyState
1630  *      status-flags   [2] BACnetStatusFlags,
1631  *      operation-expected   [3] BACnetLifeSafetyOperation
1632  *      }
1633  * }
1634  * @param tvb 
1635  * @param tree 
1636  * @param offset 
1637  * @return modified offset
1638  */
1639 static guint
1640 fNotificationParameters (tvbuff_t *tvb, proto_tree *tree, guint offset);
1641
1642 /**
1643  * BACnetObjectPropertyReference ::= SEQUENCE {
1644  *      objectIdentifier        [0] BACnetObjectIdentifier,
1645  *      propertyIdentifier      [1] BACnetPropertyIdentifier,
1646  *      propertyArrayIndex      [2] Unsigned OPTIONAL, -- used only with array datatype
1647  * }
1648  * @param tvb 
1649  * @param tree 
1650  * @param offset 
1651  * @return modified offset
1652  */
1653 static guint
1654 fBACnetObjectPropertyReference (tvbuff_t *tvb, proto_tree *tree, guint offset);
1655
1656 #if 0
1657 /**
1658  * BACnetObjectPropertyValue ::= SEQUENCE {
1659  *              objectIdentifier [0] BACnetObjectIdentifier,
1660  *              propertyIdentifier [1] BACnetPropertyIdentifier,
1661  *              propertyArrayIndex [2] Unsigned OPTIONAL, -- used only with array datatype
1662  *                              -- if omitted with an array the entire array is referenced
1663  *              value [3] ABSTRACT-SYNTAX.&Type, --any datatype appropriate for the specified property
1664  *              priority [4] Unsigned (1..16) OPTIONAL
1665  * }
1666  * @param tvb 
1667  * @param tree 
1668  * @param offset 
1669  * @return modified offset
1670  */
1671 static guint
1672 fObjectPropertyValue (tvbuff_t *tvb, proto_tree *tree, guint offset);
1673 #endif
1674
1675 /**
1676  * BACnetPriorityArray ::= SEQUENCE SIZE (16) OF BACnetPriorityValue
1677  * @param tvb 
1678  * @param tree 
1679  * @param offset 
1680  * @return modified offset
1681  */
1682 static guint
1683 fPriorityArray (tvbuff_t *tvb, proto_tree *tree, guint offset);
1684
1685 static guint
1686 fPropertyReference (tvbuff_t *tvb, proto_tree *tree, guint offset, guint8 tagoffset, guint8 list);
1687
1688 /**
1689  * BACnetPropertyReference ::= SEQUENCE {
1690  *      propertyIdentifier      [0] BACnetPropertyIdentifier,
1691  *      propertyArrayIndex      [1] Unsigned OPTIONAL, -- used only with array datatype
1692  * }
1693  * @param tvb 
1694  * @param tree 
1695  * @param offset 
1696  * @return modified offset
1697  */
1698 static guint
1699 fBACnetPropertyReference (tvbuff_t *tvb, proto_tree *tree, guint offset, guint8 list);
1700
1701 static guint
1702 fBACnetObjectPropertyReference (tvbuff_t *tvb, proto_tree *tree, guint offset);
1703
1704 /**
1705  * BACnetPropertyValue ::= SEQUENCE {
1706  *              PropertyIdentifier [0] BACnetPropertyIdentifier,
1707  *              propertyArrayIndex [1] Unsigned OPTIONAL, -- used only with array datatypes
1708  *                              -- if omitted with an array the entire array is referenced
1709  *              value [2] ABSTRACT-SYNTAX.&Type, -- any datatype appropriate for the specified property
1710  *              priority [3] Unsigned (1..16) OPTIONAL -- used only when property is commandable
1711  * }
1712  * @param tvb 
1713  * @param tree 
1714  * @param offset 
1715  * @return modified offset
1716  */
1717 static guint
1718 fBACnetPropertyValue (tvbuff_t *tvb, proto_tree *tree, guint offset);
1719
1720 static guint
1721 fPropertyValue (tvbuff_t *tvb, proto_tree *tree, guint offset, guint8 tagoffset);
1722
1723 /**
1724  * BACnet Application PDUs chapter 21
1725  * BACnetRecipient::= CHOICE {
1726  *      device  [0] BACnetObjectIdentifier
1727  *      address [1] BACnetAddress
1728  * }
1729  * @param tvb 
1730  * @param tree 
1731  * @param offset 
1732  * @return modified offset
1733  */
1734 static guint
1735 fRecipient (tvbuff_t *tvb, proto_tree *tree, guint offset);
1736
1737 /**
1738  * BACnet Application PDUs chapter 21
1739  * BACnetRecipientProcess::= SEQUENCE {
1740  *      recipient       [0] BACnetRecipient
1741  *      processID       [1] Unsigned32
1742  * }
1743  * @param tvb 
1744  * @param tree 
1745  * @param offset 
1746  * @return modified offset
1747  */
1748 static guint
1749 fRecipientProcess (tvbuff_t *tvb, proto_tree *tree, guint offset);
1750
1751 #if 0
1752 /**
1753  * BACnetSessionKey ::= SEQUENCE {
1754  *      sessionKey      OCTET STRING (SIZE(8)), -- 56 bits for key, 8 bits for checksum
1755  *      peerAddress     BACnetAddress
1756  * }
1757  * @param tvb 
1758  * @param tree 
1759  * @param offset 
1760  * @return modified offset
1761  * @todo check if checksum is displayed correctly 
1762  */
1763 static guint
1764 fSessionKey (tvbuff_t *tvb, proto_tree *tree, guint offset);
1765 #endif
1766
1767 #if 0
1768 /**
1769  * BACnetSetpointReference ::= SEQUENCE {
1770  *      sessionKey      [0] BACnetObjectPropertyReference OPTIONAL
1771  * }
1772  * @param tvb 
1773  * @param tree 
1774  * @param offset 
1775  * @return modified offset
1776  */
1777 static guint
1778 fSetpointReference (tvbuff_t *tvb, proto_tree *tree, guint offset);
1779 #endif
1780
1781 /**
1782  * BACnetSpecialEvent ::= SEQUENCE {
1783  *      period          CHOICE {
1784  *              calendarEntry           [0] BACnetCalendarEntry,
1785  *              calendarRefernce        [1] BACnetObjectIdentifier
1786  *              },
1787  *              listOfTimeValues        [2] SEQUENCE OF BACnetTimeValue,
1788  *              eventPriority           [3] Unsigned (1..16)
1789  * }
1790  * @param tvb 
1791  * @param tree 
1792  * @param offset 
1793  * @return modified offset
1794  */
1795 static guint
1796 fSpecialEvent (tvbuff_t *tvb, proto_tree *tree, guint offset);
1797
1798 /**
1799  * BACnetTimeStamp ::= CHOICE {
1800  *      time                    [0] Time,
1801  *      sequenceNumber  [1] Unsigned (0..65535),
1802  *      dateTime                [2] BACnetDateTime
1803  * }
1804  * @param tvb 
1805  * @param tree 
1806  * @param offset 
1807  * @return modified offset
1808  */
1809 static guint
1810 fTimeStamp (tvbuff_t *tvb, proto_tree *tree, guint offset);
1811
1812 /**
1813  * BACnetTimeValue ::= SEQUENCE {
1814  *      time    Time,
1815  *      value   ABSTRACT-SYNTAX.&Type -- any primitive datatype, complex types cannot be decoded
1816  * }
1817  * @param tvb 
1818  * @param tree 
1819  * @param offset 
1820  * @return modified offset
1821  */
1822 static guint
1823 fTimeValue (tvbuff_t *tvb, proto_tree *tree, guint offset);
1824
1825 #if 0
1826 /**
1827  * BACnetVTSession ::= SEQUENCE {
1828  *      local-vtSessionID       Unsigned8,
1829  *      remote-vtSessionID      Unsigned8,
1830  *      remote-vtAddress        BACnetAddress
1831  * }
1832  * @param tvb 
1833  * @param tree 
1834  * @param offset 
1835  * @return modified offset
1836  */
1837 static guint
1838 fVTSession (tvbuff_t *tvb, proto_tree *tree, guint offset);
1839 #endif
1840
1841 /**
1842  * BACnetWeekNDay ::= OCTET STRING (SIZE (3))
1843  * -- first octet month (1..12) January = 1, X'FF' = any month
1844  * -- second octet weekOfMonth where: 1 = days numbered 1-7
1845  * -- 2 = days numbered 8-14
1846  * -- 3 = days numbered 15-21
1847  * -- 4 = days numbered 22-28
1848  * -- 5 = days numbered 29-31
1849  * -- 6 = last 7 days of this month
1850  * -- X\92FF\92 = any week of this month
1851  * -- third octet dayOfWeek (1..7) where 1 = Monday
1852  * -- 7 = Sunday
1853  * -- X'FF' = any day of week
1854  * @param tvb 
1855  * @param tree 
1856  * @param offset 
1857  * @return modified offset
1858  */
1859 static guint
1860 fWeekNDay (tvbuff_t *tvb, proto_tree *tree, guint offset);
1861
1862 /**
1863  * ReadAccessResult ::= SEQUENCE {
1864  *      objectIdentifier        [0] BACnetObjectIdentifier,
1865  *      listOfResults   [1] SEQUENCE OF SEQUENCE {
1866  *              propertyIdentifier      [2] BACnetPropertyIdentifier,
1867  *              propertyArrayIndex      [3] Unsigned OPTIONAL, -- used only with array datatype if omitted with an array the entire array is referenced
1868  *              readResult      CHOICE {
1869  *                      propertyValue   [4] ABSTRACT-SYNTAX.&Type,
1870  *                      propertyAccessError     [5] Error
1871  *              }
1872  *  } OPTIONAL
1873  * }
1874  * @param tvb 
1875  * @param tree 
1876  * @param offset 
1877  * @return modified offset
1878  */
1879 static guint
1880 fReadAccessResult (tvbuff_t *tvb, proto_tree *tree, guint offset);
1881
1882 /**
1883  * ReadAccessSpecification ::= SEQUENCE {
1884  *      objectIdentifier        [0] BACnetObjectIdentifier,
1885  *      listOfPropertyReferences        [1] SEQUENCE OF BACnetPropertyReference
1886  * }
1887  * @param tvb 
1888  * @param tree 
1889  * @param offset 
1890  * @return modified offset
1891  */
1892 static guint
1893 fReadAccessSpecification (tvbuff_t *tvb, proto_tree *subtree, guint offset);
1894
1895 /**
1896  * WriteAccessSpecification ::= SEQUENCE {
1897  *      objectIdentifier        [0] BACnetObjectIdentifier,
1898  *      listOfProperty  [1] SEQUENCE OF BACnetPropertyValue
1899  * }
1900  * @param tvb 
1901  * @param tree 
1902  * @param offset 
1903  * @return modified offset
1904  */
1905 static guint
1906 fWriteAccessSpecification (tvbuff_t *tvb, proto_tree *subtree, guint offset);
1907
1908
1909 /********************************************************* Helper functions *******************************************/
1910
1911 /**
1912  * extracts the tag number from the tag header.
1913  * @param tvb "TestyVirtualBuffer"
1914  * @param offset in actual tvb
1915  * @return Tag Number corresponding to BACnet 20.2.1.2 Tag Number
1916  */
1917 static guint
1918 fTagNo (tvbuff_t *tvb, guint offset);
1919                                      
1920 /**
1921  * splits Tag Header coresponding to 20.2.1 General Rules For BACnet Tags
1922  * @param tvb = "TestyVirtualBuffer"
1923  * @param offset = offset in actual tvb
1924  * @return tag_no BACnet 20.2.1.2 Tag Number
1925  * @return class_tag BACnet 20.2.1.1 Class
1926  * @return lvt BACnet 20.2.1.3 Length/Value/Type
1927  * @return offs = length of this header
1928  */
1929
1930 static guint
1931 fTagHeader (tvbuff_t *tvb, guint offset, guint8 *tag_no, guint8* class_tag, guint32 *lvt);
1932
1933
1934 /**
1935  * adds processID with max 32Bit unsigned Integer Value to tree
1936  * @param tvb 
1937  * @param tree 
1938  * @param offset 
1939  * @return modified offset
1940  */
1941 static guint
1942 fProcessId (tvbuff_t *tvb, proto_tree *tree, guint offset);
1943
1944 /**
1945  * adds timeSpan with max 32Bit unsigned Integer Value to tree
1946  * @param tvb 
1947  * @param tree 
1948  * @param offset 
1949  * @return modified offset
1950  */
1951 static guint
1952 fTimeSpan (tvbuff_t *tvb, proto_tree *tree, guint offset, const gchar *label);
1953
1954 /**
1955  * BACnet Application PDUs chapter 21
1956  * BACnetPropertyIdentifier::= ENUMERATED {
1957  *       @see bacapp_property_identifier
1958  * }
1959  * @param tvb 
1960  * @param tree 
1961  * @param offset 
1962  * @param tt returnvalue of this item 
1963  * @return modified offset
1964  */
1965 static guint
1966 fPropertyIdentifier (tvbuff_t *tvb, proto_tree *tree, guint offset);
1967
1968 /**
1969  * listOfEventSummaries ::= SEQUENCE OF SEQUENCE {
1970  *      objectIdentifier        [0] BACnetObjectIdentifier,
1971  *  eventState  [1] BACnetEventState,
1972  *  acknowledgedTransitions [2] BACnetEventTransitionBits,
1973  *  eventTimeStamps [3] SEQURNCE SIZE (3) OF BACnetTimeStamps,
1974  *  notifyType  [4] BACnetNotifyType,
1975  *  eventEnable [5] BACnetEventTransitionBits,
1976  *  eventPriorities [6] SEQUENCE SIZE (3) OF Unsigned
1977  * }
1978  * @param tvb 
1979  * @param tree
1980  * @param offset 
1981  * @return modified offset
1982  */
1983 static guint
1984 flistOfEventSummaries (tvbuff_t *tvb, proto_tree *tree, guint offset);
1985
1986 /**
1987  * SelectionCriteria ::= SEQUENCE {
1988  *      propertyIdentifier      [0] BACnetPropertyIdentifier,
1989  *      propertyArrayIndex      [1] Unsigned OPTIONAL, -- used only with array datatype
1990  *  relationSpecifier   [2] ENUMERATED { bacapp_relationSpecifier },
1991  *  comparisonValue     [3] ABSTRACT-SYNTAX.&Type
1992  * }
1993  * @param tvb 
1994  * @param tree 
1995  * @param offset 
1996  * @return modified offset
1997  */
1998 static guint
1999 fSelectionCriteria (tvbuff_t *tvb, proto_tree *tree, guint offset);
2000
2001 /**
2002  * objectSelectionCriteria ::= SEQUENCE {
2003  *      selectionLogic  [0] ENUMERATED { bacapp_selectionLogic },
2004  *      listOfSelectionCriteria [1] SelectionCriteria
2005  * }
2006  * @param tvb 
2007  * @param tree 
2008  * @param offset 
2009  * @return modified offset
2010  */
2011 static guint
2012 fObjectSelectionCriteria (tvbuff_t *tvb, proto_tree *subtree, guint offset);
2013
2014 /**
2015  * ObjectSpecifier ::= CHOICE {
2016  *      objectType      [0] BACnetObjectType,
2017  *  objectIdentifier    [1] BACnetObjectIdentifier
2018  * }
2019  * @param tvb 
2020  * @param tree 
2021  * @param offset 
2022  * @return modified offset
2023  */
2024 static guint
2025 fObjectSpecifier (tvbuff_t *tvb, proto_tree *tree, guint offset);
2026
2027 /**
2028  * BACnet-Error ::= SEQUENCE {
2029  *    error-class ENUMERATED {},
2030  *    error-code  ENUMERATED {}
2031  *    }
2032  * }
2033  * @param tvb
2034  * @param tree 
2035  * @param offset
2036  * @return modified offset
2037  */
2038 static guint
2039 fError(tvbuff_t *tvb, proto_tree *tree, guint offset);
2040
2041 /**
2042  * Generic handler for context tagged values.  Mostly for handling
2043  * vendor-defined properties and services.
2044  * @param tvb
2045  * @param tree
2046  * @param offset
2047  * @return modified offset
2048  * @todo beautify this ugly construct
2049  */
2050 static guint
2051 fContextTaggedValue(tvbuff_t *tvb, proto_tree *tree, guint offset, const gchar *label);
2052
2053 /**
2054  * realizes some ABSTRACT-SYNTAX.&Type
2055  * @param tvb
2056  * @param tree
2057  * @param offset
2058  * @return modified offset
2059  * @todo beautify this ugly construct
2060  */
2061 static guint
2062 fAbstractSyntaxNType (tvbuff_t *tvb, proto_tree *tree, guint offset);
2063
2064 /**
2065  * register_bacapp
2066  */
2067 void
2068 proto_register_bacapp(void);
2069
2070 /**
2071  * proto_reg_handoff_bacapp
2072  */
2073 void
2074 proto_reg_handoff_bacapp(void);
2075
2076 /**
2077  * converts XXX coded strings to UTF-8 if iconv is allowed
2078  * else 'in' is copied to 'out'
2079  * @param in  -- pointer to string
2080  * @param inbytesleft
2081  * @param out -- pointer to string
2082  * @param outbytesleft
2083  * @param fromcoding
2084  * @return count of modified characters of returned string, -1 for errors
2085  */
2086 guint32
2087 fConvertXXXtoUTF8(const guint8 *in, size_t *inbytesleft,guint8 *out, size_t *outbytesleft, const gchar *fromcoding);
2088
2089 #endif /* __BACAPP_H__ */
2090
2091