suricata
app-layer-dnp3-objects.c
Go to the documentation of this file.
1 /* Copyright (C) 2015 Open Information Security Foundation
2  *
3  * You can copy, redistribute or modify this Program under the terms of
4  * the GNU General Public License version 2 as published by the Free
5  * Software Foundation.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * version 2 along with this program; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15  * 02110-1301, USA.
16  */
17 
18 /**
19  * \file
20  *
21  * \author Jason Ish <jason.ish@oisf.net>
22  *
23  * This file contains the DNP3 object decoders.
24  */
25 
26 #include "suricata-common.h"
27 
28 #include "app-layer-dnp3.h"
29 #include "app-layer-dnp3-objects.h"
30 
31 void DNP3FreeObjectPoint(int group, int variation, void *point);
32 
33 #if 0
34 static void DNP3HexDump(uint8_t *data, int len)
35 {
36  for (int i = 0; i < len; i++) {
37  printf("%02x ", data[i]);
38  }
39 }
40 #endif
41 
42 /**
43  * \brief Allocate a list for DNP3 points.
44  */
45 DNP3PointList *DNP3PointListAlloc(void)
46 {
47  DNP3PointList *items = SCCalloc(1, sizeof(*items));
48  if (unlikely(items == NULL)) {
49  return NULL;
50  }
51  TAILQ_INIT(items);
52  return items;
53 }
54 
55 /**
56  * \brief Free a DNP3PointList.
57  */
58 void DNP3FreeObjectPointList(int group, int variation, DNP3PointList *list)
59 {
60  DNP3Point *point;
61  while ((point = TAILQ_FIRST(list)) != NULL) {
62  TAILQ_REMOVE(list, point, next);
63  if (point->data != NULL) {
65  }
66  SCFree(point);
67  }
68  SCFree(list);
69 }
70 
71 /**
72  * \brief Read an uint8_t from a buffer.
73  *
74  * Reads a uint8_t from a buffer advancing the pointer and
75  * decrementing the length.
76  *
77  * \param buf A pointer to the buffer to read from.
78  * \param len A pointer to the buffer length.
79  * \param out A pointer to where the value will be stored.
80  *
81  * \retval Returns 1 if there was enough space in the buffer to read from,
82  * otherwise 0 is returned.
83  */
84 static int DNP3ReadUint8(const uint8_t **buf, uint16_t *len, uint8_t *out)
85 {
86  if (*len < (int)sizeof(*out)) {
87  return 0;
88  }
89  *out = *(uint8_t *)(*buf);
90  *buf += sizeof(*out);
91  *len -= sizeof(*out);
92  return 1;
93 }
94 
95 /**
96  * \brief Read an uint16_t from a buffer.
97  *
98  * Reads an uint16_t from a buffer advancing the pointer and
99  * decrementing the length.
100  *
101  * \param buf A pointer to the buffer to read from.
102  * \param len A pointer to the buffer length.
103  * \param out A pointer to where the value will be stored.
104  *
105  * \retval Returns 1 if there was enough space in the buffer to read from,
106  * otherwise 0 is returned.
107  */
108 static int DNP3ReadUint16(const uint8_t **buf, uint16_t *len, uint16_t *out)
109 {
110  if (*len < (int)sizeof(*out)) {
111  return 0;
112  }
113  *out = DNP3_SWAP16(*(uint16_t *)(*buf));
114  *buf += sizeof(*out);
115  *len -= sizeof(*out);
116  return 1;
117 }
118 
119 /**
120  * \brief Read an unsigned 24 bit integer from a buffer.
121  *
122  * Reads an an unsigned 24 bit integer from a buffer advancing the
123  * pointer and decrementing the length.
124  *
125  * \param buf A pointer to the buffer to read from.
126  * \param len A pointer to the buffer length.
127  * \param out A pointer to where the value will be stored.
128  *
129  * \retval Returns 1 if there was enough space in the buffer to read from,
130  * otherwise 0 is returned.
131  */
132 static int DNP3ReadUint24(const uint8_t **buf, uint16_t *len, uint32_t *out)
133 {
134  if (*len < (int)(sizeof(uint8_t) * 3)) {
135  return 0;
136  }
137 
138 #if __BYTE_ORDER__ == __BIG_ENDIAN
139  *out = ((uint32_t)(*buf)[0] << 16) | ((uint32_t)(*buf)[1] << 8) |
140  (uint32_t)(*buf)[2];
141 #elif __BYTE_ORDER == __LITTLE_ENDIAN
142  *out = ((uint32_t)(*buf)[0]) | ((uint32_t)(*buf)[1] << 8) | ((uint32_t)(*buf)[2] << 16);
143 #endif
144 
145  *buf += 3;
146  *len -= 3;
147 
148  return 1;
149 }
150 
151 /**
152  * \brief Read an uint32_t from a buffer.
153  *
154  * Reads an uint32_t from a buffer advancing the pointer and
155  * decrementing the length.
156  *
157  * \param buf A pointer to the buffer to read from.
158  * \param len A pointer to the buffer length.
159  * \param out A pointer to where the value will be stored.
160  *
161  * \retval Returns 1 if there was enough space in the buffer to read from,
162  * otherwise 0 is returned.
163  */
164 static int DNP3ReadUint32(const uint8_t **buf, uint16_t *len, uint32_t *out)
165 {
166  if (*len < (int)sizeof(*out)) {
167  return 0;
168  }
169  *out = DNP3_SWAP32(*(uint32_t *)(*buf));
170  *buf += sizeof(*out);
171  *len -= sizeof(*out);
172  return 1;
173 }
174 
175 /**
176  * \brief Read an unsigned 48 bit integer from a buffer.
177  *
178  * Reads an an unsigned 48 bit integer from a buffer advancing the
179  * pointer and decrementing the length.
180  *
181  * \param buf A pointer to the buffer to read from.
182  * \param len A pointer to the buffer length.
183  * \param out A pointer to where the value will be stored.
184  *
185  * \retval Returns 1 if there was enough space in the buffer to read from,
186  * otherwise 0 is returned.
187  */
188 static int DNP3ReadUint48(const uint8_t **buf, uint16_t *len, uint64_t *out)
189 {
190  if (*len < (int)(sizeof(uint8_t) * 6)) {
191  return 0;
192  }
193 
194 #if __BYTE_ORDER__ == __BIG_ENDIAN
195  *out = ((uint64_t)(*buf)[0] << 40) | ((uint64_t)(*buf)[1] << 32) |
196  ((uint64_t)(*buf)[2] << 24) | ((uint64_t)(*buf)[3] << 16) |
197  ((uint64_t)(*buf)[4] << 8) | (uint64_t)(*buf)[5];
198 #elif __BYTE_ORDER == __LITTLE_ENDIAN
199  *out = ((uint64_t)(*buf)[0]) | ((uint64_t)(*buf)[1] << 8) |
200  ((uint64_t)(*buf)[2] << 16) | ((uint64_t)(*buf)[3] << 24) |
201  ((uint64_t)(*buf)[4] << 32) | ((uint64_t)(*buf)[5] << 40);
202 #endif
203 
204  *buf += 6;
205  *len -= 6;
206 
207  return 1;
208 }
209 
210 /**
211  * \brief Read a 32 bit float from a buffer.
212  *
213  * Reads an 32 bit float from a buffer advancing the pointer and
214  * decrementing the length.
215  *
216  * \param buf A pointer to the buffer to read from.
217  * \param len A pointer to the buffer length.
218  * \param out A pointer to where the value will be stored.
219  *
220  * \retval Returns 1 if there was enough space in the buffer to read from,
221  * otherwise 0 is returned.
222  */
223 static int DNP3ReadFloat32(const uint8_t **buf, uint16_t *len, float *out)
224 {
225  if (*len < 4) {
226  return 0;
227  }
228 
229 #if __BYTE_ORDER == __LITTLE_ENDIAN
230  *((uint8_t *)out + 0) = (*buf)[0];
231  *((uint8_t *)out + 1) = (*buf)[1];
232  *((uint8_t *)out + 2) = (*buf)[2];
233  *((uint8_t *)out + 3) = (*buf)[3];
234 #else
235  *((uint8_t *)out + 3) = (*buf)[0];
236  *((uint8_t *)out + 2) = (*buf)[1];
237  *((uint8_t *)out + 1) = (*buf)[2];
238  *((uint8_t *)out + 0) = (*buf)[3];
239 #endif
240  *len -= 4;
241  *buf += 4;
242 
243  return 1;
244 }
245 
246 /**
247  * \brief Read a 64 bit float from a buffer.
248  *
249  * Reads an 64 bit float from a buffer advancing the pointer and
250  * decrementing the length.
251  *
252  * \param buf A pointer to the buffer to read from.
253  * \param len A pointer to the buffer length.
254  * \param out A pointer to where the value will be stored.
255  *
256  * \retval Returns 1 if there was enough space in the buffer to read from,
257  * otherwise 0 is returned.
258  */
259 static int DNP3ReadFloat64(const uint8_t **buf, uint16_t *len, double *out)
260 {
261  if (*len < 8) {
262  return 0;
263  }
264 
265 #if __BYTE_ORDER == __LITTLE_ENDIAN
266  *((uint8_t *)out + 0) = (*buf)[0];
267  *((uint8_t *)out + 1) = (*buf)[1];
268  *((uint8_t *)out + 2) = (*buf)[2];
269  *((uint8_t *)out + 3) = (*buf)[3];
270  *((uint8_t *)out + 4) = (*buf)[4];
271  *((uint8_t *)out + 5) = (*buf)[5];
272  *((uint8_t *)out + 6) = (*buf)[6];
273  *((uint8_t *)out + 7) = (*buf)[7];
274 #else
275  *((uint8_t *)out + 7) = (*buf)[0];
276  *((uint8_t *)out + 6) = (*buf)[1];
277  *((uint8_t *)out + 5) = (*buf)[2];
278  *((uint8_t *)out + 4) = (*buf)[3];
279  *((uint8_t *)out + 3) = (*buf)[4];
280  *((uint8_t *)out + 2) = (*buf)[5];
281  *((uint8_t *)out + 1) = (*buf)[6];
282  *((uint8_t *)out + 0) = (*buf)[7];
283 #endif
284  *len -= 8;
285  *buf += 8;
286 
287  return 1;
288 }
289 
290 /**
291  * \brief Get the prefix value and advance the buffer.
292  */
293 static int DNP3ReadPrefix(const uint8_t **buf, uint16_t *len, uint8_t prefix_code, uint32_t *out)
294 {
295  uint8_t prefix_len = 0;
296 
297  switch (prefix_code) {
298  case 0x01:
299  case 0x04:
300  prefix_len = 1;
301  break;
302  case 0x02:
303  case 0x05:
304  prefix_len = 2;
305  break;
306  case 0x03:
307  case 0x06:
308  prefix_len = 4;
309  default:
310  break;
311  }
312 
313  if (*len < (uint32_t)prefix_len) {
314  return 0;
315  }
316 
317  switch (prefix_len) {
318  case sizeof(uint32_t):
319  if (!DNP3ReadUint32(buf, len, out)) {
320  return 0;
321  }
322  break;
323  case sizeof(uint16_t): {
324  /* Temp value for strict-aliasing. */
325  uint16_t val = 0;
326  if (!DNP3ReadUint16(buf, len, &val)) {
327  return 0;
328  }
329  *out = val;
330  break;
331  }
332  case sizeof(uint8_t): {
333  /* Temp value for strict-aliasing. */
334  uint8_t val = 0;
335  if (!DNP3ReadUint8(buf, len, &val)) {
336  return 0;
337  }
338  *out = val;
339  break;
340  }
341  default:
342  *out = 0;
343  break;
344  }
345 
346  return 1;
347 }
348 
349 /**
350  * \brief Add an object to a DNP3PointList.
351  *
352  * \retval 1 if successful, 0 on failure.
353  */
354 static int DNP3AddPoint(DNP3PointList *list, void *object, uint32_t point_index,
355  uint8_t prefix_code, uint32_t prefix)
356 {
357  DNP3Point *point = SCCalloc(1, sizeof(*point));
358  if (unlikely(point == NULL)) {
359  return 0;
360  }
361  TAILQ_INSERT_TAIL(list, point, next);
362  point->data = object;
363  point->prefix = prefix;
364  point->index = point_index;
365  switch (prefix_code) {
366  case 0x00:
367  break;
368  case 0x01:
369  case 0x02:
370  case 0x03:
371  point->index = prefix;
372  break;
373  case 0x04:
374  case 0x05:
375  case 0x06:
376  point->size = prefix;
377  break;
378  default:
379  break;
380  }
381 
382  return 1;
383 }
384 
385 /* START GENERATED CODE */
386 
387 /* Code generated by:
388  * ./scripts/dnp3-gen/dnp3-gen.py
389  */
390 
391 static int DNP3DecodeObjectG1V1(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
392  uint32_t start, uint32_t count, DNP3PointList *points)
393 {
394  DNP3ObjectG1V1 *object = NULL;
395  uint32_t bytes = (count / 8) + 1;
396  uint32_t prefix = 0;
397  uint32_t point_index = start;
398 
399  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
400  goto error;
401  }
402 
403  for (uint32_t i = 0; i < bytes; i++) {
404 
405  uint8_t octet;
406 
407  if (!DNP3ReadUint8(buf, len, &octet)) {
408  goto error;
409  }
410 
411  for (int j = 0; j < 8 && count; j = j + 1) {
412 
413  object = SCCalloc(1, sizeof(*object));
414  if (unlikely(object == NULL)) {
415  goto error;
416  }
417 
418  object->state = (octet >> j) & 0x1;
419 
420  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
421  goto error;
422  }
423 
424  object = NULL;
425  count--;
426  point_index++;
427  }
428 
429  }
430 
431  return 1;
432 error:
433  if (object != NULL) {
434  SCFree(object);
435  }
436  return 0;
437 }
438 
439 static int DNP3DecodeObjectG1V2(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
440  uint32_t start, uint32_t count, DNP3PointList *points)
441 {
442  DNP3ObjectG1V2 *object = NULL;
443  uint32_t prefix = 0;
444  uint32_t point_index = start;
445 
446  if (*len < count/8) {
447  goto error;
448  }
449  while (count--) {
450 
451  object = SCCalloc(1, sizeof(*object));
452  if (unlikely(object == NULL)) {
453  goto error;
454  }
455 
456  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
457  goto error;
458  }
459 
460  {
461  uint8_t octet;
462  if (!DNP3ReadUint8(buf, len, &octet)) {
463  goto error;
464  }
465  object->online = (octet >> 0) & 0x1;
466  object->restart = (octet >> 1) & 0x1;
467  object->comm_lost = (octet >> 2) & 0x1;
468  object->remote_forced = (octet >> 3) & 0x1;
469  object->local_forced = (octet >> 4) & 0x1;
470  object->chatter_filter = (octet >> 5) & 0x1;
471  object->reserved = (octet >> 6) & 0x1;
472  object->state = (octet >> 7) & 0x1;
473  }
474 
475  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
476  goto error;
477  }
478 
479  object = NULL;
480  point_index++;
481  }
482 
483  return 1;
484 error:
485  if (object != NULL) {
486  SCFree(object);
487  }
488 
489  return 0;
490 }
491 
492 static int DNP3DecodeObjectG2V1(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
493  uint32_t start, uint32_t count, DNP3PointList *points)
494 {
495  DNP3ObjectG2V1 *object = NULL;
496  uint32_t prefix = 0;
497  uint32_t point_index = start;
498 
499  if (*len < count/8) {
500  goto error;
501  }
502  while (count--) {
503 
504  object = SCCalloc(1, sizeof(*object));
505  if (unlikely(object == NULL)) {
506  goto error;
507  }
508 
509  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
510  goto error;
511  }
512 
513  if (!DNP3ReadUint8(buf, len, &object->state)) {
514  goto error;
515  }
516 
517  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
518  goto error;
519  }
520 
521  object = NULL;
522  point_index++;
523  }
524 
525  return 1;
526 error:
527  if (object != NULL) {
528  SCFree(object);
529  }
530 
531  return 0;
532 }
533 
534 static int DNP3DecodeObjectG2V2(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
535  uint32_t start, uint32_t count, DNP3PointList *points)
536 {
537  DNP3ObjectG2V2 *object = NULL;
538  uint32_t prefix = 0;
539  uint32_t point_index = start;
540 
541  if (*len < count/8) {
542  goto error;
543  }
544  while (count--) {
545 
546  object = SCCalloc(1, sizeof(*object));
547  if (unlikely(object == NULL)) {
548  goto error;
549  }
550 
551  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
552  goto error;
553  }
554 
555  {
556  uint8_t octet;
557  if (!DNP3ReadUint8(buf, len, &octet)) {
558  goto error;
559  }
560  object->online = (octet >> 0) & 0x1;
561  object->restart = (octet >> 1) & 0x1;
562  object->comm_lost = (octet >> 2) & 0x1;
563  object->remote_forced = (octet >> 3) & 0x1;
564  object->local_forced = (octet >> 4) & 0x1;
565  object->chatter_filter = (octet >> 5) & 0x1;
566  object->reserved = (octet >> 6) & 0x1;
567  object->state = (octet >> 7) & 0x1;
568  }
569  if (!DNP3ReadUint48(buf, len, &object->timestamp)) {
570  goto error;
571  }
572 
573  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
574  goto error;
575  }
576 
577  object = NULL;
578  point_index++;
579  }
580 
581  return 1;
582 error:
583  if (object != NULL) {
584  SCFree(object);
585  }
586 
587  return 0;
588 }
589 
590 static int DNP3DecodeObjectG2V3(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
591  uint32_t start, uint32_t count, DNP3PointList *points)
592 {
593  DNP3ObjectG2V3 *object = NULL;
594  uint32_t prefix = 0;
595  uint32_t point_index = start;
596 
597  if (*len < count/8) {
598  goto error;
599  }
600  while (count--) {
601 
602  object = SCCalloc(1, sizeof(*object));
603  if (unlikely(object == NULL)) {
604  goto error;
605  }
606 
607  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
608  goto error;
609  }
610 
611  {
612  uint8_t octet;
613  if (!DNP3ReadUint8(buf, len, &octet)) {
614  goto error;
615  }
616  object->online = (octet >> 0) & 0x1;
617  object->restart = (octet >> 1) & 0x1;
618  object->comm_lost = (octet >> 2) & 0x1;
619  object->remote_forced = (octet >> 3) & 0x1;
620  object->local_forced = (octet >> 4) & 0x1;
621  object->chatter_filter = (octet >> 5) & 0x1;
622  object->reserved = (octet >> 6) & 0x1;
623  object->state = (octet >> 7) & 0x1;
624  }
625  if (!DNP3ReadUint16(buf, len, &object->timestamp)) {
626  goto error;
627  }
628 
629  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
630  goto error;
631  }
632 
633  object = NULL;
634  point_index++;
635  }
636 
637  return 1;
638 error:
639  if (object != NULL) {
640  SCFree(object);
641  }
642 
643  return 0;
644 }
645 
646 static int DNP3DecodeObjectG3V1(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
647  uint32_t start, uint32_t count, DNP3PointList *points)
648 {
649  DNP3ObjectG3V1 *object = NULL;
650  uint32_t bytes = (count / 8) + 1;
651  uint32_t prefix = 0;
652  uint32_t point_index = start;
653 
654  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
655  goto error;
656  }
657 
658  for (uint32_t i = 0; i < bytes; i++) {
659 
660  uint8_t octet;
661 
662  if (!DNP3ReadUint8(buf, len, &octet)) {
663  goto error;
664  }
665 
666  for (int j = 0; j < 8 && count; j = j + 2) {
667 
668  object = SCCalloc(1, sizeof(*object));
669  if (unlikely(object == NULL)) {
670  goto error;
671  }
672 
673  object->state = (octet >> j) & 0x3;
674 
675  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
676  goto error;
677  }
678 
679  object = NULL;
680  count--;
681  point_index++;
682  }
683 
684  }
685 
686  return 1;
687 error:
688  if (object != NULL) {
689  SCFree(object);
690  }
691  return 0;
692 }
693 
694 static int DNP3DecodeObjectG3V2(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
695  uint32_t start, uint32_t count, DNP3PointList *points)
696 {
697  DNP3ObjectG3V2 *object = NULL;
698  uint32_t prefix = 0;
699  uint32_t point_index = start;
700 
701  if (*len < count/8) {
702  goto error;
703  }
704  while (count--) {
705 
706  object = SCCalloc(1, sizeof(*object));
707  if (unlikely(object == NULL)) {
708  goto error;
709  }
710 
711  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
712  goto error;
713  }
714 
715  {
716  uint8_t octet;
717  if (!DNP3ReadUint8(buf, len, &octet)) {
718  goto error;
719  }
720  object->online = (octet >> 0) & 0x1;
721  object->restart = (octet >> 1) & 0x1;
722  object->comm_lost = (octet >> 2) & 0x1;
723  object->remote_forced = (octet >> 3) & 0x1;
724  object->local_forced = (octet >> 4) & 0x1;
725  object->chatter_filter = (octet >> 5) & 0x1;
726  object->state = (octet >> 6) & 0x3;
727  }
728 
729  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
730  goto error;
731  }
732 
733  object = NULL;
734  point_index++;
735  }
736 
737  return 1;
738 error:
739  if (object != NULL) {
740  SCFree(object);
741  }
742 
743  return 0;
744 }
745 
746 static int DNP3DecodeObjectG4V1(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
747  uint32_t start, uint32_t count, DNP3PointList *points)
748 {
749  DNP3ObjectG4V1 *object = NULL;
750  uint32_t prefix = 0;
751  uint32_t point_index = start;
752 
753  if (*len < count/8) {
754  goto error;
755  }
756  while (count--) {
757 
758  object = SCCalloc(1, sizeof(*object));
759  if (unlikely(object == NULL)) {
760  goto error;
761  }
762 
763  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
764  goto error;
765  }
766 
767  {
768  uint8_t octet;
769  if (!DNP3ReadUint8(buf, len, &octet)) {
770  goto error;
771  }
772  object->online = (octet >> 0) & 0x1;
773  object->restart = (octet >> 1) & 0x1;
774  object->comm_lost = (octet >> 2) & 0x1;
775  object->remote_forced = (octet >> 3) & 0x1;
776  object->local_forced = (octet >> 4) & 0x1;
777  object->chatter_filter = (octet >> 5) & 0x1;
778  object->state = (octet >> 6) & 0x3;
779  }
780 
781  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
782  goto error;
783  }
784 
785  object = NULL;
786  point_index++;
787  }
788 
789  return 1;
790 error:
791  if (object != NULL) {
792  SCFree(object);
793  }
794 
795  return 0;
796 }
797 
798 static int DNP3DecodeObjectG4V2(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
799  uint32_t start, uint32_t count, DNP3PointList *points)
800 {
801  DNP3ObjectG4V2 *object = NULL;
802  uint32_t prefix = 0;
803  uint32_t point_index = start;
804 
805  if (*len < count/8) {
806  goto error;
807  }
808  while (count--) {
809 
810  object = SCCalloc(1, sizeof(*object));
811  if (unlikely(object == NULL)) {
812  goto error;
813  }
814 
815  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
816  goto error;
817  }
818 
819  {
820  uint8_t octet;
821  if (!DNP3ReadUint8(buf, len, &octet)) {
822  goto error;
823  }
824  object->online = (octet >> 0) & 0x1;
825  object->restart = (octet >> 1) & 0x1;
826  object->comm_lost = (octet >> 2) & 0x1;
827  object->remote_forced = (octet >> 3) & 0x1;
828  object->local_forced = (octet >> 4) & 0x1;
829  object->chatter_filter = (octet >> 5) & 0x1;
830  object->state = (octet >> 6) & 0x3;
831  }
832  if (!DNP3ReadUint48(buf, len, &object->timestamp)) {
833  goto error;
834  }
835 
836  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
837  goto error;
838  }
839 
840  object = NULL;
841  point_index++;
842  }
843 
844  return 1;
845 error:
846  if (object != NULL) {
847  SCFree(object);
848  }
849 
850  return 0;
851 }
852 
853 static int DNP3DecodeObjectG4V3(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
854  uint32_t start, uint32_t count, DNP3PointList *points)
855 {
856  DNP3ObjectG4V3 *object = NULL;
857  uint32_t prefix = 0;
858  uint32_t point_index = start;
859 
860  if (*len < count/8) {
861  goto error;
862  }
863  while (count--) {
864 
865  object = SCCalloc(1, sizeof(*object));
866  if (unlikely(object == NULL)) {
867  goto error;
868  }
869 
870  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
871  goto error;
872  }
873 
874  {
875  uint8_t octet;
876  if (!DNP3ReadUint8(buf, len, &octet)) {
877  goto error;
878  }
879  object->online = (octet >> 0) & 0x1;
880  object->restart = (octet >> 1) & 0x1;
881  object->comm_lost = (octet >> 2) & 0x1;
882  object->remote_forced = (octet >> 3) & 0x1;
883  object->local_forced = (octet >> 4) & 0x1;
884  object->chatter_filter = (octet >> 5) & 0x1;
885  object->state = (octet >> 6) & 0x3;
886  }
887  if (!DNP3ReadUint16(buf, len, &object->relative_time_ms)) {
888  goto error;
889  }
890 
891  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
892  goto error;
893  }
894 
895  object = NULL;
896  point_index++;
897  }
898 
899  return 1;
900 error:
901  if (object != NULL) {
902  SCFree(object);
903  }
904 
905  return 0;
906 }
907 
908 static int DNP3DecodeObjectG10V1(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
909  uint32_t start, uint32_t count, DNP3PointList *points)
910 {
911  DNP3ObjectG10V1 *object = NULL;
912  uint32_t bytes = (count / 8) + 1;
913  uint32_t prefix = 0;
914  uint32_t point_index = start;
915 
916  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
917  goto error;
918  }
919 
920  for (uint32_t i = 0; i < bytes; i++) {
921 
922  uint8_t octet;
923 
924  if (!DNP3ReadUint8(buf, len, &octet)) {
925  goto error;
926  }
927 
928  for (int j = 0; j < 8 && count; j = j + 1) {
929 
930  object = SCCalloc(1, sizeof(*object));
931  if (unlikely(object == NULL)) {
932  goto error;
933  }
934 
935  object->state = (octet >> j) & 0x1;
936 
937  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
938  goto error;
939  }
940 
941  object = NULL;
942  count--;
943  point_index++;
944  }
945 
946  }
947 
948  return 1;
949 error:
950  if (object != NULL) {
951  SCFree(object);
952  }
953  return 0;
954 }
955 
956 static int DNP3DecodeObjectG10V2(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
957  uint32_t start, uint32_t count, DNP3PointList *points)
958 {
959  DNP3ObjectG10V2 *object = NULL;
960  uint32_t prefix = 0;
961  uint32_t point_index = start;
962 
963  if (*len < count/8) {
964  goto error;
965  }
966  while (count--) {
967 
968  object = SCCalloc(1, sizeof(*object));
969  if (unlikely(object == NULL)) {
970  goto error;
971  }
972 
973  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
974  goto error;
975  }
976 
977  {
978  uint8_t octet;
979  if (!DNP3ReadUint8(buf, len, &octet)) {
980  goto error;
981  }
982  object->online = (octet >> 0) & 0x1;
983  object->restart = (octet >> 1) & 0x1;
984  object->comm_lost = (octet >> 2) & 0x1;
985  object->remote_forced = (octet >> 3) & 0x1;
986  object->local_forced = (octet >> 4) & 0x1;
987  object->reserved0 = (octet >> 5) & 0x1;
988  object->reserved1 = (octet >> 6) & 0x1;
989  object->state = (octet >> 7) & 0x1;
990  }
991 
992  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
993  goto error;
994  }
995 
996  object = NULL;
997  point_index++;
998  }
999 
1000  return 1;
1001 error:
1002  if (object != NULL) {
1003  SCFree(object);
1004  }
1005 
1006  return 0;
1007 }
1008 
1009 static int DNP3DecodeObjectG11V1(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
1010  uint32_t start, uint32_t count, DNP3PointList *points)
1011 {
1012  DNP3ObjectG11V1 *object = NULL;
1013  uint32_t prefix = 0;
1014  uint32_t point_index = start;
1015 
1016  if (*len < count/8) {
1017  goto error;
1018  }
1019  while (count--) {
1020 
1021  object = SCCalloc(1, sizeof(*object));
1022  if (unlikely(object == NULL)) {
1023  goto error;
1024  }
1025 
1026  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
1027  goto error;
1028  }
1029 
1030  {
1031  uint8_t octet;
1032  if (!DNP3ReadUint8(buf, len, &octet)) {
1033  goto error;
1034  }
1035  object->online = (octet >> 0) & 0x1;
1036  object->restart = (octet >> 1) & 0x1;
1037  object->comm_lost = (octet >> 2) & 0x1;
1038  object->remote_forced = (octet >> 3) & 0x1;
1039  object->local_forced = (octet >> 4) & 0x1;
1040  object->reserved0 = (octet >> 5) & 0x1;
1041  object->reserved1 = (octet >> 6) & 0x1;
1042  object->state = (octet >> 7) & 0x1;
1043  }
1044 
1045  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
1046  goto error;
1047  }
1048 
1049  object = NULL;
1050  point_index++;
1051  }
1052 
1053  return 1;
1054 error:
1055  if (object != NULL) {
1056  SCFree(object);
1057  }
1058 
1059  return 0;
1060 }
1061 
1062 static int DNP3DecodeObjectG11V2(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
1063  uint32_t start, uint32_t count, DNP3PointList *points)
1064 {
1065  DNP3ObjectG11V2 *object = NULL;
1066  uint32_t prefix = 0;
1067  uint32_t point_index = start;
1068 
1069  if (*len < count/8) {
1070  goto error;
1071  }
1072  while (count--) {
1073 
1074  object = SCCalloc(1, sizeof(*object));
1075  if (unlikely(object == NULL)) {
1076  goto error;
1077  }
1078 
1079  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
1080  goto error;
1081  }
1082 
1083  {
1084  uint8_t octet;
1085  if (!DNP3ReadUint8(buf, len, &octet)) {
1086  goto error;
1087  }
1088  object->online = (octet >> 0) & 0x1;
1089  object->restart = (octet >> 1) & 0x1;
1090  object->comm_lost = (octet >> 2) & 0x1;
1091  object->remote_forced = (octet >> 3) & 0x1;
1092  object->local_forced = (octet >> 4) & 0x1;
1093  object->reserved0 = (octet >> 5) & 0x1;
1094  object->reserved1 = (octet >> 6) & 0x1;
1095  object->state = (octet >> 7) & 0x1;
1096  }
1097  if (!DNP3ReadUint48(buf, len, &object->timestamp)) {
1098  goto error;
1099  }
1100 
1101  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
1102  goto error;
1103  }
1104 
1105  object = NULL;
1106  point_index++;
1107  }
1108 
1109  return 1;
1110 error:
1111  if (object != NULL) {
1112  SCFree(object);
1113  }
1114 
1115  return 0;
1116 }
1117 
1118 static int DNP3DecodeObjectG12V1(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
1119  uint32_t start, uint32_t count, DNP3PointList *points)
1120 {
1121  DNP3ObjectG12V1 *object = NULL;
1122  uint32_t prefix = 0;
1123  uint32_t point_index = start;
1124 
1125  if (*len < count/8) {
1126  goto error;
1127  }
1128  while (count--) {
1129 
1130  object = SCCalloc(1, sizeof(*object));
1131  if (unlikely(object == NULL)) {
1132  goto error;
1133  }
1134 
1135  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
1136  goto error;
1137  }
1138 
1139  {
1140  uint8_t octet;
1141  if (!DNP3ReadUint8(buf, len, &octet)) {
1142  goto error;
1143  }
1144  object->op_type = (octet >> 0) & 0xf;
1145  object->qu = (octet >> 4) & 0x1;
1146  object->cr = (octet >> 5) & 0x1;
1147  object->tcc = (octet >> 6) & 0x3;
1148  }
1149  if (!DNP3ReadUint8(buf, len, &object->count)) {
1150  goto error;
1151  }
1152  if (!DNP3ReadUint32(buf, len, &object->ontime)) {
1153  goto error;
1154  }
1155  if (!DNP3ReadUint32(buf, len, &object->offtime)) {
1156  goto error;
1157  }
1158  {
1159  uint8_t octet;
1160  if (!DNP3ReadUint8(buf, len, &octet)) {
1161  goto error;
1162  }
1163  object->status_code = (octet >> 0) & 0x7f;
1164  object->reserved = (octet >> 7) & 0x1;
1165  }
1166 
1167  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
1168  goto error;
1169  }
1170 
1171  object = NULL;
1172  point_index++;
1173  }
1174 
1175  return 1;
1176 error:
1177  if (object != NULL) {
1178  SCFree(object);
1179  }
1180 
1181  return 0;
1182 }
1183 
1184 static int DNP3DecodeObjectG12V2(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
1185  uint32_t start, uint32_t count, DNP3PointList *points)
1186 {
1187  DNP3ObjectG12V2 *object = NULL;
1188  uint32_t prefix = 0;
1189  uint32_t point_index = start;
1190 
1191  if (*len < count/8) {
1192  goto error;
1193  }
1194  while (count--) {
1195 
1196  object = SCCalloc(1, sizeof(*object));
1197  if (unlikely(object == NULL)) {
1198  goto error;
1199  }
1200 
1201  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
1202  goto error;
1203  }
1204 
1205  {
1206  uint8_t octet;
1207  if (!DNP3ReadUint8(buf, len, &octet)) {
1208  goto error;
1209  }
1210  object->op_type = (octet >> 0) & 0xf;
1211  object->qu = (octet >> 4) & 0x1;
1212  object->cr = (octet >> 5) & 0x1;
1213  object->tcc = (octet >> 6) & 0x3;
1214  }
1215  if (!DNP3ReadUint8(buf, len, &object->count)) {
1216  goto error;
1217  }
1218  if (!DNP3ReadUint32(buf, len, &object->ontime)) {
1219  goto error;
1220  }
1221  if (!DNP3ReadUint32(buf, len, &object->offtime)) {
1222  goto error;
1223  }
1224  {
1225  uint8_t octet;
1226  if (!DNP3ReadUint8(buf, len, &octet)) {
1227  goto error;
1228  }
1229  object->status_code = (octet >> 0) & 0x7f;
1230  object->reserved = (octet >> 7) & 0x1;
1231  }
1232 
1233  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
1234  goto error;
1235  }
1236 
1237  object = NULL;
1238  point_index++;
1239  }
1240 
1241  return 1;
1242 error:
1243  if (object != NULL) {
1244  SCFree(object);
1245  }
1246 
1247  return 0;
1248 }
1249 
1250 static int DNP3DecodeObjectG12V3(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
1251  uint32_t start, uint32_t count, DNP3PointList *points)
1252 {
1253  DNP3ObjectG12V3 *object = NULL;
1254  uint32_t bytes = (count / 8) + 1;
1255  uint32_t prefix = 0;
1256  uint32_t point_index = start;
1257 
1258  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
1259  goto error;
1260  }
1261 
1262  for (uint32_t i = 0; i < bytes; i++) {
1263 
1264  uint8_t octet;
1265 
1266  if (!DNP3ReadUint8(buf, len, &octet)) {
1267  goto error;
1268  }
1269 
1270  for (int j = 0; j < 8 && count; j = j + 1) {
1271 
1272  object = SCCalloc(1, sizeof(*object));
1273  if (unlikely(object == NULL)) {
1274  goto error;
1275  }
1276 
1277  object->point = (octet >> j) & 0x1;
1278 
1279  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
1280  goto error;
1281  }
1282 
1283  object = NULL;
1284  count--;
1285  point_index++;
1286  }
1287 
1288  }
1289 
1290  return 1;
1291 error:
1292  if (object != NULL) {
1293  SCFree(object);
1294  }
1295  return 0;
1296 }
1297 
1298 static int DNP3DecodeObjectG13V1(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
1299  uint32_t start, uint32_t count, DNP3PointList *points)
1300 {
1301  DNP3ObjectG13V1 *object = NULL;
1302  uint32_t prefix = 0;
1303  uint32_t point_index = start;
1304 
1305  if (*len < count/8) {
1306  goto error;
1307  }
1308  while (count--) {
1309 
1310  object = SCCalloc(1, sizeof(*object));
1311  if (unlikely(object == NULL)) {
1312  goto error;
1313  }
1314 
1315  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
1316  goto error;
1317  }
1318 
1319  {
1320  uint8_t octet;
1321  if (!DNP3ReadUint8(buf, len, &octet)) {
1322  goto error;
1323  }
1324  object->status_code = (octet >> 0) & 0x7f;
1325  object->commanded_state = (octet >> 7) & 0x1;
1326  }
1327 
1328  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
1329  goto error;
1330  }
1331 
1332  object = NULL;
1333  point_index++;
1334  }
1335 
1336  return 1;
1337 error:
1338  if (object != NULL) {
1339  SCFree(object);
1340  }
1341 
1342  return 0;
1343 }
1344 
1345 static int DNP3DecodeObjectG13V2(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
1346  uint32_t start, uint32_t count, DNP3PointList *points)
1347 {
1348  DNP3ObjectG13V2 *object = NULL;
1349  uint32_t prefix = 0;
1350  uint32_t point_index = start;
1351 
1352  if (*len < count/8) {
1353  goto error;
1354  }
1355  while (count--) {
1356 
1357  object = SCCalloc(1, sizeof(*object));
1358  if (unlikely(object == NULL)) {
1359  goto error;
1360  }
1361 
1362  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
1363  goto error;
1364  }
1365 
1366  {
1367  uint8_t octet;
1368  if (!DNP3ReadUint8(buf, len, &octet)) {
1369  goto error;
1370  }
1371  object->status_code = (octet >> 0) & 0x7f;
1372  object->commanded_state = (octet >> 7) & 0x1;
1373  }
1374  if (!DNP3ReadUint48(buf, len, &object->timestamp)) {
1375  goto error;
1376  }
1377 
1378  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
1379  goto error;
1380  }
1381 
1382  object = NULL;
1383  point_index++;
1384  }
1385 
1386  return 1;
1387 error:
1388  if (object != NULL) {
1389  SCFree(object);
1390  }
1391 
1392  return 0;
1393 }
1394 
1395 static int DNP3DecodeObjectG20V1(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
1396  uint32_t start, uint32_t count, DNP3PointList *points)
1397 {
1398  DNP3ObjectG20V1 *object = NULL;
1399  uint32_t prefix = 0;
1400  uint32_t point_index = start;
1401 
1402  if (*len < count/8) {
1403  goto error;
1404  }
1405  while (count--) {
1406 
1407  object = SCCalloc(1, sizeof(*object));
1408  if (unlikely(object == NULL)) {
1409  goto error;
1410  }
1411 
1412  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
1413  goto error;
1414  }
1415 
1416  {
1417  uint8_t octet;
1418  if (!DNP3ReadUint8(buf, len, &octet)) {
1419  goto error;
1420  }
1421  object->online = (octet >> 0) & 0x1;
1422  object->restart = (octet >> 1) & 0x1;
1423  object->comm_lost = (octet >> 2) & 0x1;
1424  object->remote_forced = (octet >> 3) & 0x1;
1425  object->local_forced = (octet >> 4) & 0x1;
1426  object->rollover = (octet >> 5) & 0x1;
1427  object->discontinuity = (octet >> 6) & 0x1;
1428  object->reserved0 = (octet >> 7) & 0x1;
1429  }
1430  if (!DNP3ReadUint32(buf, len, &object->count)) {
1431  goto error;
1432  }
1433 
1434  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
1435  goto error;
1436  }
1437 
1438  object = NULL;
1439  point_index++;
1440  }
1441 
1442  return 1;
1443 error:
1444  if (object != NULL) {
1445  SCFree(object);
1446  }
1447 
1448  return 0;
1449 }
1450 
1451 static int DNP3DecodeObjectG20V2(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
1452  uint32_t start, uint32_t count, DNP3PointList *points)
1453 {
1454  DNP3ObjectG20V2 *object = NULL;
1455  uint32_t prefix = 0;
1456  uint32_t point_index = start;
1457 
1458  if (*len < count/8) {
1459  goto error;
1460  }
1461  while (count--) {
1462 
1463  object = SCCalloc(1, sizeof(*object));
1464  if (unlikely(object == NULL)) {
1465  goto error;
1466  }
1467 
1468  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
1469  goto error;
1470  }
1471 
1472  {
1473  uint8_t octet;
1474  if (!DNP3ReadUint8(buf, len, &octet)) {
1475  goto error;
1476  }
1477  object->online = (octet >> 0) & 0x1;
1478  object->restart = (octet >> 1) & 0x1;
1479  object->comm_lost = (octet >> 2) & 0x1;
1480  object->remote_forced = (octet >> 3) & 0x1;
1481  object->local_forced = (octet >> 4) & 0x1;
1482  object->rollover = (octet >> 5) & 0x1;
1483  object->discontinuity = (octet >> 6) & 0x1;
1484  object->reserved0 = (octet >> 7) & 0x1;
1485  }
1486  if (!DNP3ReadUint16(buf, len, &object->count)) {
1487  goto error;
1488  }
1489 
1490  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
1491  goto error;
1492  }
1493 
1494  object = NULL;
1495  point_index++;
1496  }
1497 
1498  return 1;
1499 error:
1500  if (object != NULL) {
1501  SCFree(object);
1502  }
1503 
1504  return 0;
1505 }
1506 
1507 static int DNP3DecodeObjectG20V3(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
1508  uint32_t start, uint32_t count, DNP3PointList *points)
1509 {
1510  DNP3ObjectG20V3 *object = NULL;
1511  uint32_t prefix = 0;
1512  uint32_t point_index = start;
1513 
1514  if (*len < count/8) {
1515  goto error;
1516  }
1517  while (count--) {
1518 
1519  object = SCCalloc(1, sizeof(*object));
1520  if (unlikely(object == NULL)) {
1521  goto error;
1522  }
1523 
1524  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
1525  goto error;
1526  }
1527 
1528  {
1529  uint8_t octet;
1530  if (!DNP3ReadUint8(buf, len, &octet)) {
1531  goto error;
1532  }
1533  object->online = (octet >> 0) & 0x1;
1534  object->restart = (octet >> 1) & 0x1;
1535  object->comm_lost = (octet >> 2) & 0x1;
1536  object->remote_forced = (octet >> 3) & 0x1;
1537  object->local_forced = (octet >> 4) & 0x1;
1538  object->rollover = (octet >> 5) & 0x1;
1539  object->reserved0 = (octet >> 6) & 0x1;
1540  object->reserved1 = (octet >> 7) & 0x1;
1541  }
1542  if (!DNP3ReadUint32(buf, len, &object->count)) {
1543  goto error;
1544  }
1545 
1546  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
1547  goto error;
1548  }
1549 
1550  object = NULL;
1551  point_index++;
1552  }
1553 
1554  return 1;
1555 error:
1556  if (object != NULL) {
1557  SCFree(object);
1558  }
1559 
1560  return 0;
1561 }
1562 
1563 static int DNP3DecodeObjectG20V4(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
1564  uint32_t start, uint32_t count, DNP3PointList *points)
1565 {
1566  DNP3ObjectG20V4 *object = NULL;
1567  uint32_t prefix = 0;
1568  uint32_t point_index = start;
1569 
1570  if (*len < count/8) {
1571  goto error;
1572  }
1573  while (count--) {
1574 
1575  object = SCCalloc(1, sizeof(*object));
1576  if (unlikely(object == NULL)) {
1577  goto error;
1578  }
1579 
1580  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
1581  goto error;
1582  }
1583 
1584  {
1585  uint8_t octet;
1586  if (!DNP3ReadUint8(buf, len, &octet)) {
1587  goto error;
1588  }
1589  object->online = (octet >> 0) & 0x1;
1590  object->restart = (octet >> 1) & 0x1;
1591  object->comm_lost = (octet >> 2) & 0x1;
1592  object->remote_forced = (octet >> 3) & 0x1;
1593  object->local_forced = (octet >> 4) & 0x1;
1594  object->rollover = (octet >> 5) & 0x1;
1595  object->reserved0 = (octet >> 6) & 0x1;
1596  object->reserved1 = (octet >> 7) & 0x1;
1597  }
1598  if (!DNP3ReadUint16(buf, len, &object->count)) {
1599  goto error;
1600  }
1601 
1602  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
1603  goto error;
1604  }
1605 
1606  object = NULL;
1607  point_index++;
1608  }
1609 
1610  return 1;
1611 error:
1612  if (object != NULL) {
1613  SCFree(object);
1614  }
1615 
1616  return 0;
1617 }
1618 
1619 static int DNP3DecodeObjectG20V5(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
1620  uint32_t start, uint32_t count, DNP3PointList *points)
1621 {
1622  DNP3ObjectG20V5 *object = NULL;
1623  uint32_t prefix = 0;
1624  uint32_t point_index = start;
1625 
1626  if (*len < count/8) {
1627  goto error;
1628  }
1629  while (count--) {
1630 
1631  object = SCCalloc(1, sizeof(*object));
1632  if (unlikely(object == NULL)) {
1633  goto error;
1634  }
1635 
1636  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
1637  goto error;
1638  }
1639 
1640  if (!DNP3ReadUint32(buf, len, &object->count)) {
1641  goto error;
1642  }
1643 
1644  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
1645  goto error;
1646  }
1647 
1648  object = NULL;
1649  point_index++;
1650  }
1651 
1652  return 1;
1653 error:
1654  if (object != NULL) {
1655  SCFree(object);
1656  }
1657 
1658  return 0;
1659 }
1660 
1661 static int DNP3DecodeObjectG20V6(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
1662  uint32_t start, uint32_t count, DNP3PointList *points)
1663 {
1664  DNP3ObjectG20V6 *object = NULL;
1665  uint32_t prefix = 0;
1666  uint32_t point_index = start;
1667 
1668  if (*len < count/8) {
1669  goto error;
1670  }
1671  while (count--) {
1672 
1673  object = SCCalloc(1, sizeof(*object));
1674  if (unlikely(object == NULL)) {
1675  goto error;
1676  }
1677 
1678  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
1679  goto error;
1680  }
1681 
1682  if (!DNP3ReadUint16(buf, len, &object->count)) {
1683  goto error;
1684  }
1685 
1686  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
1687  goto error;
1688  }
1689 
1690  object = NULL;
1691  point_index++;
1692  }
1693 
1694  return 1;
1695 error:
1696  if (object != NULL) {
1697  SCFree(object);
1698  }
1699 
1700  return 0;
1701 }
1702 
1703 static int DNP3DecodeObjectG20V7(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
1704  uint32_t start, uint32_t count, DNP3PointList *points)
1705 {
1706  DNP3ObjectG20V7 *object = NULL;
1707  uint32_t prefix = 0;
1708  uint32_t point_index = start;
1709 
1710  if (*len < count/8) {
1711  goto error;
1712  }
1713  while (count--) {
1714 
1715  object = SCCalloc(1, sizeof(*object));
1716  if (unlikely(object == NULL)) {
1717  goto error;
1718  }
1719 
1720  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
1721  goto error;
1722  }
1723 
1724  if (!DNP3ReadUint32(buf, len, &object->count)) {
1725  goto error;
1726  }
1727 
1728  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
1729  goto error;
1730  }
1731 
1732  object = NULL;
1733  point_index++;
1734  }
1735 
1736  return 1;
1737 error:
1738  if (object != NULL) {
1739  SCFree(object);
1740  }
1741 
1742  return 0;
1743 }
1744 
1745 static int DNP3DecodeObjectG20V8(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
1746  uint32_t start, uint32_t count, DNP3PointList *points)
1747 {
1748  DNP3ObjectG20V8 *object = NULL;
1749  uint32_t prefix = 0;
1750  uint32_t point_index = start;
1751 
1752  if (*len < count/8) {
1753  goto error;
1754  }
1755  while (count--) {
1756 
1757  object = SCCalloc(1, sizeof(*object));
1758  if (unlikely(object == NULL)) {
1759  goto error;
1760  }
1761 
1762  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
1763  goto error;
1764  }
1765 
1766  if (!DNP3ReadUint16(buf, len, &object->count)) {
1767  goto error;
1768  }
1769 
1770  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
1771  goto error;
1772  }
1773 
1774  object = NULL;
1775  point_index++;
1776  }
1777 
1778  return 1;
1779 error:
1780  if (object != NULL) {
1781  SCFree(object);
1782  }
1783 
1784  return 0;
1785 }
1786 
1787 static int DNP3DecodeObjectG21V1(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
1788  uint32_t start, uint32_t count, DNP3PointList *points)
1789 {
1790  DNP3ObjectG21V1 *object = NULL;
1791  uint32_t prefix = 0;
1792  uint32_t point_index = start;
1793 
1794  if (*len < count/8) {
1795  goto error;
1796  }
1797  while (count--) {
1798 
1799  object = SCCalloc(1, sizeof(*object));
1800  if (unlikely(object == NULL)) {
1801  goto error;
1802  }
1803 
1804  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
1805  goto error;
1806  }
1807 
1808  {
1809  uint8_t octet;
1810  if (!DNP3ReadUint8(buf, len, &octet)) {
1811  goto error;
1812  }
1813  object->online = (octet >> 0) & 0x1;
1814  object->restart = (octet >> 1) & 0x1;
1815  object->comm_lost = (octet >> 2) & 0x1;
1816  object->remote_forced = (octet >> 3) & 0x1;
1817  object->local_forced = (octet >> 4) & 0x1;
1818  object->rollover = (octet >> 5) & 0x1;
1819  object->discontinuity = (octet >> 6) & 0x1;
1820  object->reserved0 = (octet >> 7) & 0x1;
1821  }
1822  if (!DNP3ReadUint32(buf, len, &object->count)) {
1823  goto error;
1824  }
1825 
1826  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
1827  goto error;
1828  }
1829 
1830  object = NULL;
1831  point_index++;
1832  }
1833 
1834  return 1;
1835 error:
1836  if (object != NULL) {
1837  SCFree(object);
1838  }
1839 
1840  return 0;
1841 }
1842 
1843 static int DNP3DecodeObjectG21V2(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
1844  uint32_t start, uint32_t count, DNP3PointList *points)
1845 {
1846  DNP3ObjectG21V2 *object = NULL;
1847  uint32_t prefix = 0;
1848  uint32_t point_index = start;
1849 
1850  if (*len < count/8) {
1851  goto error;
1852  }
1853  while (count--) {
1854 
1855  object = SCCalloc(1, sizeof(*object));
1856  if (unlikely(object == NULL)) {
1857  goto error;
1858  }
1859 
1860  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
1861  goto error;
1862  }
1863 
1864  {
1865  uint8_t octet;
1866  if (!DNP3ReadUint8(buf, len, &octet)) {
1867  goto error;
1868  }
1869  object->online = (octet >> 0) & 0x1;
1870  object->restart = (octet >> 1) & 0x1;
1871  object->comm_lost = (octet >> 2) & 0x1;
1872  object->remote_forced = (octet >> 3) & 0x1;
1873  object->local_forced = (octet >> 4) & 0x1;
1874  object->rollover = (octet >> 5) & 0x1;
1875  object->discontinuity = (octet >> 6) & 0x1;
1876  object->reserved0 = (octet >> 7) & 0x1;
1877  }
1878  if (!DNP3ReadUint16(buf, len, &object->count)) {
1879  goto error;
1880  }
1881 
1882  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
1883  goto error;
1884  }
1885 
1886  object = NULL;
1887  point_index++;
1888  }
1889 
1890  return 1;
1891 error:
1892  if (object != NULL) {
1893  SCFree(object);
1894  }
1895 
1896  return 0;
1897 }
1898 
1899 static int DNP3DecodeObjectG21V3(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
1900  uint32_t start, uint32_t count, DNP3PointList *points)
1901 {
1902  DNP3ObjectG21V3 *object = NULL;
1903  uint32_t prefix = 0;
1904  uint32_t point_index = start;
1905 
1906  if (*len < count/8) {
1907  goto error;
1908  }
1909  while (count--) {
1910 
1911  object = SCCalloc(1, sizeof(*object));
1912  if (unlikely(object == NULL)) {
1913  goto error;
1914  }
1915 
1916  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
1917  goto error;
1918  }
1919 
1920  {
1921  uint8_t octet;
1922  if (!DNP3ReadUint8(buf, len, &octet)) {
1923  goto error;
1924  }
1925  object->online = (octet >> 0) & 0x1;
1926  object->restart = (octet >> 1) & 0x1;
1927  object->comm_lost = (octet >> 2) & 0x1;
1928  object->remote_forced = (octet >> 3) & 0x1;
1929  object->local_forced = (octet >> 4) & 0x1;
1930  object->rollover = (octet >> 5) & 0x1;
1931  object->reserved0 = (octet >> 6) & 0x1;
1932  object->reserved1 = (octet >> 7) & 0x1;
1933  }
1934  if (!DNP3ReadUint32(buf, len, &object->count)) {
1935  goto error;
1936  }
1937 
1938  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
1939  goto error;
1940  }
1941 
1942  object = NULL;
1943  point_index++;
1944  }
1945 
1946  return 1;
1947 error:
1948  if (object != NULL) {
1949  SCFree(object);
1950  }
1951 
1952  return 0;
1953 }
1954 
1955 static int DNP3DecodeObjectG21V4(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
1956  uint32_t start, uint32_t count, DNP3PointList *points)
1957 {
1958  DNP3ObjectG21V4 *object = NULL;
1959  uint32_t prefix = 0;
1960  uint32_t point_index = start;
1961 
1962  if (*len < count/8) {
1963  goto error;
1964  }
1965  while (count--) {
1966 
1967  object = SCCalloc(1, sizeof(*object));
1968  if (unlikely(object == NULL)) {
1969  goto error;
1970  }
1971 
1972  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
1973  goto error;
1974  }
1975 
1976  {
1977  uint8_t octet;
1978  if (!DNP3ReadUint8(buf, len, &octet)) {
1979  goto error;
1980  }
1981  object->online = (octet >> 0) & 0x1;
1982  object->restart = (octet >> 1) & 0x1;
1983  object->comm_lost = (octet >> 2) & 0x1;
1984  object->remote_forced = (octet >> 3) & 0x1;
1985  object->local_forced = (octet >> 4) & 0x1;
1986  object->rollover = (octet >> 5) & 0x1;
1987  object->reserved0 = (octet >> 6) & 0x1;
1988  object->reserved1 = (octet >> 7) & 0x1;
1989  }
1990  if (!DNP3ReadUint16(buf, len, &object->count)) {
1991  goto error;
1992  }
1993 
1994  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
1995  goto error;
1996  }
1997 
1998  object = NULL;
1999  point_index++;
2000  }
2001 
2002  return 1;
2003 error:
2004  if (object != NULL) {
2005  SCFree(object);
2006  }
2007 
2008  return 0;
2009 }
2010 
2011 static int DNP3DecodeObjectG21V5(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
2012  uint32_t start, uint32_t count, DNP3PointList *points)
2013 {
2014  DNP3ObjectG21V5 *object = NULL;
2015  uint32_t prefix = 0;
2016  uint32_t point_index = start;
2017 
2018  if (*len < count/8) {
2019  goto error;
2020  }
2021  while (count--) {
2022 
2023  object = SCCalloc(1, sizeof(*object));
2024  if (unlikely(object == NULL)) {
2025  goto error;
2026  }
2027 
2028  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
2029  goto error;
2030  }
2031 
2032  {
2033  uint8_t octet;
2034  if (!DNP3ReadUint8(buf, len, &octet)) {
2035  goto error;
2036  }
2037  object->online = (octet >> 0) & 0x1;
2038  object->restart = (octet >> 1) & 0x1;
2039  object->comm_lost = (octet >> 2) & 0x1;
2040  object->remote_forced = (octet >> 3) & 0x1;
2041  object->local_forced = (octet >> 4) & 0x1;
2042  object->rollover = (octet >> 5) & 0x1;
2043  object->discontinuity = (octet >> 6) & 0x1;
2044  object->reserved1 = (octet >> 7) & 0x1;
2045  }
2046  if (!DNP3ReadUint32(buf, len, &object->count)) {
2047  goto error;
2048  }
2049  if (!DNP3ReadUint48(buf, len, &object->timestamp)) {
2050  goto error;
2051  }
2052 
2053  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
2054  goto error;
2055  }
2056 
2057  object = NULL;
2058  point_index++;
2059  }
2060 
2061  return 1;
2062 error:
2063  if (object != NULL) {
2064  SCFree(object);
2065  }
2066 
2067  return 0;
2068 }
2069 
2070 static int DNP3DecodeObjectG21V6(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
2071  uint32_t start, uint32_t count, DNP3PointList *points)
2072 {
2073  DNP3ObjectG21V6 *object = NULL;
2074  uint32_t prefix = 0;
2075  uint32_t point_index = start;
2076 
2077  if (*len < count/8) {
2078  goto error;
2079  }
2080  while (count--) {
2081 
2082  object = SCCalloc(1, sizeof(*object));
2083  if (unlikely(object == NULL)) {
2084  goto error;
2085  }
2086 
2087  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
2088  goto error;
2089  }
2090 
2091  {
2092  uint8_t octet;
2093  if (!DNP3ReadUint8(buf, len, &octet)) {
2094  goto error;
2095  }
2096  object->online = (octet >> 0) & 0x1;
2097  object->restart = (octet >> 1) & 0x1;
2098  object->comm_lost = (octet >> 2) & 0x1;
2099  object->remote_forced = (octet >> 3) & 0x1;
2100  object->local_forced = (octet >> 4) & 0x1;
2101  object->rollover = (octet >> 5) & 0x1;
2102  object->discontinuity = (octet >> 6) & 0x1;
2103  object->reserved1 = (octet >> 7) & 0x1;
2104  }
2105  if (!DNP3ReadUint16(buf, len, &object->count)) {
2106  goto error;
2107  }
2108  if (!DNP3ReadUint48(buf, len, &object->timestamp)) {
2109  goto error;
2110  }
2111 
2112  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
2113  goto error;
2114  }
2115 
2116  object = NULL;
2117  point_index++;
2118  }
2119 
2120  return 1;
2121 error:
2122  if (object != NULL) {
2123  SCFree(object);
2124  }
2125 
2126  return 0;
2127 }
2128 
2129 static int DNP3DecodeObjectG21V7(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
2130  uint32_t start, uint32_t count, DNP3PointList *points)
2131 {
2132  DNP3ObjectG21V7 *object = NULL;
2133  uint32_t prefix = 0;
2134  uint32_t point_index = start;
2135 
2136  if (*len < count/8) {
2137  goto error;
2138  }
2139  while (count--) {
2140 
2141  object = SCCalloc(1, sizeof(*object));
2142  if (unlikely(object == NULL)) {
2143  goto error;
2144  }
2145 
2146  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
2147  goto error;
2148  }
2149 
2150  {
2151  uint8_t octet;
2152  if (!DNP3ReadUint8(buf, len, &octet)) {
2153  goto error;
2154  }
2155  object->online = (octet >> 0) & 0x1;
2156  object->restart = (octet >> 1) & 0x1;
2157  object->comm_lost = (octet >> 2) & 0x1;
2158  object->remote_forced = (octet >> 3) & 0x1;
2159  object->local_forced = (octet >> 4) & 0x1;
2160  object->rollover = (octet >> 5) & 0x1;
2161  object->reserved0 = (octet >> 6) & 0x1;
2162  object->reserved1 = (octet >> 7) & 0x1;
2163  }
2164  if (!DNP3ReadUint32(buf, len, &object->count)) {
2165  goto error;
2166  }
2167  if (!DNP3ReadUint48(buf, len, &object->timestamp)) {
2168  goto error;
2169  }
2170 
2171  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
2172  goto error;
2173  }
2174 
2175  object = NULL;
2176  point_index++;
2177  }
2178 
2179  return 1;
2180 error:
2181  if (object != NULL) {
2182  SCFree(object);
2183  }
2184 
2185  return 0;
2186 }
2187 
2188 static int DNP3DecodeObjectG21V8(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
2189  uint32_t start, uint32_t count, DNP3PointList *points)
2190 {
2191  DNP3ObjectG21V8 *object = NULL;
2192  uint32_t prefix = 0;
2193  uint32_t point_index = start;
2194 
2195  if (*len < count/8) {
2196  goto error;
2197  }
2198  while (count--) {
2199 
2200  object = SCCalloc(1, sizeof(*object));
2201  if (unlikely(object == NULL)) {
2202  goto error;
2203  }
2204 
2205  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
2206  goto error;
2207  }
2208 
2209  {
2210  uint8_t octet;
2211  if (!DNP3ReadUint8(buf, len, &octet)) {
2212  goto error;
2213  }
2214  object->online = (octet >> 0) & 0x1;
2215  object->restart = (octet >> 1) & 0x1;
2216  object->comm_lost = (octet >> 2) & 0x1;
2217  object->remote_forced = (octet >> 3) & 0x1;
2218  object->local_forced = (octet >> 4) & 0x1;
2219  object->rollover = (octet >> 5) & 0x1;
2220  object->reserved0 = (octet >> 6) & 0x1;
2221  object->reserved1 = (octet >> 7) & 0x1;
2222  }
2223  if (!DNP3ReadUint16(buf, len, &object->count)) {
2224  goto error;
2225  }
2226  if (!DNP3ReadUint48(buf, len, &object->timestamp)) {
2227  goto error;
2228  }
2229 
2230  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
2231  goto error;
2232  }
2233 
2234  object = NULL;
2235  point_index++;
2236  }
2237 
2238  return 1;
2239 error:
2240  if (object != NULL) {
2241  SCFree(object);
2242  }
2243 
2244  return 0;
2245 }
2246 
2247 static int DNP3DecodeObjectG21V9(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
2248  uint32_t start, uint32_t count, DNP3PointList *points)
2249 {
2250  DNP3ObjectG21V9 *object = NULL;
2251  uint32_t prefix = 0;
2252  uint32_t point_index = start;
2253 
2254  if (*len < count/8) {
2255  goto error;
2256  }
2257  while (count--) {
2258 
2259  object = SCCalloc(1, sizeof(*object));
2260  if (unlikely(object == NULL)) {
2261  goto error;
2262  }
2263 
2264  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
2265  goto error;
2266  }
2267 
2268  if (!DNP3ReadUint32(buf, len, &object->count)) {
2269  goto error;
2270  }
2271 
2272  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
2273  goto error;
2274  }
2275 
2276  object = NULL;
2277  point_index++;
2278  }
2279 
2280  return 1;
2281 error:
2282  if (object != NULL) {
2283  SCFree(object);
2284  }
2285 
2286  return 0;
2287 }
2288 
2289 static int DNP3DecodeObjectG21V10(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
2290  uint32_t start, uint32_t count, DNP3PointList *points)
2291 {
2292  DNP3ObjectG21V10 *object = NULL;
2293  uint32_t prefix = 0;
2294  uint32_t point_index = start;
2295 
2296  if (*len < count/8) {
2297  goto error;
2298  }
2299  while (count--) {
2300 
2301  object = SCCalloc(1, sizeof(*object));
2302  if (unlikely(object == NULL)) {
2303  goto error;
2304  }
2305 
2306  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
2307  goto error;
2308  }
2309 
2310  if (!DNP3ReadUint16(buf, len, &object->count)) {
2311  goto error;
2312  }
2313 
2314  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
2315  goto error;
2316  }
2317 
2318  object = NULL;
2319  point_index++;
2320  }
2321 
2322  return 1;
2323 error:
2324  if (object != NULL) {
2325  SCFree(object);
2326  }
2327 
2328  return 0;
2329 }
2330 
2331 static int DNP3DecodeObjectG21V11(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
2332  uint32_t start, uint32_t count, DNP3PointList *points)
2333 {
2334  DNP3ObjectG21V11 *object = NULL;
2335  uint32_t prefix = 0;
2336  uint32_t point_index = start;
2337 
2338  if (*len < count/8) {
2339  goto error;
2340  }
2341  while (count--) {
2342 
2343  object = SCCalloc(1, sizeof(*object));
2344  if (unlikely(object == NULL)) {
2345  goto error;
2346  }
2347 
2348  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
2349  goto error;
2350  }
2351 
2352  if (!DNP3ReadUint32(buf, len, &object->count)) {
2353  goto error;
2354  }
2355 
2356  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
2357  goto error;
2358  }
2359 
2360  object = NULL;
2361  point_index++;
2362  }
2363 
2364  return 1;
2365 error:
2366  if (object != NULL) {
2367  SCFree(object);
2368  }
2369 
2370  return 0;
2371 }
2372 
2373 static int DNP3DecodeObjectG21V12(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
2374  uint32_t start, uint32_t count, DNP3PointList *points)
2375 {
2376  DNP3ObjectG21V12 *object = NULL;
2377  uint32_t prefix = 0;
2378  uint32_t point_index = start;
2379 
2380  if (*len < count/8) {
2381  goto error;
2382  }
2383  while (count--) {
2384 
2385  object = SCCalloc(1, sizeof(*object));
2386  if (unlikely(object == NULL)) {
2387  goto error;
2388  }
2389 
2390  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
2391  goto error;
2392  }
2393 
2394  if (!DNP3ReadUint16(buf, len, &object->count)) {
2395  goto error;
2396  }
2397 
2398  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
2399  goto error;
2400  }
2401 
2402  object = NULL;
2403  point_index++;
2404  }
2405 
2406  return 1;
2407 error:
2408  if (object != NULL) {
2409  SCFree(object);
2410  }
2411 
2412  return 0;
2413 }
2414 
2415 static int DNP3DecodeObjectG22V1(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
2416  uint32_t start, uint32_t count, DNP3PointList *points)
2417 {
2418  DNP3ObjectG22V1 *object = NULL;
2419  uint32_t prefix = 0;
2420  uint32_t point_index = start;
2421 
2422  if (*len < count/8) {
2423  goto error;
2424  }
2425  while (count--) {
2426 
2427  object = SCCalloc(1, sizeof(*object));
2428  if (unlikely(object == NULL)) {
2429  goto error;
2430  }
2431 
2432  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
2433  goto error;
2434  }
2435 
2436  {
2437  uint8_t octet;
2438  if (!DNP3ReadUint8(buf, len, &octet)) {
2439  goto error;
2440  }
2441  object->online = (octet >> 0) & 0x1;
2442  object->restart = (octet >> 1) & 0x1;
2443  object->comm_lost = (octet >> 2) & 0x1;
2444  object->remote_forced = (octet >> 3) & 0x1;
2445  object->local_forced = (octet >> 4) & 0x1;
2446  object->rollover = (octet >> 5) & 0x1;
2447  object->discontinuity = (octet >> 6) & 0x1;
2448  object->reserved0 = (octet >> 7) & 0x1;
2449  }
2450  if (!DNP3ReadUint32(buf, len, &object->count)) {
2451  goto error;
2452  }
2453 
2454  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
2455  goto error;
2456  }
2457 
2458  object = NULL;
2459  point_index++;
2460  }
2461 
2462  return 1;
2463 error:
2464  if (object != NULL) {
2465  SCFree(object);
2466  }
2467 
2468  return 0;
2469 }
2470 
2471 static int DNP3DecodeObjectG22V2(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
2472  uint32_t start, uint32_t count, DNP3PointList *points)
2473 {
2474  DNP3ObjectG22V2 *object = NULL;
2475  uint32_t prefix = 0;
2476  uint32_t point_index = start;
2477 
2478  if (*len < count/8) {
2479  goto error;
2480  }
2481  while (count--) {
2482 
2483  object = SCCalloc(1, sizeof(*object));
2484  if (unlikely(object == NULL)) {
2485  goto error;
2486  }
2487 
2488  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
2489  goto error;
2490  }
2491 
2492  {
2493  uint8_t octet;
2494  if (!DNP3ReadUint8(buf, len, &octet)) {
2495  goto error;
2496  }
2497  object->online = (octet >> 0) & 0x1;
2498  object->restart = (octet >> 1) & 0x1;
2499  object->comm_lost = (octet >> 2) & 0x1;
2500  object->remote_forced = (octet >> 3) & 0x1;
2501  object->local_forced = (octet >> 4) & 0x1;
2502  object->rollover = (octet >> 5) & 0x1;
2503  object->discontinuity = (octet >> 6) & 0x1;
2504  object->reserved0 = (octet >> 7) & 0x1;
2505  }
2506  if (!DNP3ReadUint16(buf, len, &object->count)) {
2507  goto error;
2508  }
2509 
2510  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
2511  goto error;
2512  }
2513 
2514  object = NULL;
2515  point_index++;
2516  }
2517 
2518  return 1;
2519 error:
2520  if (object != NULL) {
2521  SCFree(object);
2522  }
2523 
2524  return 0;
2525 }
2526 
2527 static int DNP3DecodeObjectG22V3(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
2528  uint32_t start, uint32_t count, DNP3PointList *points)
2529 {
2530  DNP3ObjectG22V3 *object = NULL;
2531  uint32_t prefix = 0;
2532  uint32_t point_index = start;
2533 
2534  if (*len < count/8) {
2535  goto error;
2536  }
2537  while (count--) {
2538 
2539  object = SCCalloc(1, sizeof(*object));
2540  if (unlikely(object == NULL)) {
2541  goto error;
2542  }
2543 
2544  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
2545  goto error;
2546  }
2547 
2548  {
2549  uint8_t octet;
2550  if (!DNP3ReadUint8(buf, len, &octet)) {
2551  goto error;
2552  }
2553  object->online = (octet >> 0) & 0x1;
2554  object->restart = (octet >> 1) & 0x1;
2555  object->comm_lost = (octet >> 2) & 0x1;
2556  object->remote_forced = (octet >> 3) & 0x1;
2557  object->local_forced = (octet >> 4) & 0x1;
2558  object->rollover = (octet >> 5) & 0x1;
2559  object->reserved0 = (octet >> 6) & 0x1;
2560  object->reserved1 = (octet >> 7) & 0x1;
2561  }
2562  if (!DNP3ReadUint32(buf, len, &object->count)) {
2563  goto error;
2564  }
2565 
2566  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
2567  goto error;
2568  }
2569 
2570  object = NULL;
2571  point_index++;
2572  }
2573 
2574  return 1;
2575 error:
2576  if (object != NULL) {
2577  SCFree(object);
2578  }
2579 
2580  return 0;
2581 }
2582 
2583 static int DNP3DecodeObjectG22V4(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
2584  uint32_t start, uint32_t count, DNP3PointList *points)
2585 {
2586  DNP3ObjectG22V4 *object = NULL;
2587  uint32_t prefix = 0;
2588  uint32_t point_index = start;
2589 
2590  if (*len < count/8) {
2591  goto error;
2592  }
2593  while (count--) {
2594 
2595  object = SCCalloc(1, sizeof(*object));
2596  if (unlikely(object == NULL)) {
2597  goto error;
2598  }
2599 
2600  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
2601  goto error;
2602  }
2603 
2604  {
2605  uint8_t octet;
2606  if (!DNP3ReadUint8(buf, len, &octet)) {
2607  goto error;
2608  }
2609  object->online = (octet >> 0) & 0x1;
2610  object->restart = (octet >> 1) & 0x1;
2611  object->comm_lost = (octet >> 2) & 0x1;
2612  object->remote_forced = (octet >> 3) & 0x1;
2613  object->local_forced = (octet >> 4) & 0x1;
2614  object->rollover = (octet >> 5) & 0x1;
2615  object->reserved0 = (octet >> 6) & 0x1;
2616  object->reserved1 = (octet >> 7) & 0x1;
2617  }
2618  if (!DNP3ReadUint16(buf, len, &object->count)) {
2619  goto error;
2620  }
2621 
2622  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
2623  goto error;
2624  }
2625 
2626  object = NULL;
2627  point_index++;
2628  }
2629 
2630  return 1;
2631 error:
2632  if (object != NULL) {
2633  SCFree(object);
2634  }
2635 
2636  return 0;
2637 }
2638 
2639 static int DNP3DecodeObjectG22V5(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
2640  uint32_t start, uint32_t count, DNP3PointList *points)
2641 {
2642  DNP3ObjectG22V5 *object = NULL;
2643  uint32_t prefix = 0;
2644  uint32_t point_index = start;
2645 
2646  if (*len < count/8) {
2647  goto error;
2648  }
2649  while (count--) {
2650 
2651  object = SCCalloc(1, sizeof(*object));
2652  if (unlikely(object == NULL)) {
2653  goto error;
2654  }
2655 
2656  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
2657  goto error;
2658  }
2659 
2660  {
2661  uint8_t octet;
2662  if (!DNP3ReadUint8(buf, len, &octet)) {
2663  goto error;
2664  }
2665  object->online = (octet >> 0) & 0x1;
2666  object->restart = (octet >> 1) & 0x1;
2667  object->comm_lost = (octet >> 2) & 0x1;
2668  object->remote_forced = (octet >> 3) & 0x1;
2669  object->local_forced = (octet >> 4) & 0x1;
2670  object->rollover = (octet >> 5) & 0x1;
2671  object->reserved0 = (octet >> 6) & 0x1;
2672  object->reserved1 = (octet >> 7) & 0x1;
2673  }
2674  if (!DNP3ReadUint32(buf, len, &object->count)) {
2675  goto error;
2676  }
2677  if (!DNP3ReadUint48(buf, len, &object->timestamp)) {
2678  goto error;
2679  }
2680 
2681  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
2682  goto error;
2683  }
2684 
2685  object = NULL;
2686  point_index++;
2687  }
2688 
2689  return 1;
2690 error:
2691  if (object != NULL) {
2692  SCFree(object);
2693  }
2694 
2695  return 0;
2696 }
2697 
2698 static int DNP3DecodeObjectG22V6(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
2699  uint32_t start, uint32_t count, DNP3PointList *points)
2700 {
2701  DNP3ObjectG22V6 *object = NULL;
2702  uint32_t prefix = 0;
2703  uint32_t point_index = start;
2704 
2705  if (*len < count/8) {
2706  goto error;
2707  }
2708  while (count--) {
2709 
2710  object = SCCalloc(1, sizeof(*object));
2711  if (unlikely(object == NULL)) {
2712  goto error;
2713  }
2714 
2715  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
2716  goto error;
2717  }
2718 
2719  {
2720  uint8_t octet;
2721  if (!DNP3ReadUint8(buf, len, &octet)) {
2722  goto error;
2723  }
2724  object->online = (octet >> 0) & 0x1;
2725  object->restart = (octet >> 1) & 0x1;
2726  object->comm_lost = (octet >> 2) & 0x1;
2727  object->remote_forced = (octet >> 3) & 0x1;
2728  object->local_forced = (octet >> 4) & 0x1;
2729  object->rollover = (octet >> 5) & 0x1;
2730  object->discontinuity = (octet >> 6) & 0x1;
2731  object->reserved0 = (octet >> 7) & 0x1;
2732  }
2733  if (!DNP3ReadUint16(buf, len, &object->count)) {
2734  goto error;
2735  }
2736  if (!DNP3ReadUint48(buf, len, &object->timestamp)) {
2737  goto error;
2738  }
2739 
2740  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
2741  goto error;
2742  }
2743 
2744  object = NULL;
2745  point_index++;
2746  }
2747 
2748  return 1;
2749 error:
2750  if (object != NULL) {
2751  SCFree(object);
2752  }
2753 
2754  return 0;
2755 }
2756 
2757 static int DNP3DecodeObjectG22V7(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
2758  uint32_t start, uint32_t count, DNP3PointList *points)
2759 {
2760  DNP3ObjectG22V7 *object = NULL;
2761  uint32_t prefix = 0;
2762  uint32_t point_index = start;
2763 
2764  if (*len < count/8) {
2765  goto error;
2766  }
2767  while (count--) {
2768 
2769  object = SCCalloc(1, sizeof(*object));
2770  if (unlikely(object == NULL)) {
2771  goto error;
2772  }
2773 
2774  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
2775  goto error;
2776  }
2777 
2778  {
2779  uint8_t octet;
2780  if (!DNP3ReadUint8(buf, len, &octet)) {
2781  goto error;
2782  }
2783  object->online = (octet >> 0) & 0x1;
2784  object->restart = (octet >> 1) & 0x1;
2785  object->comm_lost = (octet >> 2) & 0x1;
2786  object->remote_forced = (octet >> 3) & 0x1;
2787  object->local_forced = (octet >> 4) & 0x1;
2788  object->rollover = (octet >> 5) & 0x1;
2789  object->reserved0 = (octet >> 6) & 0x1;
2790  object->reserved1 = (octet >> 7) & 0x1;
2791  }
2792  if (!DNP3ReadUint32(buf, len, &object->count)) {
2793  goto error;
2794  }
2795  if (!DNP3ReadUint48(buf, len, &object->timestamp)) {
2796  goto error;
2797  }
2798 
2799  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
2800  goto error;
2801  }
2802 
2803  object = NULL;
2804  point_index++;
2805  }
2806 
2807  return 1;
2808 error:
2809  if (object != NULL) {
2810  SCFree(object);
2811  }
2812 
2813  return 0;
2814 }
2815 
2816 static int DNP3DecodeObjectG22V8(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
2817  uint32_t start, uint32_t count, DNP3PointList *points)
2818 {
2819  DNP3ObjectG22V8 *object = NULL;
2820  uint32_t prefix = 0;
2821  uint32_t point_index = start;
2822 
2823  if (*len < count/8) {
2824  goto error;
2825  }
2826  while (count--) {
2827 
2828  object = SCCalloc(1, sizeof(*object));
2829  if (unlikely(object == NULL)) {
2830  goto error;
2831  }
2832 
2833  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
2834  goto error;
2835  }
2836 
2837  {
2838  uint8_t octet;
2839  if (!DNP3ReadUint8(buf, len, &octet)) {
2840  goto error;
2841  }
2842  object->online = (octet >> 0) & 0x1;
2843  object->restart = (octet >> 1) & 0x1;
2844  object->comm_lost = (octet >> 2) & 0x1;
2845  object->remote_forced = (octet >> 3) & 0x1;
2846  object->local_forced = (octet >> 4) & 0x1;
2847  object->rollover = (octet >> 5) & 0x1;
2848  object->reserved0 = (octet >> 6) & 0x1;
2849  object->reserved1 = (octet >> 7) & 0x1;
2850  }
2851  if (!DNP3ReadUint16(buf, len, &object->count)) {
2852  goto error;
2853  }
2854  if (!DNP3ReadUint48(buf, len, &object->timestamp)) {
2855  goto error;
2856  }
2857 
2858  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
2859  goto error;
2860  }
2861 
2862  object = NULL;
2863  point_index++;
2864  }
2865 
2866  return 1;
2867 error:
2868  if (object != NULL) {
2869  SCFree(object);
2870  }
2871 
2872  return 0;
2873 }
2874 
2875 static int DNP3DecodeObjectG23V1(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
2876  uint32_t start, uint32_t count, DNP3PointList *points)
2877 {
2878  DNP3ObjectG23V1 *object = NULL;
2879  uint32_t prefix = 0;
2880  uint32_t point_index = start;
2881 
2882  if (*len < count/8) {
2883  goto error;
2884  }
2885  while (count--) {
2886 
2887  object = SCCalloc(1, sizeof(*object));
2888  if (unlikely(object == NULL)) {
2889  goto error;
2890  }
2891 
2892  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
2893  goto error;
2894  }
2895 
2896  {
2897  uint8_t octet;
2898  if (!DNP3ReadUint8(buf, len, &octet)) {
2899  goto error;
2900  }
2901  object->online = (octet >> 0) & 0x1;
2902  object->restart = (octet >> 1) & 0x1;
2903  object->comm_lost = (octet >> 2) & 0x1;
2904  object->remote_forced = (octet >> 3) & 0x1;
2905  object->local_forced = (octet >> 4) & 0x1;
2906  object->rollover = (octet >> 5) & 0x1;
2907  object->discontinuity = (octet >> 6) & 0x1;
2908  object->reserved0 = (octet >> 7) & 0x1;
2909  }
2910  if (!DNP3ReadUint32(buf, len, &object->count)) {
2911  goto error;
2912  }
2913 
2914  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
2915  goto error;
2916  }
2917 
2918  object = NULL;
2919  point_index++;
2920  }
2921 
2922  return 1;
2923 error:
2924  if (object != NULL) {
2925  SCFree(object);
2926  }
2927 
2928  return 0;
2929 }
2930 
2931 static int DNP3DecodeObjectG23V2(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
2932  uint32_t start, uint32_t count, DNP3PointList *points)
2933 {
2934  DNP3ObjectG23V2 *object = NULL;
2935  uint32_t prefix = 0;
2936  uint32_t point_index = start;
2937 
2938  if (*len < count/8) {
2939  goto error;
2940  }
2941  while (count--) {
2942 
2943  object = SCCalloc(1, sizeof(*object));
2944  if (unlikely(object == NULL)) {
2945  goto error;
2946  }
2947 
2948  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
2949  goto error;
2950  }
2951 
2952  {
2953  uint8_t octet;
2954  if (!DNP3ReadUint8(buf, len, &octet)) {
2955  goto error;
2956  }
2957  object->online = (octet >> 0) & 0x1;
2958  object->restart = (octet >> 1) & 0x1;
2959  object->comm_lost = (octet >> 2) & 0x1;
2960  object->remote_forced = (octet >> 3) & 0x1;
2961  object->local_forced = (octet >> 4) & 0x1;
2962  object->rollover = (octet >> 5) & 0x1;
2963  object->reserved0 = (octet >> 6) & 0x1;
2964  object->reserved1 = (octet >> 7) & 0x1;
2965  }
2966  if (!DNP3ReadUint16(buf, len, &object->count)) {
2967  goto error;
2968  }
2969 
2970  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
2971  goto error;
2972  }
2973 
2974  object = NULL;
2975  point_index++;
2976  }
2977 
2978  return 1;
2979 error:
2980  if (object != NULL) {
2981  SCFree(object);
2982  }
2983 
2984  return 0;
2985 }
2986 
2987 static int DNP3DecodeObjectG23V3(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
2988  uint32_t start, uint32_t count, DNP3PointList *points)
2989 {
2990  DNP3ObjectG23V3 *object = NULL;
2991  uint32_t prefix = 0;
2992  uint32_t point_index = start;
2993 
2994  if (*len < count/8) {
2995  goto error;
2996  }
2997  while (count--) {
2998 
2999  object = SCCalloc(1, sizeof(*object));
3000  if (unlikely(object == NULL)) {
3001  goto error;
3002  }
3003 
3004  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
3005  goto error;
3006  }
3007 
3008  {
3009  uint8_t octet;
3010  if (!DNP3ReadUint8(buf, len, &octet)) {
3011  goto error;
3012  }
3013  object->online = (octet >> 0) & 0x1;
3014  object->restart = (octet >> 1) & 0x1;
3015  object->comm_lost = (octet >> 2) & 0x1;
3016  object->remote_forced = (octet >> 3) & 0x1;
3017  object->local_forced = (octet >> 4) & 0x1;
3018  object->rollover = (octet >> 5) & 0x1;
3019  object->reserved0 = (octet >> 6) & 0x1;
3020  object->reserved1 = (octet >> 7) & 0x1;
3021  }
3022  if (!DNP3ReadUint32(buf, len, &object->count)) {
3023  goto error;
3024  }
3025 
3026  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
3027  goto error;
3028  }
3029 
3030  object = NULL;
3031  point_index++;
3032  }
3033 
3034  return 1;
3035 error:
3036  if (object != NULL) {
3037  SCFree(object);
3038  }
3039 
3040  return 0;
3041 }
3042 
3043 static int DNP3DecodeObjectG23V4(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
3044  uint32_t start, uint32_t count, DNP3PointList *points)
3045 {
3046  DNP3ObjectG23V4 *object = NULL;
3047  uint32_t prefix = 0;
3048  uint32_t point_index = start;
3049 
3050  if (*len < count/8) {
3051  goto error;
3052  }
3053  while (count--) {
3054 
3055  object = SCCalloc(1, sizeof(*object));
3056  if (unlikely(object == NULL)) {
3057  goto error;
3058  }
3059 
3060  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
3061  goto error;
3062  }
3063 
3064  {
3065  uint8_t octet;
3066  if (!DNP3ReadUint8(buf, len, &octet)) {
3067  goto error;
3068  }
3069  object->online = (octet >> 0) & 0x1;
3070  object->restart = (octet >> 1) & 0x1;
3071  object->comm_lost = (octet >> 2) & 0x1;
3072  object->remote_forced = (octet >> 3) & 0x1;
3073  object->local_forced = (octet >> 4) & 0x1;
3074  object->rollover = (octet >> 5) & 0x1;
3075  object->reserved0 = (octet >> 6) & 0x1;
3076  object->reserved1 = (octet >> 7) & 0x1;
3077  }
3078  if (!DNP3ReadUint16(buf, len, &object->count)) {
3079  goto error;
3080  }
3081 
3082  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
3083  goto error;
3084  }
3085 
3086  object = NULL;
3087  point_index++;
3088  }
3089 
3090  return 1;
3091 error:
3092  if (object != NULL) {
3093  SCFree(object);
3094  }
3095 
3096  return 0;
3097 }
3098 
3099 static int DNP3DecodeObjectG23V5(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
3100  uint32_t start, uint32_t count, DNP3PointList *points)
3101 {
3102  DNP3ObjectG23V5 *object = NULL;
3103  uint32_t prefix = 0;
3104  uint32_t point_index = start;
3105 
3106  if (*len < count/8) {
3107  goto error;
3108  }
3109  while (count--) {
3110 
3111  object = SCCalloc(1, sizeof(*object));
3112  if (unlikely(object == NULL)) {
3113  goto error;
3114  }
3115 
3116  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
3117  goto error;
3118  }
3119 
3120  {
3121  uint8_t octet;
3122  if (!DNP3ReadUint8(buf, len, &octet)) {
3123  goto error;
3124  }
3125  object->online = (octet >> 0) & 0x1;
3126  object->restart = (octet >> 1) & 0x1;
3127  object->comm_lost = (octet >> 2) & 0x1;
3128  object->remote_forced = (octet >> 3) & 0x1;
3129  object->local_forced = (octet >> 4) & 0x1;
3130  object->rollover = (octet >> 5) & 0x1;
3131  object->discontinuity = (octet >> 6) & 0x1;
3132  object->reserved0 = (octet >> 7) & 0x1;
3133  }
3134  if (!DNP3ReadUint32(buf, len, &object->count)) {
3135  goto error;
3136  }
3137  if (!DNP3ReadUint48(buf, len, &object->timestamp)) {
3138  goto error;
3139  }
3140 
3141  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
3142  goto error;
3143  }
3144 
3145  object = NULL;
3146  point_index++;
3147  }
3148 
3149  return 1;
3150 error:
3151  if (object != NULL) {
3152  SCFree(object);
3153  }
3154 
3155  return 0;
3156 }
3157 
3158 static int DNP3DecodeObjectG23V6(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
3159  uint32_t start, uint32_t count, DNP3PointList *points)
3160 {
3161  DNP3ObjectG23V6 *object = NULL;
3162  uint32_t prefix = 0;
3163  uint32_t point_index = start;
3164 
3165  if (*len < count/8) {
3166  goto error;
3167  }
3168  while (count--) {
3169 
3170  object = SCCalloc(1, sizeof(*object));
3171  if (unlikely(object == NULL)) {
3172  goto error;
3173  }
3174 
3175  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
3176  goto error;
3177  }
3178 
3179  {
3180  uint8_t octet;
3181  if (!DNP3ReadUint8(buf, len, &octet)) {
3182  goto error;
3183  }
3184  object->online = (octet >> 0) & 0x1;
3185  object->restart = (octet >> 1) & 0x1;
3186  object->comm_lost = (octet >> 2) & 0x1;
3187  object->remote_forced = (octet >> 3) & 0x1;
3188  object->local_forced = (octet >> 4) & 0x1;
3189  object->rollover = (octet >> 5) & 0x1;
3190  object->discontinuity = (octet >> 6) & 0x1;
3191  object->reserved0 = (octet >> 7) & 0x1;
3192  }
3193  if (!DNP3ReadUint16(buf, len, &object->count)) {
3194  goto error;
3195  }
3196  if (!DNP3ReadUint48(buf, len, &object->timestamp)) {
3197  goto error;
3198  }
3199 
3200  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
3201  goto error;
3202  }
3203 
3204  object = NULL;
3205  point_index++;
3206  }
3207 
3208  return 1;
3209 error:
3210  if (object != NULL) {
3211  SCFree(object);
3212  }
3213 
3214  return 0;
3215 }
3216 
3217 static int DNP3DecodeObjectG23V7(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
3218  uint32_t start, uint32_t count, DNP3PointList *points)
3219 {
3220  DNP3ObjectG23V7 *object = NULL;
3221  uint32_t prefix = 0;
3222  uint32_t point_index = start;
3223 
3224  if (*len < count/8) {
3225  goto error;
3226  }
3227  while (count--) {
3228 
3229  object = SCCalloc(1, sizeof(*object));
3230  if (unlikely(object == NULL)) {
3231  goto error;
3232  }
3233 
3234  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
3235  goto error;
3236  }
3237 
3238  {
3239  uint8_t octet;
3240  if (!DNP3ReadUint8(buf, len, &octet)) {
3241  goto error;
3242  }
3243  object->online = (octet >> 0) & 0x1;
3244  object->restart = (octet >> 1) & 0x1;
3245  object->comm_lost = (octet >> 2) & 0x1;
3246  object->remote_forced = (octet >> 3) & 0x1;
3247  object->local_forced = (octet >> 4) & 0x1;
3248  object->rollover = (octet >> 5) & 0x1;
3249  object->reserved0 = (octet >> 6) & 0x1;
3250  object->reserved1 = (octet >> 7) & 0x1;
3251  }
3252  if (!DNP3ReadUint32(buf, len, &object->count)) {
3253  goto error;
3254  }
3255  if (!DNP3ReadUint48(buf, len, &object->timestamp)) {
3256  goto error;
3257  }
3258 
3259  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
3260  goto error;
3261  }
3262 
3263  object = NULL;
3264  point_index++;
3265  }
3266 
3267  return 1;
3268 error:
3269  if (object != NULL) {
3270  SCFree(object);
3271  }
3272 
3273  return 0;
3274 }
3275 
3276 static int DNP3DecodeObjectG23V8(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
3277  uint32_t start, uint32_t count, DNP3PointList *points)
3278 {
3279  DNP3ObjectG23V8 *object = NULL;
3280  uint32_t prefix = 0;
3281  uint32_t point_index = start;
3282 
3283  if (*len < count/8) {
3284  goto error;
3285  }
3286  while (count--) {
3287 
3288  object = SCCalloc(1, sizeof(*object));
3289  if (unlikely(object == NULL)) {
3290  goto error;
3291  }
3292 
3293  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
3294  goto error;
3295  }
3296 
3297  {
3298  uint8_t octet;
3299  if (!DNP3ReadUint8(buf, len, &octet)) {
3300  goto error;
3301  }
3302  object->online = (octet >> 0) & 0x1;
3303  object->restart = (octet >> 1) & 0x1;
3304  object->comm_lost = (octet >> 2) & 0x1;
3305  object->remote_forced = (octet >> 3) & 0x1;
3306  object->local_forced = (octet >> 4) & 0x1;
3307  object->rollover = (octet >> 5) & 0x1;
3308  object->reserved0 = (octet >> 6) & 0x1;
3309  object->reserved1 = (octet >> 7) & 0x1;
3310  }
3311  if (!DNP3ReadUint16(buf, len, &object->count)) {
3312  goto error;
3313  }
3314  if (!DNP3ReadUint48(buf, len, &object->timestamp)) {
3315  goto error;
3316  }
3317 
3318  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
3319  goto error;
3320  }
3321 
3322  object = NULL;
3323  point_index++;
3324  }
3325 
3326  return 1;
3327 error:
3328  if (object != NULL) {
3329  SCFree(object);
3330  }
3331 
3332  return 0;
3333 }
3334 
3335 static int DNP3DecodeObjectG30V1(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
3336  uint32_t start, uint32_t count, DNP3PointList *points)
3337 {
3338  DNP3ObjectG30V1 *object = NULL;
3339  uint32_t prefix = 0;
3340  uint32_t point_index = start;
3341 
3342  if (*len < count/8) {
3343  goto error;
3344  }
3345  while (count--) {
3346 
3347  object = SCCalloc(1, sizeof(*object));
3348  if (unlikely(object == NULL)) {
3349  goto error;
3350  }
3351 
3352  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
3353  goto error;
3354  }
3355 
3356  {
3357  uint8_t octet;
3358  if (!DNP3ReadUint8(buf, len, &octet)) {
3359  goto error;
3360  }
3361  object->online = (octet >> 0) & 0x1;
3362  object->restart = (octet >> 1) & 0x1;
3363  object->comm_lost = (octet >> 2) & 0x1;
3364  object->remote_forced = (octet >> 3) & 0x1;
3365  object->local_forced = (octet >> 4) & 0x1;
3366  object->over_range = (octet >> 5) & 0x1;
3367  object->reference_err = (octet >> 6) & 0x1;
3368  object->reserved0 = (octet >> 7) & 0x1;
3369  }
3370  if (!DNP3ReadUint32(buf, len, (uint32_t *)&object->value)) {
3371  goto error;
3372  }
3373 
3374  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
3375  goto error;
3376  }
3377 
3378  object = NULL;
3379  point_index++;
3380  }
3381 
3382  return 1;
3383 error:
3384  if (object != NULL) {
3385  SCFree(object);
3386  }
3387 
3388  return 0;
3389 }
3390 
3391 static int DNP3DecodeObjectG30V2(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
3392  uint32_t start, uint32_t count, DNP3PointList *points)
3393 {
3394  DNP3ObjectG30V2 *object = NULL;
3395  uint32_t prefix = 0;
3396  uint32_t point_index = start;
3397 
3398  if (*len < count/8) {
3399  goto error;
3400  }
3401  while (count--) {
3402 
3403  object = SCCalloc(1, sizeof(*object));
3404  if (unlikely(object == NULL)) {
3405  goto error;
3406  }
3407 
3408  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
3409  goto error;
3410  }
3411 
3412  {
3413  uint8_t octet;
3414  if (!DNP3ReadUint8(buf, len, &octet)) {
3415  goto error;
3416  }
3417  object->online = (octet >> 0) & 0x1;
3418  object->restart = (octet >> 1) & 0x1;
3419  object->comm_lost = (octet >> 2) & 0x1;
3420  object->remote_forced = (octet >> 3) & 0x1;
3421  object->local_forced = (octet >> 4) & 0x1;
3422  object->over_range = (octet >> 5) & 0x1;
3423  object->reference_err = (octet >> 6) & 0x1;
3424  object->reserved0 = (octet >> 7) & 0x1;
3425  }
3426  if (!DNP3ReadUint16(buf, len, (uint16_t *)&object->value)) {
3427  goto error;
3428  }
3429 
3430  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
3431  goto error;
3432  }
3433 
3434  object = NULL;
3435  point_index++;
3436  }
3437 
3438  return 1;
3439 error:
3440  if (object != NULL) {
3441  SCFree(object);
3442  }
3443 
3444  return 0;
3445 }
3446 
3447 static int DNP3DecodeObjectG30V3(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
3448  uint32_t start, uint32_t count, DNP3PointList *points)
3449 {
3450  DNP3ObjectG30V3 *object = NULL;
3451  uint32_t prefix = 0;
3452  uint32_t point_index = start;
3453 
3454  if (*len < count/8) {
3455  goto error;
3456  }
3457  while (count--) {
3458 
3459  object = SCCalloc(1, sizeof(*object));
3460  if (unlikely(object == NULL)) {
3461  goto error;
3462  }
3463 
3464  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
3465  goto error;
3466  }
3467 
3468  if (!DNP3ReadUint32(buf, len, (uint32_t *)&object->value)) {
3469  goto error;
3470  }
3471 
3472  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
3473  goto error;
3474  }
3475 
3476  object = NULL;
3477  point_index++;
3478  }
3479 
3480  return 1;
3481 error:
3482  if (object != NULL) {
3483  SCFree(object);
3484  }
3485 
3486  return 0;
3487 }
3488 
3489 static int DNP3DecodeObjectG30V4(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
3490  uint32_t start, uint32_t count, DNP3PointList *points)
3491 {
3492  DNP3ObjectG30V4 *object = NULL;
3493  uint32_t prefix = 0;
3494  uint32_t point_index = start;
3495 
3496  if (*len < count/8) {
3497  goto error;
3498  }
3499  while (count--) {
3500 
3501  object = SCCalloc(1, sizeof(*object));
3502  if (unlikely(object == NULL)) {
3503  goto error;
3504  }
3505 
3506  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
3507  goto error;
3508  }
3509 
3510  if (!DNP3ReadUint16(buf, len, (uint16_t *)&object->value)) {
3511  goto error;
3512  }
3513 
3514  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
3515  goto error;
3516  }
3517 
3518  object = NULL;
3519  point_index++;
3520  }
3521 
3522  return 1;
3523 error:
3524  if (object != NULL) {
3525  SCFree(object);
3526  }
3527 
3528  return 0;
3529 }
3530 
3531 static int DNP3DecodeObjectG30V5(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
3532  uint32_t start, uint32_t count, DNP3PointList *points)
3533 {
3534  DNP3ObjectG30V5 *object = NULL;
3535  uint32_t prefix = 0;
3536  uint32_t point_index = start;
3537 
3538  if (*len < count/8) {
3539  goto error;
3540  }
3541  while (count--) {
3542 
3543  object = SCCalloc(1, sizeof(*object));
3544  if (unlikely(object == NULL)) {
3545  goto error;
3546  }
3547 
3548  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
3549  goto error;
3550  }
3551 
3552  {
3553  uint8_t octet;
3554  if (!DNP3ReadUint8(buf, len, &octet)) {
3555  goto error;
3556  }
3557  object->online = (octet >> 0) & 0x1;
3558  object->restart = (octet >> 1) & 0x1;
3559  object->comm_lost = (octet >> 2) & 0x1;
3560  object->remote_forced = (octet >> 3) & 0x1;
3561  object->local_forced = (octet >> 4) & 0x1;
3562  object->over_range = (octet >> 5) & 0x1;
3563  object->reference_err = (octet >> 6) & 0x1;
3564  object->reserved0 = (octet >> 7) & 0x1;
3565  }
3566  if (!DNP3ReadFloat32(buf, len, &object->value)) {
3567  goto error;
3568  }
3569 
3570  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
3571  goto error;
3572  }
3573 
3574  object = NULL;
3575  point_index++;
3576  }
3577 
3578  return 1;
3579 error:
3580  if (object != NULL) {
3581  SCFree(object);
3582  }
3583 
3584  return 0;
3585 }
3586 
3587 static int DNP3DecodeObjectG30V6(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
3588  uint32_t start, uint32_t count, DNP3PointList *points)
3589 {
3590  DNP3ObjectG30V6 *object = NULL;
3591  uint32_t prefix = 0;
3592  uint32_t point_index = start;
3593 
3594  if (*len < count/8) {
3595  goto error;
3596  }
3597  while (count--) {
3598 
3599  object = SCCalloc(1, sizeof(*object));
3600  if (unlikely(object == NULL)) {
3601  goto error;
3602  }
3603 
3604  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
3605  goto error;
3606  }
3607 
3608  {
3609  uint8_t octet;
3610  if (!DNP3ReadUint8(buf, len, &octet)) {
3611  goto error;
3612  }
3613  object->online = (octet >> 0) & 0x1;
3614  object->restart = (octet >> 1) & 0x1;
3615  object->comm_lost = (octet >> 2) & 0x1;
3616  object->remote_forced = (octet >> 3) & 0x1;
3617  object->local_forced = (octet >> 4) & 0x1;
3618  object->over_range = (octet >> 5) & 0x1;
3619  object->reference_err = (octet >> 6) & 0x1;
3620  object->reserved0 = (octet >> 7) & 0x1;
3621  }
3622  if (!DNP3ReadFloat64(buf, len, &object->value)) {
3623  goto error;
3624  }
3625 
3626  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
3627  goto error;
3628  }
3629 
3630  object = NULL;
3631  point_index++;
3632  }
3633 
3634  return 1;
3635 error:
3636  if (object != NULL) {
3637  SCFree(object);
3638  }
3639 
3640  return 0;
3641 }
3642 
3643 static int DNP3DecodeObjectG31V1(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
3644  uint32_t start, uint32_t count, DNP3PointList *points)
3645 {
3646  DNP3ObjectG31V1 *object = NULL;
3647  uint32_t prefix = 0;
3648  uint32_t point_index = start;
3649 
3650  if (*len < count/8) {
3651  goto error;
3652  }
3653  while (count--) {
3654 
3655  object = SCCalloc(1, sizeof(*object));
3656  if (unlikely(object == NULL)) {
3657  goto error;
3658  }
3659 
3660  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
3661  goto error;
3662  }
3663 
3664  {
3665  uint8_t octet;
3666  if (!DNP3ReadUint8(buf, len, &octet)) {
3667  goto error;
3668  }
3669  object->online = (octet >> 0) & 0x1;
3670  object->restart = (octet >> 1) & 0x1;
3671  object->comm_lost = (octet >> 2) & 0x1;
3672  object->remote_forced = (octet >> 3) & 0x1;
3673  object->local_forced = (octet >> 4) & 0x1;
3674  object->over_range = (octet >> 5) & 0x1;
3675  object->reference_err = (octet >> 6) & 0x1;
3676  object->reserved0 = (octet >> 7) & 0x1;
3677  }
3678  if (!DNP3ReadUint32(buf, len, (uint32_t *)&object->value)) {
3679  goto error;
3680  }
3681 
3682  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
3683  goto error;
3684  }
3685 
3686  object = NULL;
3687  point_index++;
3688  }
3689 
3690  return 1;
3691 error:
3692  if (object != NULL) {
3693  SCFree(object);
3694  }
3695 
3696  return 0;
3697 }
3698 
3699 static int DNP3DecodeObjectG31V2(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
3700  uint32_t start, uint32_t count, DNP3PointList *points)
3701 {
3702  DNP3ObjectG31V2 *object = NULL;
3703  uint32_t prefix = 0;
3704  uint32_t point_index = start;
3705 
3706  if (*len < count/8) {
3707  goto error;
3708  }
3709  while (count--) {
3710 
3711  object = SCCalloc(1, sizeof(*object));
3712  if (unlikely(object == NULL)) {
3713  goto error;
3714  }
3715 
3716  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
3717  goto error;
3718  }
3719 
3720  {
3721  uint8_t octet;
3722  if (!DNP3ReadUint8(buf, len, &octet)) {
3723  goto error;
3724  }
3725  object->online = (octet >> 0) & 0x1;
3726  object->restart = (octet >> 1) & 0x1;
3727  object->comm_lost = (octet >> 2) & 0x1;
3728  object->remote_forced = (octet >> 3) & 0x1;
3729  object->local_forced = (octet >> 4) & 0x1;
3730  object->over_range = (octet >> 5) & 0x1;
3731  object->reference_err = (octet >> 6) & 0x1;
3732  object->reserved0 = (octet >> 7) & 0x1;
3733  }
3734  if (!DNP3ReadUint16(buf, len, (uint16_t *)&object->value)) {
3735  goto error;
3736  }
3737 
3738  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
3739  goto error;
3740  }
3741 
3742  object = NULL;
3743  point_index++;
3744  }
3745 
3746  return 1;
3747 error:
3748  if (object != NULL) {
3749  SCFree(object);
3750  }
3751 
3752  return 0;
3753 }
3754 
3755 static int DNP3DecodeObjectG31V3(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
3756  uint32_t start, uint32_t count, DNP3PointList *points)
3757 {
3758  DNP3ObjectG31V3 *object = NULL;
3759  uint32_t prefix = 0;
3760  uint32_t point_index = start;
3761 
3762  if (*len < count/8) {
3763  goto error;
3764  }
3765  while (count--) {
3766 
3767  object = SCCalloc(1, sizeof(*object));
3768  if (unlikely(object == NULL)) {
3769  goto error;
3770  }
3771 
3772  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
3773  goto error;
3774  }
3775 
3776  {
3777  uint8_t octet;
3778  if (!DNP3ReadUint8(buf, len, &octet)) {
3779  goto error;
3780  }
3781  object->online = (octet >> 0) & 0x1;
3782  object->restart = (octet >> 1) & 0x1;
3783  object->comm_lost = (octet >> 2) & 0x1;
3784  object->remote_forced = (octet >> 3) & 0x1;
3785  object->local_forced = (octet >> 4) & 0x1;
3786  object->over_range = (octet >> 5) & 0x1;
3787  object->reference_err = (octet >> 6) & 0x1;
3788  object->reserved0 = (octet >> 7) & 0x1;
3789  }
3790  if (!DNP3ReadUint32(buf, len, (uint32_t *)&object->value)) {
3791  goto error;
3792  }
3793  if (!DNP3ReadUint48(buf, len, &object->timestamp)) {
3794  goto error;
3795  }
3796 
3797  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
3798  goto error;
3799  }
3800 
3801  object = NULL;
3802  point_index++;
3803  }
3804 
3805  return 1;
3806 error:
3807  if (object != NULL) {
3808  SCFree(object);
3809  }
3810 
3811  return 0;
3812 }
3813 
3814 static int DNP3DecodeObjectG31V4(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
3815  uint32_t start, uint32_t count, DNP3PointList *points)
3816 {
3817  DNP3ObjectG31V4 *object = NULL;
3818  uint32_t prefix = 0;
3819  uint32_t point_index = start;
3820 
3821  if (*len < count/8) {
3822  goto error;
3823  }
3824  while (count--) {
3825 
3826  object = SCCalloc(1, sizeof(*object));
3827  if (unlikely(object == NULL)) {
3828  goto error;
3829  }
3830 
3831  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
3832  goto error;
3833  }
3834 
3835  {
3836  uint8_t octet;
3837  if (!DNP3ReadUint8(buf, len, &octet)) {
3838  goto error;
3839  }
3840  object->online = (octet >> 0) & 0x1;
3841  object->restart = (octet >> 1) & 0x1;
3842  object->comm_lost = (octet >> 2) & 0x1;
3843  object->remote_forced = (octet >> 3) & 0x1;
3844  object->local_forced = (octet >> 4) & 0x1;
3845  object->over_range = (octet >> 5) & 0x1;
3846  object->reference_err = (octet >> 6) & 0x1;
3847  object->reserved0 = (octet >> 7) & 0x1;
3848  }
3849  if (!DNP3ReadUint16(buf, len, (uint16_t *)&object->value)) {
3850  goto error;
3851  }
3852  if (!DNP3ReadUint48(buf, len, &object->timestamp)) {
3853  goto error;
3854  }
3855 
3856  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
3857  goto error;
3858  }
3859 
3860  object = NULL;
3861  point_index++;
3862  }
3863 
3864  return 1;
3865 error:
3866  if (object != NULL) {
3867  SCFree(object);
3868  }
3869 
3870  return 0;
3871 }
3872 
3873 static int DNP3DecodeObjectG31V5(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
3874  uint32_t start, uint32_t count, DNP3PointList *points)
3875 {
3876  DNP3ObjectG31V5 *object = NULL;
3877  uint32_t prefix = 0;
3878  uint32_t point_index = start;
3879 
3880  if (*len < count/8) {
3881  goto error;
3882  }
3883  while (count--) {
3884 
3885  object = SCCalloc(1, sizeof(*object));
3886  if (unlikely(object == NULL)) {
3887  goto error;
3888  }
3889 
3890  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
3891  goto error;
3892  }
3893 
3894  if (!DNP3ReadUint32(buf, len, (uint32_t *)&object->value)) {
3895  goto error;
3896  }
3897 
3898  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
3899  goto error;
3900  }
3901 
3902  object = NULL;
3903  point_index++;
3904  }
3905 
3906  return 1;
3907 error:
3908  if (object != NULL) {
3909  SCFree(object);
3910  }
3911 
3912  return 0;
3913 }
3914 
3915 static int DNP3DecodeObjectG31V6(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
3916  uint32_t start, uint32_t count, DNP3PointList *points)
3917 {
3918  DNP3ObjectG31V6 *object = NULL;
3919  uint32_t prefix = 0;
3920  uint32_t point_index = start;
3921 
3922  if (*len < count/8) {
3923  goto error;
3924  }
3925  while (count--) {
3926 
3927  object = SCCalloc(1, sizeof(*object));
3928  if (unlikely(object == NULL)) {
3929  goto error;
3930  }
3931 
3932  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
3933  goto error;
3934  }
3935 
3936  if (!DNP3ReadUint16(buf, len, (uint16_t *)&object->value)) {
3937  goto error;
3938  }
3939 
3940  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
3941  goto error;
3942  }
3943 
3944  object = NULL;
3945  point_index++;
3946  }
3947 
3948  return 1;
3949 error:
3950  if (object != NULL) {
3951  SCFree(object);
3952  }
3953 
3954  return 0;
3955 }
3956 
3957 static int DNP3DecodeObjectG31V7(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
3958  uint32_t start, uint32_t count, DNP3PointList *points)
3959 {
3960  DNP3ObjectG31V7 *object = NULL;
3961  uint32_t prefix = 0;
3962  uint32_t point_index = start;
3963 
3964  if (*len < count/8) {
3965  goto error;
3966  }
3967  while (count--) {
3968 
3969  object = SCCalloc(1, sizeof(*object));
3970  if (unlikely(object == NULL)) {
3971  goto error;
3972  }
3973 
3974  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
3975  goto error;
3976  }
3977 
3978  {
3979  uint8_t octet;
3980  if (!DNP3ReadUint8(buf, len, &octet)) {
3981  goto error;
3982  }
3983  object->online = (octet >> 0) & 0x1;
3984  object->restart = (octet >> 1) & 0x1;
3985  object->comm_lost = (octet >> 2) & 0x1;
3986  object->remote_forced = (octet >> 3) & 0x1;
3987  object->local_forced = (octet >> 4) & 0x1;
3988  object->over_range = (octet >> 5) & 0x1;
3989  object->reference_err = (octet >> 6) & 0x1;
3990  object->reserved0 = (octet >> 7) & 0x1;
3991  }
3992  if (!DNP3ReadFloat32(buf, len, &object->value)) {
3993  goto error;
3994  }
3995 
3996  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
3997  goto error;
3998  }
3999 
4000  object = NULL;
4001  point_index++;
4002  }
4003 
4004  return 1;
4005 error:
4006  if (object != NULL) {
4007  SCFree(object);
4008  }
4009 
4010  return 0;
4011 }
4012 
4013 static int DNP3DecodeObjectG31V8(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
4014  uint32_t start, uint32_t count, DNP3PointList *points)
4015 {
4016  DNP3ObjectG31V8 *object = NULL;
4017  uint32_t prefix = 0;
4018  uint32_t point_index = start;
4019 
4020  if (*len < count/8) {
4021  goto error;
4022  }
4023  while (count--) {
4024 
4025  object = SCCalloc(1, sizeof(*object));
4026  if (unlikely(object == NULL)) {
4027  goto error;
4028  }
4029 
4030  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
4031  goto error;
4032  }
4033 
4034  {
4035  uint8_t octet;
4036  if (!DNP3ReadUint8(buf, len, &octet)) {
4037  goto error;
4038  }
4039  object->online = (octet >> 0) & 0x1;
4040  object->restart = (octet >> 1) & 0x1;
4041  object->comm_lost = (octet >> 2) & 0x1;
4042  object->remote_forced = (octet >> 3) & 0x1;
4043  object->local_forced = (octet >> 4) & 0x1;
4044  object->over_range = (octet >> 5) & 0x1;
4045  object->reference_err = (octet >> 6) & 0x1;
4046  object->reserved0 = (octet >> 7) & 0x1;
4047  }
4048  if (!DNP3ReadFloat64(buf, len, &object->value)) {
4049  goto error;
4050  }
4051 
4052  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
4053  goto error;
4054  }
4055 
4056  object = NULL;
4057  point_index++;
4058  }
4059 
4060  return 1;
4061 error:
4062  if (object != NULL) {
4063  SCFree(object);
4064  }
4065 
4066  return 0;
4067 }
4068 
4069 static int DNP3DecodeObjectG32V1(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
4070  uint32_t start, uint32_t count, DNP3PointList *points)
4071 {
4072  DNP3ObjectG32V1 *object = NULL;
4073  uint32_t prefix = 0;
4074  uint32_t point_index = start;
4075 
4076  if (*len < count/8) {
4077  goto error;
4078  }
4079  while (count--) {
4080 
4081  object = SCCalloc(1, sizeof(*object));
4082  if (unlikely(object == NULL)) {
4083  goto error;
4084  }
4085 
4086  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
4087  goto error;
4088  }
4089 
4090  {
4091  uint8_t octet;
4092  if (!DNP3ReadUint8(buf, len, &octet)) {
4093  goto error;
4094  }
4095  object->online = (octet >> 0) & 0x1;
4096  object->restart = (octet >> 1) & 0x1;
4097  object->comm_lost = (octet >> 2) & 0x1;
4098  object->remote_forced = (octet >> 3) & 0x1;
4099  object->local_forced = (octet >> 4) & 0x1;
4100  object->over_range = (octet >> 5) & 0x1;
4101  object->reference_err = (octet >> 6) & 0x1;
4102  object->reserved0 = (octet >> 7) & 0x1;
4103  }
4104  if (!DNP3ReadUint32(buf, len, (uint32_t *)&object->value)) {
4105  goto error;
4106  }
4107 
4108  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
4109  goto error;
4110  }
4111 
4112  object = NULL;
4113  point_index++;
4114  }
4115 
4116  return 1;
4117 error:
4118  if (object != NULL) {
4119  SCFree(object);
4120  }
4121 
4122  return 0;
4123 }
4124 
4125 static int DNP3DecodeObjectG32V2(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
4126  uint32_t start, uint32_t count, DNP3PointList *points)
4127 {
4128  DNP3ObjectG32V2 *object = NULL;
4129  uint32_t prefix = 0;
4130  uint32_t point_index = start;
4131 
4132  if (*len < count/8) {
4133  goto error;
4134  }
4135  while (count--) {
4136 
4137  object = SCCalloc(1, sizeof(*object));
4138  if (unlikely(object == NULL)) {
4139  goto error;
4140  }
4141 
4142  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
4143  goto error;
4144  }
4145 
4146  {
4147  uint8_t octet;
4148  if (!DNP3ReadUint8(buf, len, &octet)) {
4149  goto error;
4150  }
4151  object->online = (octet >> 0) & 0x1;
4152  object->restart = (octet >> 1) & 0x1;
4153  object->comm_lost = (octet >> 2) & 0x1;
4154  object->remote_forced = (octet >> 3) & 0x1;
4155  object->local_forced = (octet >> 4) & 0x1;
4156  object->over_range = (octet >> 5) & 0x1;
4157  object->reference_err = (octet >> 6) & 0x1;
4158  object->reserved0 = (octet >> 7) & 0x1;
4159  }
4160  if (!DNP3ReadUint16(buf, len, (uint16_t *)&object->value)) {
4161  goto error;
4162  }
4163 
4164  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
4165  goto error;
4166  }
4167 
4168  object = NULL;
4169  point_index++;
4170  }
4171 
4172  return 1;
4173 error:
4174  if (object != NULL) {
4175  SCFree(object);
4176  }
4177 
4178  return 0;
4179 }
4180 
4181 static int DNP3DecodeObjectG32V3(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
4182  uint32_t start, uint32_t count, DNP3PointList *points)
4183 {
4184  DNP3ObjectG32V3 *object = NULL;
4185  uint32_t prefix = 0;
4186  uint32_t point_index = start;
4187 
4188  if (*len < count/8) {
4189  goto error;
4190  }
4191  while (count--) {
4192 
4193  object = SCCalloc(1, sizeof(*object));
4194  if (unlikely(object == NULL)) {
4195  goto error;
4196  }
4197 
4198  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
4199  goto error;
4200  }
4201 
4202  {
4203  uint8_t octet;
4204  if (!DNP3ReadUint8(buf, len, &octet)) {
4205  goto error;
4206  }
4207  object->online = (octet >> 0) & 0x1;
4208  object->restart = (octet >> 1) & 0x1;
4209  object->comm_lost = (octet >> 2) & 0x1;
4210  object->remote_forced = (octet >> 3) & 0x1;
4211  object->local_forced = (octet >> 4) & 0x1;
4212  object->over_range = (octet >> 5) & 0x1;
4213  object->reference_err = (octet >> 6) & 0x1;
4214  object->reserved0 = (octet >> 7) & 0x1;
4215  }
4216  if (!DNP3ReadUint32(buf, len, (uint32_t *)&object->value)) {
4217  goto error;
4218  }
4219  if (!DNP3ReadUint48(buf, len, &object->timestamp)) {
4220  goto error;
4221  }
4222 
4223  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
4224  goto error;
4225  }
4226 
4227  object = NULL;
4228  point_index++;
4229  }
4230 
4231  return 1;
4232 error:
4233  if (object != NULL) {
4234  SCFree(object);
4235  }
4236 
4237  return 0;
4238 }
4239 
4240 static int DNP3DecodeObjectG32V4(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
4241  uint32_t start, uint32_t count, DNP3PointList *points)
4242 {
4243  DNP3ObjectG32V4 *object = NULL;
4244  uint32_t prefix = 0;
4245  uint32_t point_index = start;
4246 
4247  if (*len < count/8) {
4248  goto error;
4249  }
4250  while (count--) {
4251 
4252  object = SCCalloc(1, sizeof(*object));
4253  if (unlikely(object == NULL)) {
4254  goto error;
4255  }
4256 
4257  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
4258  goto error;
4259  }
4260 
4261  {
4262  uint8_t octet;
4263  if (!DNP3ReadUint8(buf, len, &octet)) {
4264  goto error;
4265  }
4266  object->online = (octet >> 0) & 0x1;
4267  object->restart = (octet >> 1) & 0x1;
4268  object->comm_lost = (octet >> 2) & 0x1;
4269  object->remote_forced = (octet >> 3) & 0x1;
4270  object->local_forced = (octet >> 4) & 0x1;
4271  object->over_range = (octet >> 5) & 0x1;
4272  object->reference_err = (octet >> 6) & 0x1;
4273  object->reserved0 = (octet >> 7) & 0x1;
4274  }
4275  if (!DNP3ReadUint16(buf, len, (uint16_t *)&object->value)) {
4276  goto error;
4277  }
4278  if (!DNP3ReadUint48(buf, len, &object->timestamp)) {
4279  goto error;
4280  }
4281 
4282  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
4283  goto error;
4284  }
4285 
4286  object = NULL;
4287  point_index++;
4288  }
4289 
4290  return 1;
4291 error:
4292  if (object != NULL) {
4293  SCFree(object);
4294  }
4295 
4296  return 0;
4297 }
4298 
4299 static int DNP3DecodeObjectG32V5(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
4300  uint32_t start, uint32_t count, DNP3PointList *points)
4301 {
4302  DNP3ObjectG32V5 *object = NULL;
4303  uint32_t prefix = 0;
4304  uint32_t point_index = start;
4305 
4306  if (*len < count/8) {
4307  goto error;
4308  }
4309  while (count--) {
4310 
4311  object = SCCalloc(1, sizeof(*object));
4312  if (unlikely(object == NULL)) {
4313  goto error;
4314  }
4315 
4316  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
4317  goto error;
4318  }
4319 
4320  {
4321  uint8_t octet;
4322  if (!DNP3ReadUint8(buf, len, &octet)) {
4323  goto error;
4324  }
4325  object->online = (octet >> 0) & 0x1;
4326  object->restart = (octet >> 1) & 0x1;
4327  object->comm_lost = (octet >> 2) & 0x1;
4328  object->remote_forced = (octet >> 3) & 0x1;
4329  object->local_forced = (octet >> 4) & 0x1;
4330  object->over_range = (octet >> 5) & 0x1;
4331  object->reference_err = (octet >> 6) & 0x1;
4332  object->reserved0 = (octet >> 7) & 0x1;
4333  }
4334  if (!DNP3ReadFloat32(buf, len, &object->value)) {
4335  goto error;
4336  }
4337 
4338  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
4339  goto error;
4340  }
4341 
4342  object = NULL;
4343  point_index++;
4344  }
4345 
4346  return 1;
4347 error:
4348  if (object != NULL) {
4349  SCFree(object);
4350  }
4351 
4352  return 0;
4353 }
4354 
4355 static int DNP3DecodeObjectG32V6(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
4356  uint32_t start, uint32_t count, DNP3PointList *points)
4357 {
4358  DNP3ObjectG32V6 *object = NULL;
4359  uint32_t prefix = 0;
4360  uint32_t point_index = start;
4361 
4362  if (*len < count/8) {
4363  goto error;
4364  }
4365  while (count--) {
4366 
4367  object = SCCalloc(1, sizeof(*object));
4368  if (unlikely(object == NULL)) {
4369  goto error;
4370  }
4371 
4372  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
4373  goto error;
4374  }
4375 
4376  {
4377  uint8_t octet;
4378  if (!DNP3ReadUint8(buf, len, &octet)) {
4379  goto error;
4380  }
4381  object->online = (octet >> 0) & 0x1;
4382  object->restart = (octet >> 1) & 0x1;
4383  object->comm_lost = (octet >> 2) & 0x1;
4384  object->remote_forced = (octet >> 3) & 0x1;
4385  object->local_forced = (octet >> 4) & 0x1;
4386  object->over_range = (octet >> 5) & 0x1;
4387  object->reference_err = (octet >> 6) & 0x1;
4388  object->reserved0 = (octet >> 7) & 0x1;
4389  }
4390  if (!DNP3ReadFloat64(buf, len, &object->value)) {
4391  goto error;
4392  }
4393 
4394  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
4395  goto error;
4396  }
4397 
4398  object = NULL;
4399  point_index++;
4400  }
4401 
4402  return 1;
4403 error:
4404  if (object != NULL) {
4405  SCFree(object);
4406  }
4407 
4408  return 0;
4409 }
4410 
4411 static int DNP3DecodeObjectG32V7(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
4412  uint32_t start, uint32_t count, DNP3PointList *points)
4413 {
4414  DNP3ObjectG32V7 *object = NULL;
4415  uint32_t prefix = 0;
4416  uint32_t point_index = start;
4417 
4418  if (*len < count/8) {
4419  goto error;
4420  }
4421  while (count--) {
4422 
4423  object = SCCalloc(1, sizeof(*object));
4424  if (unlikely(object == NULL)) {
4425  goto error;
4426  }
4427 
4428  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
4429  goto error;
4430  }
4431 
4432  {
4433  uint8_t octet;
4434  if (!DNP3ReadUint8(buf, len, &octet)) {
4435  goto error;
4436  }
4437  object->online = (octet >> 0) & 0x1;
4438  object->restart = (octet >> 1) & 0x1;
4439  object->comm_lost = (octet >> 2) & 0x1;
4440  object->remote_forced = (octet >> 3) & 0x1;
4441  object->local_forced = (octet >> 4) & 0x1;
4442  object->over_range = (octet >> 5) & 0x1;
4443  object->reference_err = (octet >> 6) & 0x1;
4444  object->reserved0 = (octet >> 7) & 0x1;
4445  }
4446  if (!DNP3ReadFloat32(buf, len, &object->value)) {
4447  goto error;
4448  }
4449  if (!DNP3ReadUint48(buf, len, &object->timestamp)) {
4450  goto error;
4451  }
4452 
4453  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
4454  goto error;
4455  }
4456 
4457  object = NULL;
4458  point_index++;
4459  }
4460 
4461  return 1;
4462 error:
4463  if (object != NULL) {
4464  SCFree(object);
4465  }
4466 
4467  return 0;
4468 }
4469 
4470 static int DNP3DecodeObjectG32V8(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
4471  uint32_t start, uint32_t count, DNP3PointList *points)
4472 {
4473  DNP3ObjectG32V8 *object = NULL;
4474  uint32_t prefix = 0;
4475  uint32_t point_index = start;
4476 
4477  if (*len < count/8) {
4478  goto error;
4479  }
4480  while (count--) {
4481 
4482  object = SCCalloc(1, sizeof(*object));
4483  if (unlikely(object == NULL)) {
4484  goto error;
4485  }
4486 
4487  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
4488  goto error;
4489  }
4490 
4491  {
4492  uint8_t octet;
4493  if (!DNP3ReadUint8(buf, len, &octet)) {
4494  goto error;
4495  }
4496  object->online = (octet >> 0) & 0x1;
4497  object->restart = (octet >> 1) & 0x1;
4498  object->comm_lost = (octet >> 2) & 0x1;
4499  object->remote_forced = (octet >> 3) & 0x1;
4500  object->local_forced = (octet >> 4) & 0x1;
4501  object->over_range = (octet >> 5) & 0x1;
4502  object->reference_err = (octet >> 6) & 0x1;
4503  object->reserved0 = (octet >> 7) & 0x1;
4504  }
4505  if (!DNP3ReadFloat64(buf, len, &object->value)) {
4506  goto error;
4507  }
4508  if (!DNP3ReadUint48(buf, len, &object->timestamp)) {
4509  goto error;
4510  }
4511 
4512  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
4513  goto error;
4514  }
4515 
4516  object = NULL;
4517  point_index++;
4518  }
4519 
4520  return 1;
4521 error:
4522  if (object != NULL) {
4523  SCFree(object);
4524  }
4525 
4526  return 0;
4527 }
4528 
4529 static int DNP3DecodeObjectG33V1(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
4530  uint32_t start, uint32_t count, DNP3PointList *points)
4531 {
4532  DNP3ObjectG33V1 *object = NULL;
4533  uint32_t prefix = 0;
4534  uint32_t point_index = start;
4535 
4536  if (*len < count/8) {
4537  goto error;
4538  }
4539  while (count--) {
4540 
4541  object = SCCalloc(1, sizeof(*object));
4542  if (unlikely(object == NULL)) {
4543  goto error;
4544  }
4545 
4546  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
4547  goto error;
4548  }
4549 
4550  {
4551  uint8_t octet;
4552  if (!DNP3ReadUint8(buf, len, &octet)) {
4553  goto error;
4554  }
4555  object->online = (octet >> 0) & 0x1;
4556  object->restart = (octet >> 1) & 0x1;
4557  object->comm_lost = (octet >> 2) & 0x1;
4558  object->remote_forced = (octet >> 3) & 0x1;
4559  object->local_forced = (octet >> 4) & 0x1;
4560  object->over_range = (octet >> 5) & 0x1;
4561  object->reference_err = (octet >> 6) & 0x1;
4562  object->reserved0 = (octet >> 7) & 0x1;
4563  }
4564  if (!DNP3ReadUint32(buf, len, (uint32_t *)&object->value)) {
4565  goto error;
4566  }
4567 
4568  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
4569  goto error;
4570  }
4571 
4572  object = NULL;
4573  point_index++;
4574  }
4575 
4576  return 1;
4577 error:
4578  if (object != NULL) {
4579  SCFree(object);
4580  }
4581 
4582  return 0;
4583 }
4584 
4585 static int DNP3DecodeObjectG33V2(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
4586  uint32_t start, uint32_t count, DNP3PointList *points)
4587 {
4588  DNP3ObjectG33V2 *object = NULL;
4589  uint32_t prefix = 0;
4590  uint32_t point_index = start;
4591 
4592  if (*len < count/8) {
4593  goto error;
4594  }
4595  while (count--) {
4596 
4597  object = SCCalloc(1, sizeof(*object));
4598  if (unlikely(object == NULL)) {
4599  goto error;
4600  }
4601 
4602  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
4603  goto error;
4604  }
4605 
4606  {
4607  uint8_t octet;
4608  if (!DNP3ReadUint8(buf, len, &octet)) {
4609  goto error;
4610  }
4611  object->online = (octet >> 0) & 0x1;
4612  object->restart = (octet >> 1) & 0x1;
4613  object->comm_lost = (octet >> 2) & 0x1;
4614  object->remote_forced = (octet >> 3) & 0x1;
4615  object->local_forced = (octet >> 4) & 0x1;
4616  object->over_range = (octet >> 5) & 0x1;
4617  object->reference_err = (octet >> 6) & 0x1;
4618  object->reserved0 = (octet >> 7) & 0x1;
4619  }
4620  if (!DNP3ReadUint16(buf, len, (uint16_t *)&object->value)) {
4621  goto error;
4622  }
4623 
4624  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
4625  goto error;
4626  }
4627 
4628  object = NULL;
4629  point_index++;
4630  }
4631 
4632  return 1;
4633 error:
4634  if (object != NULL) {
4635  SCFree(object);
4636  }
4637 
4638  return 0;
4639 }
4640 
4641 static int DNP3DecodeObjectG33V3(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
4642  uint32_t start, uint32_t count, DNP3PointList *points)
4643 {
4644  DNP3ObjectG33V3 *object = NULL;
4645  uint32_t prefix = 0;
4646  uint32_t point_index = start;
4647 
4648  if (*len < count/8) {
4649  goto error;
4650  }
4651  while (count--) {
4652 
4653  object = SCCalloc(1, sizeof(*object));
4654  if (unlikely(object == NULL)) {
4655  goto error;
4656  }
4657 
4658  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
4659  goto error;
4660  }
4661 
4662  {
4663  uint8_t octet;
4664  if (!DNP3ReadUint8(buf, len, &octet)) {
4665  goto error;
4666  }
4667  object->online = (octet >> 0) & 0x1;
4668  object->restart = (octet >> 1) & 0x1;
4669  object->comm_lost = (octet >> 2) & 0x1;
4670  object->remote_forced = (octet >> 3) & 0x1;
4671  object->local_forced = (octet >> 4) & 0x1;
4672  object->over_range = (octet >> 5) & 0x1;
4673  object->reference_err = (octet >> 6) & 0x1;
4674  object->reserved0 = (octet >> 7) & 0x1;
4675  }
4676  if (!DNP3ReadUint32(buf, len, (uint32_t *)&object->value)) {
4677  goto error;
4678  }
4679  if (!DNP3ReadUint48(buf, len, &object->timestamp)) {
4680  goto error;
4681  }
4682 
4683  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
4684  goto error;
4685  }
4686 
4687  object = NULL;
4688  point_index++;
4689  }
4690 
4691  return 1;
4692 error:
4693  if (object != NULL) {
4694  SCFree(object);
4695  }
4696 
4697  return 0;
4698 }
4699 
4700 static int DNP3DecodeObjectG33V4(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
4701  uint32_t start, uint32_t count, DNP3PointList *points)
4702 {
4703  DNP3ObjectG33V4 *object = NULL;
4704  uint32_t prefix = 0;
4705  uint32_t point_index = start;
4706 
4707  if (*len < count/8) {
4708  goto error;
4709  }
4710  while (count--) {
4711 
4712  object = SCCalloc(1, sizeof(*object));
4713  if (unlikely(object == NULL)) {
4714  goto error;
4715  }
4716 
4717  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
4718  goto error;
4719  }
4720 
4721  {
4722  uint8_t octet;
4723  if (!DNP3ReadUint8(buf, len, &octet)) {
4724  goto error;
4725  }
4726  object->online = (octet >> 0) & 0x1;
4727  object->restart = (octet >> 1) & 0x1;
4728  object->comm_lost = (octet >> 2) & 0x1;
4729  object->remote_forced = (octet >> 3) & 0x1;
4730  object->local_forced = (octet >> 4) & 0x1;
4731  object->over_range = (octet >> 5) & 0x1;
4732  object->reference_err = (octet >> 6) & 0x1;
4733  object->reserved0 = (octet >> 7) & 0x1;
4734  }
4735  if (!DNP3ReadUint16(buf, len, (uint16_t *)&object->value)) {
4736  goto error;
4737  }
4738  if (!DNP3ReadUint48(buf, len, &object->timestamp)) {
4739  goto error;
4740  }
4741 
4742  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
4743  goto error;
4744  }
4745 
4746  object = NULL;
4747  point_index++;
4748  }
4749 
4750  return 1;
4751 error:
4752  if (object != NULL) {
4753  SCFree(object);
4754  }
4755 
4756  return 0;
4757 }
4758 
4759 static int DNP3DecodeObjectG33V5(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
4760  uint32_t start, uint32_t count, DNP3PointList *points)
4761 {
4762  DNP3ObjectG33V5 *object = NULL;
4763  uint32_t prefix = 0;
4764  uint32_t point_index = start;
4765 
4766  if (*len < count/8) {
4767  goto error;
4768  }
4769  while (count--) {
4770 
4771  object = SCCalloc(1, sizeof(*object));
4772  if (unlikely(object == NULL)) {
4773  goto error;
4774  }
4775 
4776  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
4777  goto error;
4778  }
4779 
4780  {
4781  uint8_t octet;
4782  if (!DNP3ReadUint8(buf, len, &octet)) {
4783  goto error;
4784  }
4785  object->online = (octet >> 0) & 0x1;
4786  object->restart = (octet >> 1) & 0x1;
4787  object->comm_lost = (octet >> 2) & 0x1;
4788  object->remote_forced = (octet >> 3) & 0x1;
4789  object->local_forced = (octet >> 4) & 0x1;
4790  object->over_range = (octet >> 5) & 0x1;
4791  object->reference_err = (octet >> 6) & 0x1;
4792  object->reserved0 = (octet >> 7) & 0x1;
4793  }
4794  if (!DNP3ReadFloat32(buf, len, &object->value)) {
4795  goto error;
4796  }
4797 
4798  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
4799  goto error;
4800  }
4801 
4802  object = NULL;
4803  point_index++;
4804  }
4805 
4806  return 1;
4807 error:
4808  if (object != NULL) {
4809  SCFree(object);
4810  }
4811 
4812  return 0;
4813 }
4814 
4815 static int DNP3DecodeObjectG33V6(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
4816  uint32_t start, uint32_t count, DNP3PointList *points)
4817 {
4818  DNP3ObjectG33V6 *object = NULL;
4819  uint32_t prefix = 0;
4820  uint32_t point_index = start;
4821 
4822  if (*len < count/8) {
4823  goto error;
4824  }
4825  while (count--) {
4826 
4827  object = SCCalloc(1, sizeof(*object));
4828  if (unlikely(object == NULL)) {
4829  goto error;
4830  }
4831 
4832  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
4833  goto error;
4834  }
4835 
4836  {
4837  uint8_t octet;
4838  if (!DNP3ReadUint8(buf, len, &octet)) {
4839  goto error;
4840  }
4841  object->online = (octet >> 0) & 0x1;
4842  object->restart = (octet >> 1) & 0x1;
4843  object->comm_lost = (octet >> 2) & 0x1;
4844  object->remote_forced = (octet >> 3) & 0x1;
4845  object->local_forced = (octet >> 4) & 0x1;
4846  object->over_range = (octet >> 5) & 0x1;
4847  object->reference_err = (octet >> 6) & 0x1;
4848  object->reserved0 = (octet >> 7) & 0x1;
4849  }
4850  if (!DNP3ReadFloat64(buf, len, &object->value)) {
4851  goto error;
4852  }
4853 
4854  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
4855  goto error;
4856  }
4857 
4858  object = NULL;
4859  point_index++;
4860  }
4861 
4862  return 1;
4863 error:
4864  if (object != NULL) {
4865  SCFree(object);
4866  }
4867 
4868  return 0;
4869 }
4870 
4871 static int DNP3DecodeObjectG33V7(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
4872  uint32_t start, uint32_t count, DNP3PointList *points)
4873 {
4874  DNP3ObjectG33V7 *object = NULL;
4875  uint32_t prefix = 0;
4876  uint32_t point_index = start;
4877 
4878  if (*len < count/8) {
4879  goto error;
4880  }
4881  while (count--) {
4882 
4883  object = SCCalloc(1, sizeof(*object));
4884  if (unlikely(object == NULL)) {
4885  goto error;
4886  }
4887 
4888  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
4889  goto error;
4890  }
4891 
4892  {
4893  uint8_t octet;
4894  if (!DNP3ReadUint8(buf, len, &octet)) {
4895  goto error;
4896  }
4897  object->online = (octet >> 0) & 0x1;
4898  object->restart = (octet >> 1) & 0x1;
4899  object->comm_lost = (octet >> 2) & 0x1;
4900  object->remote_forced = (octet >> 3) & 0x1;
4901  object->local_forced = (octet >> 4) & 0x1;
4902  object->over_range = (octet >> 5) & 0x1;
4903  object->reference_err = (octet >> 6) & 0x1;
4904  object->reserved0 = (octet >> 7) & 0x1;
4905  }
4906  if (!DNP3ReadFloat32(buf, len, &object->value)) {
4907  goto error;
4908  }
4909  if (!DNP3ReadUint48(buf, len, &object->timestamp)) {
4910  goto error;
4911  }
4912 
4913  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
4914  goto error;
4915  }
4916 
4917  object = NULL;
4918  point_index++;
4919  }
4920 
4921  return 1;
4922 error:
4923  if (object != NULL) {
4924  SCFree(object);
4925  }
4926 
4927  return 0;
4928 }
4929 
4930 static int DNP3DecodeObjectG33V8(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
4931  uint32_t start, uint32_t count, DNP3PointList *points)
4932 {
4933  DNP3ObjectG33V8 *object = NULL;
4934  uint32_t prefix = 0;
4935  uint32_t point_index = start;
4936 
4937  if (*len < count/8) {
4938  goto error;
4939  }
4940  while (count--) {
4941 
4942  object = SCCalloc(1, sizeof(*object));
4943  if (unlikely(object == NULL)) {
4944  goto error;
4945  }
4946 
4947  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
4948  goto error;
4949  }
4950 
4951  {
4952  uint8_t octet;
4953  if (!DNP3ReadUint8(buf, len, &octet)) {
4954  goto error;
4955  }
4956  object->online = (octet >> 0) & 0x1;
4957  object->restart = (octet >> 1) & 0x1;
4958  object->comm_lost = (octet >> 2) & 0x1;
4959  object->remote_forced = (octet >> 3) & 0x1;
4960  object->local_forced = (octet >> 4) & 0x1;
4961  object->over_range = (octet >> 5) & 0x1;
4962  object->reference_err = (octet >> 6) & 0x1;
4963  object->reserved0 = (octet >> 7) & 0x1;
4964  }
4965  if (!DNP3ReadFloat64(buf, len, &object->value)) {
4966  goto error;
4967  }
4968  if (!DNP3ReadUint48(buf, len, &object->timestamp)) {
4969  goto error;
4970  }
4971 
4972  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
4973  goto error;
4974  }
4975 
4976  object = NULL;
4977  point_index++;
4978  }
4979 
4980  return 1;
4981 error:
4982  if (object != NULL) {
4983  SCFree(object);
4984  }
4985 
4986  return 0;
4987 }
4988 
4989 static int DNP3DecodeObjectG34V1(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
4990  uint32_t start, uint32_t count, DNP3PointList *points)
4991 {
4992  DNP3ObjectG34V1 *object = NULL;
4993  uint32_t prefix = 0;
4994  uint32_t point_index = start;
4995 
4996  if (*len < count/8) {
4997  goto error;
4998  }
4999  while (count--) {
5000 
5001  object = SCCalloc(1, sizeof(*object));
5002  if (unlikely(object == NULL)) {
5003  goto error;
5004  }
5005 
5006  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
5007  goto error;
5008  }
5009 
5010  if (!DNP3ReadUint16(buf, len, &object->deadband_value)) {
5011  goto error;
5012  }
5013 
5014  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
5015  goto error;
5016  }
5017 
5018  object = NULL;
5019  point_index++;
5020  }
5021 
5022  return 1;
5023 error:
5024  if (object != NULL) {
5025  SCFree(object);
5026  }
5027 
5028  return 0;
5029 }
5030 
5031 static int DNP3DecodeObjectG34V2(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
5032  uint32_t start, uint32_t count, DNP3PointList *points)
5033 {
5034  DNP3ObjectG34V2 *object = NULL;
5035  uint32_t prefix = 0;
5036  uint32_t point_index = start;
5037 
5038  if (*len < count/8) {
5039  goto error;
5040  }
5041  while (count--) {
5042 
5043  object = SCCalloc(1, sizeof(*object));
5044  if (unlikely(object == NULL)) {
5045  goto error;
5046  }
5047 
5048  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
5049  goto error;
5050  }
5051 
5052  if (!DNP3ReadUint32(buf, len, &object->deadband_value)) {
5053  goto error;
5054  }
5055 
5056  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
5057  goto error;
5058  }
5059 
5060  object = NULL;
5061  point_index++;
5062  }
5063 
5064  return 1;
5065 error:
5066  if (object != NULL) {
5067  SCFree(object);
5068  }
5069 
5070  return 0;
5071 }
5072 
5073 static int DNP3DecodeObjectG34V3(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
5074  uint32_t start, uint32_t count, DNP3PointList *points)
5075 {
5076  DNP3ObjectG34V3 *object = NULL;
5077  uint32_t prefix = 0;
5078  uint32_t point_index = start;
5079 
5080  if (*len < count/8) {
5081  goto error;
5082  }
5083  while (count--) {
5084 
5085  object = SCCalloc(1, sizeof(*object));
5086  if (unlikely(object == NULL)) {
5087  goto error;
5088  }
5089 
5090  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
5091  goto error;
5092  }
5093 
5094  if (!DNP3ReadFloat32(buf, len, &object->deadband_value)) {
5095  goto error;
5096  }
5097 
5098  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
5099  goto error;
5100  }
5101 
5102  object = NULL;
5103  point_index++;
5104  }
5105 
5106  return 1;
5107 error:
5108  if (object != NULL) {
5109  SCFree(object);
5110  }
5111 
5112  return 0;
5113 }
5114 
5115 static int DNP3DecodeObjectG40V1(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
5116  uint32_t start, uint32_t count, DNP3PointList *points)
5117 {
5118  DNP3ObjectG40V1 *object = NULL;
5119  uint32_t prefix = 0;
5120  uint32_t point_index = start;
5121 
5122  if (*len < count/8) {
5123  goto error;
5124  }
5125  while (count--) {
5126 
5127  object = SCCalloc(1, sizeof(*object));
5128  if (unlikely(object == NULL)) {
5129  goto error;
5130  }
5131 
5132  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
5133  goto error;
5134  }
5135 
5136  {
5137  uint8_t octet;
5138  if (!DNP3ReadUint8(buf, len, &octet)) {
5139  goto error;
5140  }
5141  object->online = (octet >> 0) & 0x1;
5142  object->restart = (octet >> 1) & 0x1;
5143  object->comm_lost = (octet >> 2) & 0x1;
5144  object->remote_forced = (octet >> 3) & 0x1;
5145  object->local_forced = (octet >> 4) & 0x1;
5146  object->over_range = (octet >> 5) & 0x1;
5147  object->reference_err = (octet >> 6) & 0x1;
5148  object->reserved0 = (octet >> 7) & 0x1;
5149  }
5150  if (!DNP3ReadUint32(buf, len, (uint32_t *)&object->value)) {
5151  goto error;
5152  }
5153 
5154  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
5155  goto error;
5156  }
5157 
5158  object = NULL;
5159  point_index++;
5160  }
5161 
5162  return 1;
5163 error:
5164  if (object != NULL) {
5165  SCFree(object);
5166  }
5167 
5168  return 0;
5169 }
5170 
5171 static int DNP3DecodeObjectG40V2(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
5172  uint32_t start, uint32_t count, DNP3PointList *points)
5173 {
5174  DNP3ObjectG40V2 *object = NULL;
5175  uint32_t prefix = 0;
5176  uint32_t point_index = start;
5177 
5178  if (*len < count/8) {
5179  goto error;
5180  }
5181  while (count--) {
5182 
5183  object = SCCalloc(1, sizeof(*object));
5184  if (unlikely(object == NULL)) {
5185  goto error;
5186  }
5187 
5188  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
5189  goto error;
5190  }
5191 
5192  {
5193  uint8_t octet;
5194  if (!DNP3ReadUint8(buf, len, &octet)) {
5195  goto error;
5196  }
5197  object->online = (octet >> 0) & 0x1;
5198  object->restart = (octet >> 1) & 0x1;
5199  object->comm_lost = (octet >> 2) & 0x1;
5200  object->remote_forced = (octet >> 3) & 0x1;
5201  object->local_forced = (octet >> 4) & 0x1;
5202  object->over_range = (octet >> 5) & 0x1;
5203  object->reference_err = (octet >> 6) & 0x1;
5204  object->reserved0 = (octet >> 7) & 0x1;
5205  }
5206  if (!DNP3ReadUint16(buf, len, (uint16_t *)&object->value)) {
5207  goto error;
5208  }
5209 
5210  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
5211  goto error;
5212  }
5213 
5214  object = NULL;
5215  point_index++;
5216  }
5217 
5218  return 1;
5219 error:
5220  if (object != NULL) {
5221  SCFree(object);
5222  }
5223 
5224  return 0;
5225 }
5226 
5227 static int DNP3DecodeObjectG40V3(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
5228  uint32_t start, uint32_t count, DNP3PointList *points)
5229 {
5230  DNP3ObjectG40V3 *object = NULL;
5231  uint32_t prefix = 0;
5232  uint32_t point_index = start;
5233 
5234  if (*len < count/8) {
5235  goto error;
5236  }
5237  while (count--) {
5238 
5239  object = SCCalloc(1, sizeof(*object));
5240  if (unlikely(object == NULL)) {
5241  goto error;
5242  }
5243 
5244  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
5245  goto error;
5246  }
5247 
5248  {
5249  uint8_t octet;
5250  if (!DNP3ReadUint8(buf, len, &octet)) {
5251  goto error;
5252  }
5253  object->online = (octet >> 0) & 0x1;
5254  object->restart = (octet >> 1) & 0x1;
5255  object->comm_lost = (octet >> 2) & 0x1;
5256  object->remote_forced = (octet >> 3) & 0x1;
5257  object->local_forced = (octet >> 4) & 0x1;
5258  object->over_range = (octet >> 5) & 0x1;
5259  object->reference_err = (octet >> 6) & 0x1;
5260  object->reserved0 = (octet >> 7) & 0x1;
5261  }
5262  if (!DNP3ReadFloat32(buf, len, &object->value)) {
5263  goto error;
5264  }
5265 
5266  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
5267  goto error;
5268  }
5269 
5270  object = NULL;
5271  point_index++;
5272  }
5273 
5274  return 1;
5275 error:
5276  if (object != NULL) {
5277  SCFree(object);
5278  }
5279 
5280  return 0;
5281 }
5282 
5283 static int DNP3DecodeObjectG40V4(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
5284  uint32_t start, uint32_t count, DNP3PointList *points)
5285 {
5286  DNP3ObjectG40V4 *object = NULL;
5287  uint32_t prefix = 0;
5288  uint32_t point_index = start;
5289 
5290  if (*len < count/8) {
5291  goto error;
5292  }
5293  while (count--) {
5294 
5295  object = SCCalloc(1, sizeof(*object));
5296  if (unlikely(object == NULL)) {
5297  goto error;
5298  }
5299 
5300  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
5301  goto error;
5302  }
5303 
5304  {
5305  uint8_t octet;
5306  if (!DNP3ReadUint8(buf, len, &octet)) {
5307  goto error;
5308  }
5309  object->online = (octet >> 0) & 0x1;
5310  object->restart = (octet >> 1) & 0x1;
5311  object->comm_lost = (octet >> 2) & 0x1;
5312  object->remote_forced = (octet >> 3) & 0x1;
5313  object->local_forced = (octet >> 4) & 0x1;
5314  object->over_range = (octet >> 5) & 0x1;
5315  object->reference_err = (octet >> 6) & 0x1;
5316  object->reserved0 = (octet >> 7) & 0x1;
5317  }
5318  if (!DNP3ReadFloat64(buf, len, &object->value)) {
5319  goto error;
5320  }
5321 
5322  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
5323  goto error;
5324  }
5325 
5326  object = NULL;
5327  point_index++;
5328  }
5329 
5330  return 1;
5331 error:
5332  if (object != NULL) {
5333  SCFree(object);
5334  }
5335 
5336  return 0;
5337 }
5338 
5339 static int DNP3DecodeObjectG41V1(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
5340  uint32_t start, uint32_t count, DNP3PointList *points)
5341 {
5342  DNP3ObjectG41V1 *object = NULL;
5343  uint32_t prefix = 0;
5344  uint32_t point_index = start;
5345 
5346  if (*len < count/8) {
5347  goto error;
5348  }
5349  while (count--) {
5350 
5351  object = SCCalloc(1, sizeof(*object));
5352  if (unlikely(object == NULL)) {
5353  goto error;
5354  }
5355 
5356  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
5357  goto error;
5358  }
5359 
5360  if (!DNP3ReadUint32(buf, len, (uint32_t *)&object->value)) {
5361  goto error;
5362  }
5363  if (!DNP3ReadUint8(buf, len, &object->control_status)) {
5364  goto error;
5365  }
5366 
5367  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
5368  goto error;
5369  }
5370 
5371  object = NULL;
5372  point_index++;
5373  }
5374 
5375  return 1;
5376 error:
5377  if (object != NULL) {
5378  SCFree(object);
5379  }
5380 
5381  return 0;
5382 }
5383 
5384 static int DNP3DecodeObjectG41V2(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
5385  uint32_t start, uint32_t count, DNP3PointList *points)
5386 {
5387  DNP3ObjectG41V2 *object = NULL;
5388  uint32_t prefix = 0;
5389  uint32_t point_index = start;
5390 
5391  if (*len < count/8) {
5392  goto error;
5393  }
5394  while (count--) {
5395 
5396  object = SCCalloc(1, sizeof(*object));
5397  if (unlikely(object == NULL)) {
5398  goto error;
5399  }
5400 
5401  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
5402  goto error;
5403  }
5404 
5405  if (!DNP3ReadUint16(buf, len, (uint16_t *)&object->value)) {
5406  goto error;
5407  }
5408  if (!DNP3ReadUint8(buf, len, &object->control_status)) {
5409  goto error;
5410  }
5411 
5412  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
5413  goto error;
5414  }
5415 
5416  object = NULL;
5417  point_index++;
5418  }
5419 
5420  return 1;
5421 error:
5422  if (object != NULL) {
5423  SCFree(object);
5424  }
5425 
5426  return 0;
5427 }
5428 
5429 static int DNP3DecodeObjectG41V3(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
5430  uint32_t start, uint32_t count, DNP3PointList *points)
5431 {
5432  DNP3ObjectG41V3 *object = NULL;
5433  uint32_t prefix = 0;
5434  uint32_t point_index = start;
5435 
5436  if (*len < count/8) {
5437  goto error;
5438  }
5439  while (count--) {
5440 
5441  object = SCCalloc(1, sizeof(*object));
5442  if (unlikely(object == NULL)) {
5443  goto error;
5444  }
5445 
5446  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
5447  goto error;
5448  }
5449 
5450  if (!DNP3ReadFloat32(buf, len, &object->value)) {
5451  goto error;
5452  }
5453  if (!DNP3ReadUint8(buf, len, &object->control_status)) {
5454  goto error;
5455  }
5456 
5457  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
5458  goto error;
5459  }
5460 
5461  object = NULL;
5462  point_index++;
5463  }
5464 
5465  return 1;
5466 error:
5467  if (object != NULL) {
5468  SCFree(object);
5469  }
5470 
5471  return 0;
5472 }
5473 
5474 static int DNP3DecodeObjectG41V4(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
5475  uint32_t start, uint32_t count, DNP3PointList *points)
5476 {
5477  DNP3ObjectG41V4 *object = NULL;
5478  uint32_t prefix = 0;
5479  uint32_t point_index = start;
5480 
5481  if (*len < count/8) {
5482  goto error;
5483  }
5484  while (count--) {
5485 
5486  object = SCCalloc(1, sizeof(*object));
5487  if (unlikely(object == NULL)) {
5488  goto error;
5489  }
5490 
5491  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
5492  goto error;
5493  }
5494 
5495  if (!DNP3ReadFloat64(buf, len, &object->value)) {
5496  goto error;
5497  }
5498  if (!DNP3ReadUint8(buf, len, &object->control_status)) {
5499  goto error;
5500  }
5501 
5502  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
5503  goto error;
5504  }
5505 
5506  object = NULL;
5507  point_index++;
5508  }
5509 
5510  return 1;
5511 error:
5512  if (object != NULL) {
5513  SCFree(object);
5514  }
5515 
5516  return 0;
5517 }
5518 
5519 static int DNP3DecodeObjectG42V1(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
5520  uint32_t start, uint32_t count, DNP3PointList *points)
5521 {
5522  DNP3ObjectG42V1 *object = NULL;
5523  uint32_t prefix = 0;
5524  uint32_t point_index = start;
5525 
5526  if (*len < count/8) {
5527  goto error;
5528  }
5529  while (count--) {
5530 
5531  object = SCCalloc(1, sizeof(*object));
5532  if (unlikely(object == NULL)) {
5533  goto error;
5534  }
5535 
5536  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
5537  goto error;
5538  }
5539 
5540  {
5541  uint8_t octet;
5542  if (!DNP3ReadUint8(buf, len, &octet)) {
5543  goto error;
5544  }
5545  object->online = (octet >> 0) & 0x1;
5546  object->restart = (octet >> 1) & 0x1;
5547  object->comm_lost = (octet >> 2) & 0x1;
5548  object->remote_forced = (octet >> 3) & 0x1;
5549  object->local_forced = (octet >> 4) & 0x1;
5550  object->over_range = (octet >> 5) & 0x1;
5551  object->reference_err = (octet >> 6) & 0x1;
5552  object->reserved0 = (octet >> 7) & 0x1;
5553  }
5554  if (!DNP3ReadUint32(buf, len, (uint32_t *)&object->value)) {
5555  goto error;
5556  }
5557 
5558  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
5559  goto error;
5560  }
5561 
5562  object = NULL;
5563  point_index++;
5564  }
5565 
5566  return 1;
5567 error:
5568  if (object != NULL) {
5569  SCFree(object);
5570  }
5571 
5572  return 0;
5573 }
5574 
5575 static int DNP3DecodeObjectG42V2(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
5576  uint32_t start, uint32_t count, DNP3PointList *points)
5577 {
5578  DNP3ObjectG42V2 *object = NULL;
5579  uint32_t prefix = 0;
5580  uint32_t point_index = start;
5581 
5582  if (*len < count/8) {
5583  goto error;
5584  }
5585  while (count--) {
5586 
5587  object = SCCalloc(1, sizeof(*object));
5588  if (unlikely(object == NULL)) {
5589  goto error;
5590  }
5591 
5592  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
5593  goto error;
5594  }
5595 
5596  {
5597  uint8_t octet;
5598  if (!DNP3ReadUint8(buf, len, &octet)) {
5599  goto error;
5600  }
5601  object->online = (octet >> 0) & 0x1;
5602  object->restart = (octet >> 1) & 0x1;
5603  object->comm_lost = (octet >> 2) & 0x1;
5604  object->remote_forced = (octet >> 3) & 0x1;
5605  object->local_forced = (octet >> 4) & 0x1;
5606  object->over_range = (octet >> 5) & 0x1;
5607  object->reference_err = (octet >> 6) & 0x1;
5608  object->reserved0 = (octet >> 7) & 0x1;
5609  }
5610  if (!DNP3ReadUint16(buf, len, (uint16_t *)&object->value)) {
5611  goto error;
5612  }
5613 
5614  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
5615  goto error;
5616  }
5617 
5618  object = NULL;
5619  point_index++;
5620  }
5621 
5622  return 1;
5623 error:
5624  if (object != NULL) {
5625  SCFree(object);
5626  }
5627 
5628  return 0;
5629 }
5630 
5631 static int DNP3DecodeObjectG42V3(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
5632  uint32_t start, uint32_t count, DNP3PointList *points)
5633 {
5634  DNP3ObjectG42V3 *object = NULL;
5635  uint32_t prefix = 0;
5636  uint32_t point_index = start;
5637 
5638  if (*len < count/8) {
5639  goto error;
5640  }
5641  while (count--) {
5642 
5643  object = SCCalloc(1, sizeof(*object));
5644  if (unlikely(object == NULL)) {
5645  goto error;
5646  }
5647 
5648  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
5649  goto error;
5650  }
5651 
5652  {
5653  uint8_t octet;
5654  if (!DNP3ReadUint8(buf, len, &octet)) {
5655  goto error;
5656  }
5657  object->online = (octet >> 0) & 0x1;
5658  object->restart = (octet >> 1) & 0x1;
5659  object->comm_lost = (octet >> 2) & 0x1;
5660  object->remote_forced = (octet >> 3) & 0x1;
5661  object->local_forced = (octet >> 4) & 0x1;
5662  object->over_range = (octet >> 5) & 0x1;
5663  object->reference_err = (octet >> 6) & 0x1;
5664  object->reserved0 = (octet >> 7) & 0x1;
5665  }
5666  if (!DNP3ReadUint32(buf, len, (uint32_t *)&object->value)) {
5667  goto error;
5668  }
5669  if (!DNP3ReadUint48(buf, len, &object->timestamp)) {
5670  goto error;
5671  }
5672 
5673  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
5674  goto error;
5675  }
5676 
5677  object = NULL;
5678  point_index++;
5679  }
5680 
5681  return 1;
5682 error:
5683  if (object != NULL) {
5684  SCFree(object);
5685  }
5686 
5687  return 0;
5688 }
5689 
5690 static int DNP3DecodeObjectG42V4(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
5691  uint32_t start, uint32_t count, DNP3PointList *points)
5692 {
5693  DNP3ObjectG42V4 *object = NULL;
5694  uint32_t prefix = 0;
5695  uint32_t point_index = start;
5696 
5697  if (*len < count/8) {
5698  goto error;
5699  }
5700  while (count--) {
5701 
5702  object = SCCalloc(1, sizeof(*object));
5703  if (unlikely(object == NULL)) {
5704  goto error;
5705  }
5706 
5707  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
5708  goto error;
5709  }
5710 
5711  {
5712  uint8_t octet;
5713  if (!DNP3ReadUint8(buf, len, &octet)) {
5714  goto error;
5715  }
5716  object->online = (octet >> 0) & 0x1;
5717  object->restart = (octet >> 1) & 0x1;
5718  object->comm_lost = (octet >> 2) & 0x1;
5719  object->remote_forced = (octet >> 3) & 0x1;
5720  object->local_forced = (octet >> 4) & 0x1;
5721  object->over_range = (octet >> 5) & 0x1;
5722  object->reference_err = (octet >> 6) & 0x1;
5723  object->reserved0 = (octet >> 7) & 0x1;
5724  }
5725  if (!DNP3ReadUint16(buf, len, (uint16_t *)&object->value)) {
5726  goto error;
5727  }
5728  if (!DNP3ReadUint48(buf, len, &object->timestamp)) {
5729  goto error;
5730  }
5731 
5732  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
5733  goto error;
5734  }
5735 
5736  object = NULL;
5737  point_index++;
5738  }
5739 
5740  return 1;
5741 error:
5742  if (object != NULL) {
5743  SCFree(object);
5744  }
5745 
5746  return 0;
5747 }
5748 
5749 static int DNP3DecodeObjectG42V5(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
5750  uint32_t start, uint32_t count, DNP3PointList *points)
5751 {
5752  DNP3ObjectG42V5 *object = NULL;
5753  uint32_t prefix = 0;
5754  uint32_t point_index = start;
5755 
5756  if (*len < count/8) {
5757  goto error;
5758  }
5759  while (count--) {
5760 
5761  object = SCCalloc(1, sizeof(*object));
5762  if (unlikely(object == NULL)) {
5763  goto error;
5764  }
5765 
5766  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
5767  goto error;
5768  }
5769 
5770  {
5771  uint8_t octet;
5772  if (!DNP3ReadUint8(buf, len, &octet)) {
5773  goto error;
5774  }
5775  object->online = (octet >> 0) & 0x1;
5776  object->restart = (octet >> 1) & 0x1;
5777  object->comm_lost = (octet >> 2) & 0x1;
5778  object->remote_forced = (octet >> 3) & 0x1;
5779  object->local_forced = (octet >> 4) & 0x1;
5780  object->over_range = (octet >> 5) & 0x1;
5781  object->reference_err = (octet >> 6) & 0x1;
5782  object->reserved0 = (octet >> 7) & 0x1;
5783  }
5784  if (!DNP3ReadFloat32(buf, len, &object->value)) {
5785  goto error;
5786  }
5787 
5788  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
5789  goto error;
5790  }
5791 
5792  object = NULL;
5793  point_index++;
5794  }
5795 
5796  return 1;
5797 error:
5798  if (object != NULL) {
5799  SCFree(object);
5800  }
5801 
5802  return 0;
5803 }
5804 
5805 static int DNP3DecodeObjectG42V6(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
5806  uint32_t start, uint32_t count, DNP3PointList *points)
5807 {
5808  DNP3ObjectG42V6 *object = NULL;
5809  uint32_t prefix = 0;
5810  uint32_t point_index = start;
5811 
5812  if (*len < count/8) {
5813  goto error;
5814  }
5815  while (count--) {
5816 
5817  object = SCCalloc(1, sizeof(*object));
5818  if (unlikely(object == NULL)) {
5819  goto error;
5820  }
5821 
5822  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
5823  goto error;
5824  }
5825 
5826  {
5827  uint8_t octet;
5828  if (!DNP3ReadUint8(buf, len, &octet)) {
5829  goto error;
5830  }
5831  object->online = (octet >> 0) & 0x1;
5832  object->restart = (octet >> 1) & 0x1;
5833  object->comm_lost = (octet >> 2) & 0x1;
5834  object->remote_forced = (octet >> 3) & 0x1;
5835  object->local_forced = (octet >> 4) & 0x1;
5836  object->over_range = (octet >> 5) & 0x1;
5837  object->reference_err = (octet >> 6) & 0x1;
5838  object->reserved0 = (octet >> 7) & 0x1;
5839  }
5840  if (!DNP3ReadFloat64(buf, len, &object->value)) {
5841  goto error;
5842  }
5843 
5844  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
5845  goto error;
5846  }
5847 
5848  object = NULL;
5849  point_index++;
5850  }
5851 
5852  return 1;
5853 error:
5854  if (object != NULL) {
5855  SCFree(object);
5856  }
5857 
5858  return 0;
5859 }
5860 
5861 static int DNP3DecodeObjectG42V7(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
5862  uint32_t start, uint32_t count, DNP3PointList *points)
5863 {
5864  DNP3ObjectG42V7 *object = NULL;
5865  uint32_t prefix = 0;
5866  uint32_t point_index = start;
5867 
5868  if (*len < count/8) {
5869  goto error;
5870  }
5871  while (count--) {
5872 
5873  object = SCCalloc(1, sizeof(*object));
5874  if (unlikely(object == NULL)) {
5875  goto error;
5876  }
5877 
5878  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
5879  goto error;
5880  }
5881 
5882  {
5883  uint8_t octet;
5884  if (!DNP3ReadUint8(buf, len, &octet)) {
5885  goto error;
5886  }
5887  object->online = (octet >> 0) & 0x1;
5888  object->restart = (octet >> 1) & 0x1;
5889  object->comm_lost = (octet >> 2) & 0x1;
5890  object->remote_forced = (octet >> 3) & 0x1;
5891  object->local_forced = (octet >> 4) & 0x1;
5892  object->over_range = (octet >> 5) & 0x1;
5893  object->reference_err = (octet >> 6) & 0x1;
5894  object->reserved0 = (octet >> 7) & 0x1;
5895  }
5896  if (!DNP3ReadFloat32(buf, len, &object->value)) {
5897  goto error;
5898  }
5899  if (!DNP3ReadUint48(buf, len, &object->timestamp)) {
5900  goto error;
5901  }
5902 
5903  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
5904  goto error;
5905  }
5906 
5907  object = NULL;
5908  point_index++;
5909  }
5910 
5911  return 1;
5912 error:
5913  if (object != NULL) {
5914  SCFree(object);
5915  }
5916 
5917  return 0;
5918 }
5919 
5920 static int DNP3DecodeObjectG42V8(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
5921  uint32_t start, uint32_t count, DNP3PointList *points)
5922 {
5923  DNP3ObjectG42V8 *object = NULL;
5924  uint32_t prefix = 0;
5925  uint32_t point_index = start;
5926 
5927  if (*len < count/8) {
5928  goto error;
5929  }
5930  while (count--) {
5931 
5932  object = SCCalloc(1, sizeof(*object));
5933  if (unlikely(object == NULL)) {
5934  goto error;
5935  }
5936 
5937  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
5938  goto error;
5939  }
5940 
5941  {
5942  uint8_t octet;
5943  if (!DNP3ReadUint8(buf, len, &octet)) {
5944  goto error;
5945  }
5946  object->online = (octet >> 0) & 0x1;
5947  object->restart = (octet >> 1) & 0x1;
5948  object->comm_lost = (octet >> 2) & 0x1;
5949  object->remote_forced = (octet >> 3) & 0x1;
5950  object->local_forced = (octet >> 4) & 0x1;
5951  object->over_range = (octet >> 5) & 0x1;
5952  object->reference_err = (octet >> 6) & 0x1;
5953  object->reserved0 = (octet >> 7) & 0x1;
5954  }
5955  if (!DNP3ReadFloat64(buf, len, &object->value)) {
5956  goto error;
5957  }
5958  if (!DNP3ReadUint48(buf, len, &object->timestamp)) {
5959  goto error;
5960  }
5961 
5962  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
5963  goto error;
5964  }
5965 
5966  object = NULL;
5967  point_index++;
5968  }
5969 
5970  return 1;
5971 error:
5972  if (object != NULL) {
5973  SCFree(object);
5974  }
5975 
5976  return 0;
5977 }
5978 
5979 static int DNP3DecodeObjectG43V1(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
5980  uint32_t start, uint32_t count, DNP3PointList *points)
5981 {
5982  DNP3ObjectG43V1 *object = NULL;
5983  uint32_t prefix = 0;
5984  uint32_t point_index = start;
5985 
5986  if (*len < count/8) {
5987  goto error;
5988  }
5989  while (count--) {
5990 
5991  object = SCCalloc(1, sizeof(*object));
5992  if (unlikely(object == NULL)) {
5993  goto error;
5994  }
5995 
5996  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
5997  goto error;
5998  }
5999 
6000  {
6001  uint8_t octet;
6002  if (!DNP3ReadUint8(buf, len, &octet)) {
6003  goto error;
6004  }
6005  object->status_code = (octet >> 0) & 0x7f;
6006  object->reserved0 = (octet >> 7) & 0x1;
6007  }
6008  if (!DNP3ReadUint32(buf, len, (uint32_t *)&object->commanded_value)) {
6009  goto error;
6010  }
6011 
6012  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
6013  goto error;
6014  }
6015 
6016  object = NULL;
6017  point_index++;
6018  }
6019 
6020  return 1;
6021 error:
6022  if (object != NULL) {
6023  SCFree(object);
6024  }
6025 
6026  return 0;
6027 }
6028 
6029 static int DNP3DecodeObjectG43V2(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
6030  uint32_t start, uint32_t count, DNP3PointList *points)
6031 {
6032  DNP3ObjectG43V2 *object = NULL;
6033  uint32_t prefix = 0;
6034  uint32_t point_index = start;
6035 
6036  if (*len < count/8) {
6037  goto error;
6038  }
6039  while (count--) {
6040 
6041  object = SCCalloc(1, sizeof(*object));
6042  if (unlikely(object == NULL)) {
6043  goto error;
6044  }
6045 
6046  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
6047  goto error;
6048  }
6049 
6050  {
6051  uint8_t octet;
6052  if (!DNP3ReadUint8(buf, len, &octet)) {
6053  goto error;
6054  }
6055  object->status_code = (octet >> 0) & 0x7f;
6056  object->reserved0 = (octet >> 7) & 0x1;
6057  }
6058  if (!DNP3ReadUint16(buf, len, (uint16_t *)&object->commanded_value)) {
6059  goto error;
6060  }
6061 
6062  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
6063  goto error;
6064  }
6065 
6066  object = NULL;
6067  point_index++;
6068  }
6069 
6070  return 1;
6071 error:
6072  if (object != NULL) {
6073  SCFree(object);
6074  }
6075 
6076  return 0;
6077 }
6078 
6079 static int DNP3DecodeObjectG43V3(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
6080  uint32_t start, uint32_t count, DNP3PointList *points)
6081 {
6082  DNP3ObjectG43V3 *object = NULL;
6083  uint32_t prefix = 0;
6084  uint32_t point_index = start;
6085 
6086  if (*len < count/8) {
6087  goto error;
6088  }
6089  while (count--) {
6090 
6091  object = SCCalloc(1, sizeof(*object));
6092  if (unlikely(object == NULL)) {
6093  goto error;
6094  }
6095 
6096  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
6097  goto error;
6098  }
6099 
6100  {
6101  uint8_t octet;
6102  if (!DNP3ReadUint8(buf, len, &octet)) {
6103  goto error;
6104  }
6105  object->status_code = (octet >> 0) & 0x7f;
6106  object->reserved0 = (octet >> 7) & 0x1;
6107  }
6108  if (!DNP3ReadUint32(buf, len, (uint32_t *)&object->commanded_value)) {
6109  goto error;
6110  }
6111  if (!DNP3ReadUint48(buf, len, &object->timestamp)) {
6112  goto error;
6113  }
6114 
6115  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
6116  goto error;
6117  }
6118 
6119  object = NULL;
6120  point_index++;
6121  }
6122 
6123  return 1;
6124 error:
6125  if (object != NULL) {
6126  SCFree(object);
6127  }
6128 
6129  return 0;
6130 }
6131 
6132 static int DNP3DecodeObjectG43V4(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
6133  uint32_t start, uint32_t count, DNP3PointList *points)
6134 {
6135  DNP3ObjectG43V4 *object = NULL;
6136  uint32_t prefix = 0;
6137  uint32_t point_index = start;
6138 
6139  if (*len < count/8) {
6140  goto error;
6141  }
6142  while (count--) {
6143 
6144  object = SCCalloc(1, sizeof(*object));
6145  if (unlikely(object == NULL)) {
6146  goto error;
6147  }
6148 
6149  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
6150  goto error;
6151  }
6152 
6153  {
6154  uint8_t octet;
6155  if (!DNP3ReadUint8(buf, len, &octet)) {
6156  goto error;
6157  }
6158  object->status_code = (octet >> 0) & 0x7f;
6159  object->reserved0 = (octet >> 7) & 0x1;
6160  }
6161  if (!DNP3ReadUint16(buf, len, (uint16_t *)&object->commanded_value)) {
6162  goto error;
6163  }
6164  if (!DNP3ReadUint48(buf, len, &object->timestamp)) {
6165  goto error;
6166  }
6167 
6168  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
6169  goto error;
6170  }
6171 
6172  object = NULL;
6173  point_index++;
6174  }
6175 
6176  return 1;
6177 error:
6178  if (object != NULL) {
6179  SCFree(object);
6180  }
6181 
6182  return 0;
6183 }
6184 
6185 static int DNP3DecodeObjectG43V5(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
6186  uint32_t start, uint32_t count, DNP3PointList *points)
6187 {
6188  DNP3ObjectG43V5 *object = NULL;
6189  uint32_t prefix = 0;
6190  uint32_t point_index = start;
6191 
6192  if (*len < count/8) {
6193  goto error;
6194  }
6195  while (count--) {
6196 
6197  object = SCCalloc(1, sizeof(*object));
6198  if (unlikely(object == NULL)) {
6199  goto error;
6200  }
6201 
6202  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
6203  goto error;
6204  }
6205 
6206  {
6207  uint8_t octet;
6208  if (!DNP3ReadUint8(buf, len, &octet)) {
6209  goto error;
6210  }
6211  object->status_code = (octet >> 0) & 0x7f;
6212  object->reserved0 = (octet >> 7) & 0x1;
6213  }
6214  if (!DNP3ReadFloat32(buf, len, &object->commanded_value)) {
6215  goto error;
6216  }
6217 
6218  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
6219  goto error;
6220  }
6221 
6222  object = NULL;
6223  point_index++;
6224  }
6225 
6226  return 1;
6227 error:
6228  if (object != NULL) {
6229  SCFree(object);
6230  }
6231 
6232  return 0;
6233 }
6234 
6235 static int DNP3DecodeObjectG43V6(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
6236  uint32_t start, uint32_t count, DNP3PointList *points)
6237 {
6238  DNP3ObjectG43V6 *object = NULL;
6239  uint32_t prefix = 0;
6240  uint32_t point_index = start;
6241 
6242  if (*len < count/8) {
6243  goto error;
6244  }
6245  while (count--) {
6246 
6247  object = SCCalloc(1, sizeof(*object));
6248  if (unlikely(object == NULL)) {
6249  goto error;
6250  }
6251 
6252  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
6253  goto error;
6254  }
6255 
6256  {
6257  uint8_t octet;
6258  if (!DNP3ReadUint8(buf, len, &octet)) {
6259  goto error;
6260  }
6261  object->status_code = (octet >> 0) & 0x7f;
6262  object->reserved0 = (octet >> 7) & 0x1;
6263  }
6264  if (!DNP3ReadFloat64(buf, len, &object->commanded_value)) {
6265  goto error;
6266  }
6267 
6268  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
6269  goto error;
6270  }
6271 
6272  object = NULL;
6273  point_index++;
6274  }
6275 
6276  return 1;
6277 error:
6278  if (object != NULL) {
6279  SCFree(object);
6280  }
6281 
6282  return 0;
6283 }
6284 
6285 static int DNP3DecodeObjectG43V7(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
6286  uint32_t start, uint32_t count, DNP3PointList *points)
6287 {
6288  DNP3ObjectG43V7 *object = NULL;
6289  uint32_t prefix = 0;
6290  uint32_t point_index = start;
6291 
6292  if (*len < count/8) {
6293  goto error;
6294  }
6295  while (count--) {
6296 
6297  object = SCCalloc(1, sizeof(*object));
6298  if (unlikely(object == NULL)) {
6299  goto error;
6300  }
6301 
6302  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
6303  goto error;
6304  }
6305 
6306  {
6307  uint8_t octet;
6308  if (!DNP3ReadUint8(buf, len, &octet)) {
6309  goto error;
6310  }
6311  object->status_code = (octet >> 0) & 0x7f;
6312  object->reserved0 = (octet >> 7) & 0x1;
6313  }
6314  if (!DNP3ReadFloat32(buf, len, &object->commanded_value)) {
6315  goto error;
6316  }
6317  if (!DNP3ReadUint48(buf, len, &object->timestamp)) {
6318  goto error;
6319  }
6320 
6321  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
6322  goto error;
6323  }
6324 
6325  object = NULL;
6326  point_index++;
6327  }
6328 
6329  return 1;
6330 error:
6331  if (object != NULL) {
6332  SCFree(object);
6333  }
6334 
6335  return 0;
6336 }
6337 
6338 static int DNP3DecodeObjectG43V8(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
6339  uint32_t start, uint32_t count, DNP3PointList *points)
6340 {
6341  DNP3ObjectG43V8 *object = NULL;
6342  uint32_t prefix = 0;
6343  uint32_t point_index = start;
6344 
6345  if (*len < count/8) {
6346  goto error;
6347  }
6348  while (count--) {
6349 
6350  object = SCCalloc(1, sizeof(*object));
6351  if (unlikely(object == NULL)) {
6352  goto error;
6353  }
6354 
6355  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
6356  goto error;
6357  }
6358 
6359  {
6360  uint8_t octet;
6361  if (!DNP3ReadUint8(buf, len, &octet)) {
6362  goto error;
6363  }
6364  object->status_code = (octet >> 0) & 0x7f;
6365  object->reserved0 = (octet >> 7) & 0x1;
6366  }
6367  if (!DNP3ReadFloat64(buf, len, &object->commanded_value)) {
6368  goto error;
6369  }
6370  if (!DNP3ReadUint48(buf, len, &object->timestamp)) {
6371  goto error;
6372  }
6373 
6374  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
6375  goto error;
6376  }
6377 
6378  object = NULL;
6379  point_index++;
6380  }
6381 
6382  return 1;
6383 error:
6384  if (object != NULL) {
6385  SCFree(object);
6386  }
6387 
6388  return 0;
6389 }
6390 
6391 static int DNP3DecodeObjectG50V1(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
6392  uint32_t start, uint32_t count, DNP3PointList *points)
6393 {
6394  DNP3ObjectG50V1 *object = NULL;
6395  uint32_t prefix = 0;
6396  uint32_t point_index = start;
6397 
6398  if (*len < count/8) {
6399  goto error;
6400  }
6401  while (count--) {
6402 
6403  object = SCCalloc(1, sizeof(*object));
6404  if (unlikely(object == NULL)) {
6405  goto error;
6406  }
6407 
6408  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
6409  goto error;
6410  }
6411 
6412  if (!DNP3ReadUint48(buf, len, &object->timestamp)) {
6413  goto error;
6414  }
6415 
6416  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
6417  goto error;
6418  }
6419 
6420  object = NULL;
6421  point_index++;
6422  }
6423 
6424  return 1;
6425 error:
6426  if (object != NULL) {
6427  SCFree(object);
6428  }
6429 
6430  return 0;
6431 }
6432 
6433 static int DNP3DecodeObjectG50V2(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
6434  uint32_t start, uint32_t count, DNP3PointList *points)
6435 {
6436  DNP3ObjectG50V2 *object = NULL;
6437  uint32_t prefix = 0;
6438  uint32_t point_index = start;
6439 
6440  if (*len < count/8) {
6441  goto error;
6442  }
6443  while (count--) {
6444 
6445  object = SCCalloc(1, sizeof(*object));
6446  if (unlikely(object == NULL)) {
6447  goto error;
6448  }
6449 
6450  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
6451  goto error;
6452  }
6453 
6454  if (!DNP3ReadUint48(buf, len, &object->timestamp)) {
6455  goto error;
6456  }
6457  if (!DNP3ReadUint32(buf, len, &object->interval)) {
6458  goto error;
6459  }
6460 
6461  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
6462  goto error;
6463  }
6464 
6465  object = NULL;
6466  point_index++;
6467  }
6468 
6469  return 1;
6470 error:
6471  if (object != NULL) {
6472  SCFree(object);
6473  }
6474 
6475  return 0;
6476 }
6477 
6478 static int DNP3DecodeObjectG50V3(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
6479  uint32_t start, uint32_t count, DNP3PointList *points)
6480 {
6481  DNP3ObjectG50V3 *object = NULL;
6482  uint32_t prefix = 0;
6483  uint32_t point_index = start;
6484 
6485  if (*len < count/8) {
6486  goto error;
6487  }
6488  while (count--) {
6489 
6490  object = SCCalloc(1, sizeof(*object));
6491  if (unlikely(object == NULL)) {
6492  goto error;
6493  }
6494 
6495  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
6496  goto error;
6497  }
6498 
6499  if (!DNP3ReadUint48(buf, len, &object->timestamp)) {
6500  goto error;
6501  }
6502 
6503  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
6504  goto error;
6505  }
6506 
6507  object = NULL;
6508  point_index++;
6509  }
6510 
6511  return 1;
6512 error:
6513  if (object != NULL) {
6514  SCFree(object);
6515  }
6516 
6517  return 0;
6518 }
6519 
6520 static int DNP3DecodeObjectG50V4(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
6521  uint32_t start, uint32_t count, DNP3PointList *points)
6522 {
6523  DNP3ObjectG50V4 *object = NULL;
6524  uint32_t prefix = 0;
6525  uint32_t point_index = start;
6526 
6527  if (*len < count/8) {
6528  goto error;
6529  }
6530  while (count--) {
6531 
6532  object = SCCalloc(1, sizeof(*object));
6533  if (unlikely(object == NULL)) {
6534  goto error;
6535  }
6536 
6537  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
6538  goto error;
6539  }
6540 
6541  if (!DNP3ReadUint48(buf, len, &object->timestamp)) {
6542  goto error;
6543  }
6544  if (!DNP3ReadUint32(buf, len, &object->interval_count)) {
6545  goto error;
6546  }
6547  if (!DNP3ReadUint8(buf, len, &object->interval_units)) {
6548  goto error;
6549  }
6550 
6551  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
6552  goto error;
6553  }
6554 
6555  object = NULL;
6556  point_index++;
6557  }
6558 
6559  return 1;
6560 error:
6561  if (object != NULL) {
6562  SCFree(object);
6563  }
6564 
6565  return 0;
6566 }
6567 
6568 static int DNP3DecodeObjectG51V1(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
6569  uint32_t start, uint32_t count, DNP3PointList *points)
6570 {
6571  DNP3ObjectG51V1 *object = NULL;
6572  uint32_t prefix = 0;
6573  uint32_t point_index = start;
6574 
6575  if (*len < count/8) {
6576  goto error;
6577  }
6578  while (count--) {
6579 
6580  object = SCCalloc(1, sizeof(*object));
6581  if (unlikely(object == NULL)) {
6582  goto error;
6583  }
6584 
6585  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
6586  goto error;
6587  }
6588 
6589  if (!DNP3ReadUint48(buf, len, &object->timestamp)) {
6590  goto error;
6591  }
6592 
6593  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
6594  goto error;
6595  }
6596 
6597  object = NULL;
6598  point_index++;
6599  }
6600 
6601  return 1;
6602 error:
6603  if (object != NULL) {
6604  SCFree(object);
6605  }
6606 
6607  return 0;
6608 }
6609 
6610 static int DNP3DecodeObjectG51V2(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
6611  uint32_t start, uint32_t count, DNP3PointList *points)
6612 {
6613  DNP3ObjectG51V2 *object = NULL;
6614  uint32_t prefix = 0;
6615  uint32_t point_index = start;
6616 
6617  if (*len < count/8) {
6618  goto error;
6619  }
6620  while (count--) {
6621 
6622  object = SCCalloc(1, sizeof(*object));
6623  if (unlikely(object == NULL)) {
6624  goto error;
6625  }
6626 
6627  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
6628  goto error;
6629  }
6630 
6631  if (!DNP3ReadUint48(buf, len, &object->timestamp)) {
6632  goto error;
6633  }
6634 
6635  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
6636  goto error;
6637  }
6638 
6639  object = NULL;
6640  point_index++;
6641  }
6642 
6643  return 1;
6644 error:
6645  if (object != NULL) {
6646  SCFree(object);
6647  }
6648 
6649  return 0;
6650 }
6651 
6652 static int DNP3DecodeObjectG52V1(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
6653  uint32_t start, uint32_t count, DNP3PointList *points)
6654 {
6655  DNP3ObjectG52V1 *object = NULL;
6656  uint32_t prefix = 0;
6657  uint32_t point_index = start;
6658 
6659  if (*len < count/8) {
6660  goto error;
6661  }
6662  while (count--) {
6663 
6664  object = SCCalloc(1, sizeof(*object));
6665  if (unlikely(object == NULL)) {
6666  goto error;
6667  }
6668 
6669  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
6670  goto error;
6671  }
6672 
6673  if (!DNP3ReadUint16(buf, len, &object->delay_secs)) {
6674  goto error;
6675  }
6676 
6677  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
6678  goto error;
6679  }
6680 
6681  object = NULL;
6682  point_index++;
6683  }
6684 
6685  return 1;
6686 error:
6687  if (object != NULL) {
6688  SCFree(object);
6689  }
6690 
6691  return 0;
6692 }
6693 
6694 static int DNP3DecodeObjectG52V2(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
6695  uint32_t start, uint32_t count, DNP3PointList *points)
6696 {
6697  DNP3ObjectG52V2 *object = NULL;
6698  uint32_t prefix = 0;
6699  uint32_t point_index = start;
6700 
6701  if (*len < count/8) {
6702  goto error;
6703  }
6704  while (count--) {
6705 
6706  object = SCCalloc(1, sizeof(*object));
6707  if (unlikely(object == NULL)) {
6708  goto error;
6709  }
6710 
6711  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
6712  goto error;
6713  }
6714 
6715  if (!DNP3ReadUint16(buf, len, &object->delay_ms)) {
6716  goto error;
6717  }
6718 
6719  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
6720  goto error;
6721  }
6722 
6723  object = NULL;
6724  point_index++;
6725  }
6726 
6727  return 1;
6728 error:
6729  if (object != NULL) {
6730  SCFree(object);
6731  }
6732 
6733  return 0;
6734 }
6735 
6736 static int DNP3DecodeObjectG70V1(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
6737  uint32_t start, uint32_t count, DNP3PointList *points)
6738 {
6739  DNP3ObjectG70V1 *object = NULL;
6740  uint32_t prefix = 0;
6741  uint32_t point_index = start;
6742 
6743  if (*len < count/8) {
6744  goto error;
6745  }
6746  while (count--) {
6747 
6748  object = SCCalloc(1, sizeof(*object));
6749  if (unlikely(object == NULL)) {
6750  goto error;
6751  }
6752 
6753  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
6754  goto error;
6755  }
6756 
6757  if (!DNP3ReadUint16(buf, len, &object->filename_size)) {
6758  goto error;
6759  }
6760  if (!DNP3ReadUint8(buf, len, &object->filetype_code)) {
6761  goto error;
6762  }
6763  if (!DNP3ReadUint8(buf, len, &object->attribute_code)) {
6764  goto error;
6765  }
6766  if (!DNP3ReadUint16(buf, len, &object->start_record)) {
6767  goto error;
6768  }
6769  if (!DNP3ReadUint16(buf, len, &object->end_record)) {
6770  goto error;
6771  }
6772  if (!DNP3ReadUint32(buf, len, &object->file_size)) {
6773  goto error;
6774  }
6775  if (!DNP3ReadUint48(buf, len, &object->created_timestamp)) {
6776  goto error;
6777  }
6778  if (!DNP3ReadUint16(buf, len, &object->permission)) {
6779  goto error;
6780  }
6781  if (!DNP3ReadUint32(buf, len, &object->file_id)) {
6782  goto error;
6783  }
6784  if (!DNP3ReadUint32(buf, len, &object->owner_id)) {
6785  goto error;
6786  }
6787  if (!DNP3ReadUint32(buf, len, &object->group_id)) {
6788  goto error;
6789  }
6790  if (!DNP3ReadUint8(buf, len, &object->file_function_code)) {
6791  goto error;
6792  }
6793  if (!DNP3ReadUint8(buf, len, &object->status_code)) {
6794  goto error;
6795  }
6796  if (*len < object->filename_size) {
6797  goto error;
6798  }
6799  object->filename = SCMalloc((size_t)object->filename_size + 1);
6800  if (unlikely(object->filename == NULL)) {
6801  goto error;
6802  }
6803  if (object->filename_size > 0) {
6804  memcpy(object->filename, *buf, object->filename_size);
6805  }
6806  object->filename[object->filename_size] = '\0';
6807  *buf += object->filename_size;
6808  *len -= object->filename_size;
6809  if (!DNP3ReadUint16(buf, len, &object->data_size)) {
6810  goto error;
6811  }
6812  if (*len < object->data_size) {
6813  goto error;
6814  }
6815  object->data = SCMalloc((size_t)object->data_size + 1);
6816  if (unlikely(object->data == NULL)) {
6817  goto error;
6818  }
6819  if (object->data_size > 0) {
6820  memcpy(object->data, *buf, object->data_size);
6821  }
6822  object->data[object->data_size] = '\0';
6823  *buf += object->data_size;
6824  *len -= object->data_size;
6825 
6826  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
6827  goto error;
6828  }
6829 
6830  object = NULL;
6831  point_index++;
6832  }
6833 
6834  return 1;
6835 error:
6836  if (object != NULL) {
6837  if (object->filename != NULL) {
6838  SCFree(object->filename);
6839  }
6840  if (object->data != NULL) {
6841  SCFree(object->data);
6842  }
6843  SCFree(object);
6844  }
6845 
6846  return 0;
6847 }
6848 
6849 static int DNP3DecodeObjectG70V2(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
6850  uint32_t start, uint32_t count, DNP3PointList *points)
6851 {
6852  DNP3ObjectG70V2 *object = NULL;
6853  uint32_t prefix = 0;
6854  uint32_t point_index = start;
6855 
6856  if (*len < count/8) {
6857  goto error;
6858  }
6859  while (count--) {
6860 
6861  object = SCCalloc(1, sizeof(*object));
6862  if (unlikely(object == NULL)) {
6863  goto error;
6864  }
6865 
6866  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
6867  goto error;
6868  }
6869 
6870  if (!DNP3ReadUint16(buf, len, &object->username_offset)) {
6871  goto error;
6872  }
6873  if (!DNP3ReadUint16(buf, len, &object->username_size)) {
6874  goto error;
6875  }
6876  if (!DNP3ReadUint16(buf, len, &object->password_offset)) {
6877  goto error;
6878  }
6879  if (!DNP3ReadUint16(buf, len, &object->password_size)) {
6880  goto error;
6881  }
6882  if (!DNP3ReadUint32(buf, len, &object->authentication_key)) {
6883  goto error;
6884  }
6885  if (*len < object->username_size) {
6886  goto error;
6887  }
6888  object->username = SCMalloc((size_t)object->username_size + 1);
6889  if (unlikely(object->username == NULL)) {
6890  goto error;
6891  }
6892  if (object->username_size > 0) {
6893  memcpy(object->username, *buf, object->username_size);
6894  }
6895  object->username[object->username_size] = '\0';
6896  *buf += object->username_size;
6897  *len -= object->username_size;
6898  if (*len < object->password_size) {
6899  goto error;
6900  }
6901  object->password = SCMalloc((size_t)object->password_size + 1);
6902  if (unlikely(object->password == NULL)) {
6903  goto error;
6904  }
6905  if (object->password_size > 0) {
6906  memcpy(object->password, *buf, object->password_size);
6907  }
6908  object->password[object->password_size] = '\0';
6909  *buf += object->password_size;
6910  *len -= object->password_size;
6911 
6912  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
6913  goto error;
6914  }
6915 
6916  object = NULL;
6917  point_index++;
6918  }
6919 
6920  return 1;
6921 error:
6922  if (object != NULL) {
6923  if (object->username != NULL) {
6924  SCFree(object->username);
6925  }
6926  if (object->password != NULL) {
6927  SCFree(object->password);
6928  }
6929  SCFree(object);
6930  }
6931 
6932  return 0;
6933 }
6934 
6935 static int DNP3DecodeObjectG70V3(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
6936  uint32_t start, uint32_t count, DNP3PointList *points)
6937 {
6938  DNP3ObjectG70V3 *object = NULL;
6939  uint32_t prefix = 0;
6940  uint32_t point_index = start;
6941 
6942  if (*len < count/8) {
6943  goto error;
6944  }
6945  while (count--) {
6946 
6947  object = SCCalloc(1, sizeof(*object));
6948  if (unlikely(object == NULL)) {
6949  goto error;
6950  }
6951 
6952  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
6953  goto error;
6954  }
6955 
6956  if (!DNP3ReadUint16(buf, len, &object->filename_offset)) {
6957  goto error;
6958  }
6959  if (!DNP3ReadUint16(buf, len, &object->filename_size)) {
6960  goto error;
6961  }
6962  if (!DNP3ReadUint48(buf, len, &object->created)) {
6963  goto error;
6964  }
6965  if (!DNP3ReadUint16(buf, len, &object->permissions)) {
6966  goto error;
6967  }
6968  if (!DNP3ReadUint32(buf, len, &object->authentication_key)) {
6969  goto error;
6970  }
6971  if (!DNP3ReadUint32(buf, len, &object->file_size)) {
6972  goto error;
6973  }
6974  if (!DNP3ReadUint16(buf, len, &object->operational_mode)) {
6975  goto error;
6976  }
6977  if (!DNP3ReadUint16(buf, len, &object->maximum_block_size)) {
6978  goto error;
6979  }
6980  if (!DNP3ReadUint16(buf, len, &object->request_id)) {
6981  goto error;
6982  }
6983  if (*len < object->filename_size) {
6984  goto error;
6985  }
6986  object->filename = SCMalloc((size_t)object->filename_size + 1);
6987  if (unlikely(object->filename == NULL)) {
6988  goto error;
6989  }
6990  if (object->filename_size > 0) {
6991  memcpy(object->filename, *buf, object->filename_size);
6992  }
6993  object->filename[object->filename_size] = '\0';
6994  *buf += object->filename_size;
6995  *len -= object->filename_size;
6996 
6997  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
6998  goto error;
6999  }
7000 
7001  object = NULL;
7002  point_index++;
7003  }
7004 
7005  return 1;
7006 error:
7007  if (object != NULL) {
7008  if (object->filename != NULL) {
7009  SCFree(object->filename);
7010  }
7011  SCFree(object);
7012  }
7013 
7014  return 0;
7015 }
7016 
7017 static int DNP3DecodeObjectG70V4(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
7018  uint32_t start, uint32_t count, DNP3PointList *points)
7019 {
7020  DNP3ObjectG70V4 *object = NULL;
7021  uint32_t prefix = 0;
7022  uint32_t point_index = start;
7023  uint32_t offset;
7024 
7025  if (!DNP3PrefixIsSize(prefix_code)) {
7026  goto error;
7027  }
7028 
7029  if (*len < count/8) {
7030  goto error;
7031  }
7032  while (count--) {
7033 
7034  object = SCCalloc(1, sizeof(*object));
7035  if (unlikely(object == NULL)) {
7036  goto error;
7037  }
7038 
7039  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
7040  goto error;
7041  }
7042 
7043  offset = *len;
7044 
7045  if (!DNP3ReadUint32(buf, len, &object->file_handle)) {
7046  goto error;
7047  }
7048  if (!DNP3ReadUint32(buf, len, &object->file_size)) {
7049  goto error;
7050  }
7051  if (!DNP3ReadUint16(buf, len, &object->maximum_block_size)) {
7052  goto error;
7053  }
7054  if (!DNP3ReadUint16(buf, len, &object->request_id)) {
7055  goto error;
7056  }
7057  if (!DNP3ReadUint8(buf, len, &object->status_code)) {
7058  goto error;
7059  }
7060  if (prefix - (offset - *len) >= 256 || prefix < (offset - *len)) {
7061  goto error;
7062  }
7063  object->optional_text_len = (uint8_t)(prefix - (offset - *len));
7064  if (object->optional_text_len > 0) {
7065  if (*len < object->optional_text_len) {
7066  /* Not enough data. */
7067  goto error;
7068  }
7069  memcpy(object->optional_text, *buf, object->optional_text_len);
7070  *buf += object->optional_text_len;
7071  *len -= object->optional_text_len;
7072  }
7073  object->optional_text[object->optional_text_len] = '\0';
7074 
7075  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
7076  goto error;
7077  }
7078 
7079  object = NULL;
7080  point_index++;
7081  }
7082 
7083  return 1;
7084 error:
7085  if (object != NULL) {
7086  SCFree(object);
7087  }
7088 
7089  return 0;
7090 }
7091 
7092 static int DNP3DecodeObjectG70V5(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
7093  uint32_t start, uint32_t count, DNP3PointList *points)
7094 {
7095  DNP3ObjectG70V5 *object = NULL;
7096  uint32_t prefix = 0;
7097  uint32_t point_index = start;
7098  uint32_t offset;
7099 
7100  if (!DNP3PrefixIsSize(prefix_code)) {
7101  goto error;
7102  }
7103 
7104  if (*len < count/8) {
7105  goto error;
7106  }
7107  while (count--) {
7108 
7109  object = SCCalloc(1, sizeof(*object));
7110  if (unlikely(object == NULL)) {
7111  goto error;
7112  }
7113 
7114  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
7115  goto error;
7116  }
7117 
7118  offset = *len;
7119 
7120  if (!DNP3ReadUint32(buf, len, &object->file_handle)) {
7121  goto error;
7122  }
7123  if (!DNP3ReadUint32(buf, len, &object->block_number)) {
7124  goto error;
7125  }
7126  if (prefix - (offset - *len) >= 256 || prefix < (offset - *len)) {
7127  goto error;
7128  }
7129  object->file_data_len = (uint8_t)(prefix - (offset - *len));
7130  if (object->file_data_len > 0) {
7131  if (*len < object->file_data_len) {
7132  /* Not enough data. */
7133  goto error;
7134  }
7135  memcpy(object->file_data, *buf, object->file_data_len);
7136  *buf += object->file_data_len;
7137  *len -= object->file_data_len;
7138  }
7139  object->file_data[object->file_data_len] = '\0';
7140 
7141  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
7142  goto error;
7143  }
7144 
7145  object = NULL;
7146  point_index++;
7147  }
7148 
7149  return 1;
7150 error:
7151  if (object != NULL) {
7152  SCFree(object);
7153  }
7154 
7155  return 0;
7156 }
7157 
7158 static int DNP3DecodeObjectG70V6(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
7159  uint32_t start, uint32_t count, DNP3PointList *points)
7160 {
7161  DNP3ObjectG70V6 *object = NULL;
7162  uint32_t prefix = 0;
7163  uint32_t point_index = start;
7164  uint32_t offset;
7165 
7166  if (!DNP3PrefixIsSize(prefix_code)) {
7167  goto error;
7168  }
7169 
7170  if (*len < count/8) {
7171  goto error;
7172  }
7173  while (count--) {
7174 
7175  object = SCCalloc(1, sizeof(*object));
7176  if (unlikely(object == NULL)) {
7177  goto error;
7178  }
7179 
7180  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
7181  goto error;
7182  }
7183 
7184  offset = *len;
7185 
7186  if (!DNP3ReadUint32(buf, len, &object->file_handle)) {
7187  goto error;
7188  }
7189  if (!DNP3ReadUint32(buf, len, &object->block_number)) {
7190  goto error;
7191  }
7192  if (!DNP3ReadUint8(buf, len, &object->status_code)) {
7193  goto error;
7194  }
7195  if (prefix - (offset - *len) >= 256 || prefix < (offset - *len)) {
7196  goto error;
7197  }
7198  object->optional_text_len = (uint8_t)(prefix - (offset - *len));
7199  if (object->optional_text_len > 0) {
7200  if (*len < object->optional_text_len) {
7201  /* Not enough data. */
7202  goto error;
7203  }
7204  memcpy(object->optional_text, *buf, object->optional_text_len);
7205  *buf += object->optional_text_len;
7206  *len -= object->optional_text_len;
7207  }
7208  object->optional_text[object->optional_text_len] = '\0';
7209 
7210  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
7211  goto error;
7212  }
7213 
7214  object = NULL;
7215  point_index++;
7216  }
7217 
7218  return 1;
7219 error:
7220  if (object != NULL) {
7221  SCFree(object);
7222  }
7223 
7224  return 0;
7225 }
7226 
7227 static int DNP3DecodeObjectG70V7(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
7228  uint32_t start, uint32_t count, DNP3PointList *points)
7229 {
7230  DNP3ObjectG70V7 *object = NULL;
7231  uint32_t prefix = 0;
7232  uint32_t point_index = start;
7233 
7234  if (*len < count/8) {
7235  goto error;
7236  }
7237  while (count--) {
7238 
7239  object = SCCalloc(1, sizeof(*object));
7240  if (unlikely(object == NULL)) {
7241  goto error;
7242  }
7243 
7244  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
7245  goto error;
7246  }
7247 
7248  if (!DNP3ReadUint16(buf, len, &object->filename_offset)) {
7249  goto error;
7250  }
7251  if (!DNP3ReadUint16(buf, len, &object->filename_size)) {
7252  goto error;
7253  }
7254  if (!DNP3ReadUint16(buf, len, &object->file_type)) {
7255  goto error;
7256  }
7257  if (!DNP3ReadUint32(buf, len, &object->file_size)) {
7258  goto error;
7259  }
7260  if (!DNP3ReadUint48(buf, len, &object->created_timestamp)) {
7261  goto error;
7262  }
7263  if (!DNP3ReadUint16(buf, len, &object->permissions)) {
7264  goto error;
7265  }
7266  if (!DNP3ReadUint16(buf, len, &object->request_id)) {
7267  goto error;
7268  }
7269  if (*len < object->filename_size) {
7270  goto error;
7271  }
7272  object->filename = SCMalloc((size_t)object->filename_size + 1);
7273  if (unlikely(object->filename == NULL)) {
7274  goto error;
7275  }
7276  if (object->filename_size > 0) {
7277  memcpy(object->filename, *buf, object->filename_size);
7278  }
7279  object->filename[object->filename_size] = '\0';
7280  *buf += object->filename_size;
7281  *len -= object->filename_size;
7282 
7283  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
7284  goto error;
7285  }
7286 
7287  object = NULL;
7288  point_index++;
7289  }
7290 
7291  return 1;
7292 error:
7293  if (object != NULL) {
7294  if (object->filename != NULL) {
7295  SCFree(object->filename);
7296  }
7297  SCFree(object);
7298  }
7299 
7300  return 0;
7301 }
7302 
7303 static int DNP3DecodeObjectG70V8(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
7304  uint32_t start, uint32_t count, DNP3PointList *points)
7305 {
7306  DNP3ObjectG70V8 *object = NULL;
7307  uint32_t prefix = 0;
7308  uint32_t point_index = start;
7309  uint32_t offset;
7310 
7311  if (prefix_code != 5) {
7312  goto error;
7313  }
7314 
7315  if (*len < count/8) {
7316  goto error;
7317  }
7318  while (count--) {
7319 
7320  object = SCCalloc(1, sizeof(*object));
7321  if (unlikely(object == NULL)) {
7322  goto error;
7323  }
7324 
7325  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
7326  goto error;
7327  }
7328 
7329  offset = *len;
7330 
7331  if (prefix - (offset - *len) >= 65536 || prefix < (offset - *len)) {
7332  goto error;
7333  }
7334  object->file_specification_len = (uint16_t)(prefix - (offset - *len));
7335  if (*len < object->file_specification_len) {
7336  goto error;
7337  }
7338  object->file_specification = SCMalloc((size_t)object->file_specification_len + 1);
7339  if (unlikely(object->file_specification == NULL)) {
7340  goto error;
7341  }
7342  if (object->file_specification_len > 0) {
7343  memcpy(object->file_specification, *buf, object->file_specification_len);
7344  }
7345  object->file_specification[object->file_specification_len] = '\0';
7346  *buf += object->file_specification_len;
7347  *len -= object->file_specification_len;
7348 
7349  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
7350  goto error;
7351  }
7352 
7353  object = NULL;
7354  point_index++;
7355  }
7356 
7357  return 1;
7358 error:
7359  if (object != NULL) {
7360  if (object->file_specification != NULL) {
7361  SCFree(object->file_specification);
7362  }
7363  SCFree(object);
7364  }
7365 
7366  return 0;
7367 }
7368 
7369 static int DNP3DecodeObjectG80V1(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
7370  uint32_t start, uint32_t count, DNP3PointList *points)
7371 {
7372  DNP3ObjectG80V1 *object = NULL;
7373  uint32_t bytes = (count / 8) + 1;
7374  uint32_t prefix = 0;
7375  uint32_t point_index = start;
7376 
7377  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
7378  goto error;
7379  }
7380 
7381  for (uint32_t i = 0; i < bytes; i++) {
7382 
7383  uint8_t octet;
7384 
7385  if (!DNP3ReadUint8(buf, len, &octet)) {
7386  goto error;
7387  }
7388 
7389  for (int j = 0; j < 8 && count; j = j + 1) {
7390 
7391  object = SCCalloc(1, sizeof(*object));
7392  if (unlikely(object == NULL)) {
7393  goto error;
7394  }
7395 
7396  object->state = (octet >> j) & 0x1;
7397 
7398  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
7399  goto error;
7400  }
7401 
7402  object = NULL;
7403  count--;
7404  point_index++;
7405  }
7406 
7407  }
7408 
7409  return 1;
7410 error:
7411  if (object != NULL) {
7412  SCFree(object);
7413  }
7414  return 0;
7415 }
7416 
7417 static int DNP3DecodeObjectG81V1(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
7418  uint32_t start, uint32_t count, DNP3PointList *points)
7419 {
7420  DNP3ObjectG81V1 *object = NULL;
7421  uint32_t prefix = 0;
7422  uint32_t point_index = start;
7423 
7424  if (*len < count/8) {
7425  goto error;
7426  }
7427  while (count--) {
7428 
7429  object = SCCalloc(1, sizeof(*object));
7430  if (unlikely(object == NULL)) {
7431  goto error;
7432  }
7433 
7434  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
7435  goto error;
7436  }
7437 
7438  {
7439  uint8_t octet;
7440  if (!DNP3ReadUint8(buf, len, &octet)) {
7441  goto error;
7442  }
7443  object->fill_percentage = (octet >> 0) & 0x7f;
7444  object->overflow_state = (octet >> 7) & 0x1;
7445  }
7446  if (!DNP3ReadUint8(buf, len, &object->group)) {
7447  goto error;
7448  }
7449  if (!DNP3ReadUint8(buf, len, &object->variation)) {
7450  goto error;
7451  }
7452 
7453  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
7454  goto error;
7455  }
7456 
7457  object = NULL;
7458  point_index++;
7459  }
7460 
7461  return 1;
7462 error:
7463  if (object != NULL) {
7464  SCFree(object);
7465  }
7466 
7467  return 0;
7468 }
7469 
7470 static int DNP3DecodeObjectG83V1(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
7471  uint32_t start, uint32_t count, DNP3PointList *points)
7472 {
7473  DNP3ObjectG83V1 *object = NULL;
7474  uint32_t prefix = 0;
7475  uint32_t point_index = start;
7476 
7477  if (*len < count/8) {
7478  goto error;
7479  }
7480  while (count--) {
7481 
7482  object = SCCalloc(1, sizeof(*object));
7483  if (unlikely(object == NULL)) {
7484  goto error;
7485  }
7486 
7487  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
7488  goto error;
7489  }
7490 
7491  if (*len < 4) {
7492  goto error;
7493  }
7494  memcpy(object->vendor_code, *buf, 4);
7495  object->vendor_code[4] = '\0';
7496  *buf += 4;
7497  *len -= 4;
7498  if (!DNP3ReadUint16(buf, len, &object->object_id)) {
7499  goto error;
7500  }
7501  if (!DNP3ReadUint16(buf, len, &object->length)) {
7502  goto error;
7503  }
7504  if (object->length > 0) {
7505  if (*len < object->length) {
7506  /* Not enough data. */
7507  goto error;
7508  }
7509  object->data_objects = SCCalloc(1, object->length);
7510  if (unlikely(object->data_objects == NULL)) {
7511  goto error;
7512  }
7513  memcpy(object->data_objects, *buf, object->length);
7514  *buf += object->length;
7515  *len -= object->length;
7516  }
7517 
7518  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
7519  goto error;
7520  }
7521 
7522  object = NULL;
7523  point_index++;
7524  }
7525 
7526  return 1;
7527 error:
7528  if (object != NULL) {
7529  if (object->data_objects != NULL) {
7530  SCFree(object->data_objects);
7531  }
7532  SCFree(object);
7533  }
7534 
7535  return 0;
7536 }
7537 
7538 static int DNP3DecodeObjectG86V2(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
7539  uint32_t start, uint32_t count, DNP3PointList *points)
7540 {
7541  DNP3ObjectG86V2 *object = NULL;
7542  uint32_t prefix = 0;
7543  uint32_t point_index = start;
7544 
7545  if (*len < count/8) {
7546  goto error;
7547  }
7548  while (count--) {
7549 
7550  object = SCCalloc(1, sizeof(*object));
7551  if (unlikely(object == NULL)) {
7552  goto error;
7553  }
7554 
7555  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
7556  goto error;
7557  }
7558 
7559  {
7560  uint8_t octet;
7561  if (!DNP3ReadUint8(buf, len, &octet)) {
7562  goto error;
7563  }
7564  object->rd = (octet >> 0) & 0x1;
7565  object->wr = (octet >> 1) & 0x1;
7566  object->st = (octet >> 2) & 0x1;
7567  object->ev = (octet >> 3) & 0x1;
7568  object->df = (octet >> 4) & 0x1;
7569  object->padding0 = (octet >> 5) & 0x1;
7570  object->padding1 = (octet >> 6) & 0x1;
7571  object->padding2 = (octet >> 7) & 0x1;
7572  }
7573 
7574  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
7575  goto error;
7576  }
7577 
7578  object = NULL;
7579  point_index++;
7580  }
7581 
7582  return 1;
7583 error:
7584  if (object != NULL) {
7585  SCFree(object);
7586  }
7587 
7588  return 0;
7589 }
7590 
7591 static int DNP3DecodeObjectG102V1(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
7592  uint32_t start, uint32_t count, DNP3PointList *points)
7593 {
7594  DNP3ObjectG102V1 *object = NULL;
7595  uint32_t prefix = 0;
7596  uint32_t point_index = start;
7597 
7598  if (*len < count/8) {
7599  goto error;
7600  }
7601  while (count--) {
7602 
7603  object = SCCalloc(1, sizeof(*object));
7604  if (unlikely(object == NULL)) {
7605  goto error;
7606  }
7607 
7608  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
7609  goto error;
7610  }
7611 
7612  if (!DNP3ReadUint8(buf, len, &object->value)) {
7613  goto error;
7614  }
7615 
7616  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
7617  goto error;
7618  }
7619 
7620  object = NULL;
7621  point_index++;
7622  }
7623 
7624  return 1;
7625 error:
7626  if (object != NULL) {
7627  SCFree(object);
7628  }
7629 
7630  return 0;
7631 }
7632 
7633 static int DNP3DecodeObjectG120V1(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
7634  uint32_t start, uint32_t count, DNP3PointList *points)
7635 {
7636  DNP3ObjectG120V1 *object = NULL;
7637  uint32_t prefix = 0;
7638  uint32_t point_index = start;
7639  uint32_t offset;
7640 
7641  if (prefix_code != 5) {
7642  goto error;
7643  }
7644 
7645  if (*len < count/8) {
7646  goto error;
7647  }
7648  while (count--) {
7649 
7650  object = SCCalloc(1, sizeof(*object));
7651  if (unlikely(object == NULL)) {
7652  goto error;
7653  }
7654 
7655  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
7656  goto error;
7657  }
7658 
7659  offset = *len;
7660 
7661  if (!DNP3ReadUint32(buf, len, &object->csq)) {
7662  goto error;
7663  }
7664  if (!DNP3ReadUint16(buf, len, &object->usr)) {
7665  goto error;
7666  }
7667  if (!DNP3ReadUint8(buf, len, &object->mal)) {
7668  goto error;
7669  }
7670  if (!DNP3ReadUint8(buf, len, &object->reason)) {
7671  goto error;
7672  }
7673  if (prefix < (offset - *len)) {
7674  goto error;
7675  }
7676  object->challenge_data_len = (uint16_t)(prefix - (offset - *len));
7677  if (object->challenge_data_len > 0) {
7678  if (*len < object->challenge_data_len) {
7679  /* Not enough data. */
7680  goto error;
7681  }
7682  object->challenge_data = SCCalloc(1, object->challenge_data_len);
7683  if (unlikely(object->challenge_data == NULL)) {
7684  goto error;
7685  }
7686  memcpy(object->challenge_data, *buf, object->challenge_data_len);
7687  *buf += object->challenge_data_len;
7688  *len -= object->challenge_data_len;
7689  }
7690 
7691  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
7692  goto error;
7693  }
7694 
7695  object = NULL;
7696  point_index++;
7697  }
7698 
7699  return 1;
7700 error:
7701  if (object != NULL) {
7702  if (object->challenge_data != NULL) {
7703  SCFree(object->challenge_data);
7704  }
7705  SCFree(object);
7706  }
7707 
7708  return 0;
7709 }
7710 
7711 static int DNP3DecodeObjectG120V2(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
7712  uint32_t start, uint32_t count, DNP3PointList *points)
7713 {
7714  DNP3ObjectG120V2 *object = NULL;
7715  uint32_t prefix = 0;
7716  uint32_t point_index = start;
7717  uint32_t offset;
7718 
7719  if (prefix_code != 5) {
7720  goto error;
7721  }
7722 
7723  if (*len < count/8) {
7724  goto error;
7725  }
7726  while (count--) {
7727 
7728  object = SCCalloc(1, sizeof(*object));
7729  if (unlikely(object == NULL)) {
7730  goto error;
7731  }
7732 
7733  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
7734  goto error;
7735  }
7736 
7737  offset = *len;
7738 
7739  if (!DNP3ReadUint32(buf, len, &object->csq)) {
7740  goto error;
7741  }
7742  if (!DNP3ReadUint16(buf, len, &object->usr)) {
7743  goto error;
7744  }
7745  if (prefix < (offset - *len)) {
7746  goto error;
7747  }
7748  object->mac_value_len = (uint16_t)(prefix - (offset - *len));
7749  if (object->mac_value_len > 0) {
7750  if (*len < object->mac_value_len) {
7751  /* Not enough data. */
7752  goto error;
7753  }
7754  object->mac_value = SCCalloc(1, object->mac_value_len);
7755  if (unlikely(object->mac_value == NULL)) {
7756  goto error;
7757  }
7758  memcpy(object->mac_value, *buf, object->mac_value_len);
7759  *buf += object->mac_value_len;
7760  *len -= object->mac_value_len;
7761  }
7762 
7763  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
7764  goto error;
7765  }
7766 
7767  object = NULL;
7768  point_index++;
7769  }
7770 
7771  return 1;
7772 error:
7773  if (object != NULL) {
7774  if (object->mac_value != NULL) {
7775  SCFree(object->mac_value);
7776  }
7777  SCFree(object);
7778  }
7779 
7780  return 0;
7781 }
7782 
7783 static int DNP3DecodeObjectG120V3(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
7784  uint32_t start, uint32_t count, DNP3PointList *points)
7785 {
7786  DNP3ObjectG120V3 *object = NULL;
7787  uint32_t prefix = 0;
7788  uint32_t point_index = start;
7789 
7790  if (*len < count/8) {
7791  goto error;
7792  }
7793  while (count--) {
7794 
7795  object = SCCalloc(1, sizeof(*object));
7796  if (unlikely(object == NULL)) {
7797  goto error;
7798  }
7799 
7800  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
7801  goto error;
7802  }
7803 
7804  if (!DNP3ReadUint32(buf, len, &object->csq)) {
7805  goto error;
7806  }
7807  if (!DNP3ReadUint16(buf, len, &object->user_number)) {
7808  goto error;
7809  }
7810 
7811  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
7812  goto error;
7813  }
7814 
7815  object = NULL;
7816  point_index++;
7817  }
7818 
7819  return 1;
7820 error:
7821  if (object != NULL) {
7822  SCFree(object);
7823  }
7824 
7825  return 0;
7826 }
7827 
7828 static int DNP3DecodeObjectG120V4(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
7829  uint32_t start, uint32_t count, DNP3PointList *points)
7830 {
7831  DNP3ObjectG120V4 *object = NULL;
7832  uint32_t prefix = 0;
7833  uint32_t point_index = start;
7834 
7835  if (*len < count/8) {
7836  goto error;
7837  }
7838  while (count--) {
7839 
7840  object = SCCalloc(1, sizeof(*object));
7841  if (unlikely(object == NULL)) {
7842  goto error;
7843  }
7844 
7845  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
7846  goto error;
7847  }
7848 
7849  if (!DNP3ReadUint16(buf, len, &object->user_number)) {
7850  goto error;
7851  }
7852 
7853  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
7854  goto error;
7855  }
7856 
7857  object = NULL;
7858  point_index++;
7859  }
7860 
7861  return 1;
7862 error:
7863  if (object != NULL) {
7864  SCFree(object);
7865  }
7866 
7867  return 0;
7868 }
7869 
7870 static int DNP3DecodeObjectG120V5(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
7871  uint32_t start, uint32_t count, DNP3PointList *points)
7872 {
7873  DNP3ObjectG120V5 *object = NULL;
7874  uint32_t prefix = 0;
7875  uint32_t point_index = start;
7876  uint32_t offset;
7877 
7878  if (prefix_code != 5) {
7879  goto error;
7880  }
7881 
7882  if (*len < count/8) {
7883  goto error;
7884  }
7885  while (count--) {
7886 
7887  object = SCCalloc(1, sizeof(*object));
7888  if (unlikely(object == NULL)) {
7889  goto error;
7890  }
7891 
7892  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
7893  goto error;
7894  }
7895 
7896  offset = *len;
7897 
7898  if (!DNP3ReadUint32(buf, len, &object->ksq)) {
7899  goto error;
7900  }
7901  if (!DNP3ReadUint16(buf, len, &object->user_number)) {
7902  goto error;
7903  }
7904  if (!DNP3ReadUint8(buf, len, &object->key_wrap_alg)) {
7905  goto error;
7906  }
7907  if (!DNP3ReadUint8(buf, len, &object->key_status)) {
7908  goto error;
7909  }
7910  if (!DNP3ReadUint8(buf, len, &object->mal)) {
7911  goto error;
7912  }
7913  if (!DNP3ReadUint16(buf, len, &object->challenge_data_len)) {
7914  goto error;
7915  }
7916  if (object->challenge_data_len > 0) {
7917  if (*len < object->challenge_data_len) {
7918  /* Not enough data. */
7919  goto error;
7920  }
7921  object->challenge_data = SCCalloc(1, object->challenge_data_len);
7922  if (unlikely(object->challenge_data == NULL)) {
7923  goto error;
7924  }
7925  memcpy(object->challenge_data, *buf, object->challenge_data_len);
7926  *buf += object->challenge_data_len;
7927  *len -= object->challenge_data_len;
7928  }
7929  if (prefix < (offset - *len)) {
7930  goto error;
7931  }
7932  object->mac_value_len = (uint16_t)(prefix - (offset - *len));
7933  if (object->mac_value_len > 0) {
7934  if (*len < object->mac_value_len) {
7935  /* Not enough data. */
7936  goto error;
7937  }
7938  object->mac_value = SCCalloc(1, object->mac_value_len);
7939  if (unlikely(object->mac_value == NULL)) {
7940  goto error;
7941  }
7942  memcpy(object->mac_value, *buf, object->mac_value_len);
7943  *buf += object->mac_value_len;
7944  *len -= object->mac_value_len;
7945  }
7946 
7947  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
7948  goto error;
7949  }
7950 
7951  object = NULL;
7952  point_index++;
7953  }
7954 
7955  return 1;
7956 error:
7957  if (object != NULL) {
7958  if (object->challenge_data != NULL) {
7959  SCFree(object->challenge_data);
7960  }
7961  if (object->mac_value != NULL) {
7962  SCFree(object->mac_value);
7963  }
7964  SCFree(object);
7965  }
7966 
7967  return 0;
7968 }
7969 
7970 static int DNP3DecodeObjectG120V6(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
7971  uint32_t start, uint32_t count, DNP3PointList *points)
7972 {
7973  DNP3ObjectG120V6 *object = NULL;
7974  uint32_t prefix = 0;
7975  uint32_t point_index = start;
7976  uint32_t offset;
7977 
7978  if (prefix_code != 5) {
7979  goto error;
7980  }
7981 
7982  if (*len < count/8) {
7983  goto error;
7984  }
7985  while (count--) {
7986 
7987  object = SCCalloc(1, sizeof(*object));
7988  if (unlikely(object == NULL)) {
7989  goto error;
7990  }
7991 
7992  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
7993  goto error;
7994  }
7995 
7996  offset = *len;
7997 
7998  if (!DNP3ReadUint24(buf, len, &object->ksq)) {
7999  goto error;
8000  }
8001  if (!DNP3ReadUint16(buf, len, &object->usr)) {
8002  goto error;
8003  }
8004  if (prefix < (offset - *len)) {
8005  goto error;
8006  }
8007  object->wrapped_key_data_len = (uint16_t)(prefix - (offset - *len));
8008  if (object->wrapped_key_data_len > 0) {
8009  if (*len < object->wrapped_key_data_len) {
8010  /* Not enough data. */
8011  goto error;
8012  }
8013  object->wrapped_key_data = SCCalloc(1, object->wrapped_key_data_len);
8014  if (unlikely(object->wrapped_key_data == NULL)) {
8015  goto error;
8016  }
8017  memcpy(object->wrapped_key_data, *buf, object->wrapped_key_data_len);
8018  *buf += object->wrapped_key_data_len;
8019  *len -= object->wrapped_key_data_len;
8020  }
8021 
8022  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
8023  goto error;
8024  }
8025 
8026  object = NULL;
8027  point_index++;
8028  }
8029 
8030  return 1;
8031 error:
8032  if (object != NULL) {
8033  if (object->wrapped_key_data != NULL) {
8034  SCFree(object->wrapped_key_data);
8035  }
8036  SCFree(object);
8037  }
8038 
8039  return 0;
8040 }
8041 
8042 static int DNP3DecodeObjectG120V7(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
8043  uint32_t start, uint32_t count, DNP3PointList *points)
8044 {
8045  DNP3ObjectG120V7 *object = NULL;
8046  uint32_t prefix = 0;
8047  uint32_t point_index = start;
8048  uint32_t offset;
8049 
8050  if (prefix_code != 5) {
8051  goto error;
8052  }
8053 
8054  if (*len < count/8) {
8055  goto error;
8056  }
8057  while (count--) {
8058 
8059  object = SCCalloc(1, sizeof(*object));
8060  if (unlikely(object == NULL)) {
8061  goto error;
8062  }
8063 
8064  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
8065  goto error;
8066  }
8067 
8068  offset = *len;
8069 
8070  if (!DNP3ReadUint32(buf, len, &object->sequence_number)) {
8071  goto error;
8072  }
8073  if (!DNP3ReadUint16(buf, len, &object->usr)) {
8074  goto error;
8075  }
8076  if (!DNP3ReadUint16(buf, len, &object->association_id)) {
8077  goto error;
8078  }
8079  if (!DNP3ReadUint8(buf, len, &object->error_code)) {
8080  goto error;
8081  }
8082  if (!DNP3ReadUint48(buf, len, &object->time_of_error)) {
8083  goto error;
8084  }
8085  if (prefix - (offset - *len) >= 65536 || prefix < (offset - *len)) {
8086  goto error;
8087  }
8088  object->error_text_len = (uint16_t)(prefix - (offset - *len));
8089  if (*len < object->error_text_len) {
8090  goto error;
8091  }
8092  object->error_text = SCMalloc((size_t)object->error_text_len + 1);
8093  if (unlikely(object->error_text == NULL)) {
8094  goto error;
8095  }
8096  if (object->error_text_len > 0) {
8097  memcpy(object->error_text, *buf, object->error_text_len);
8098  }
8099  object->error_text[object->error_text_len] = '\0';
8100  *buf += object->error_text_len;
8101  *len -= object->error_text_len;
8102 
8103  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
8104  goto error;
8105  }
8106 
8107  object = NULL;
8108  point_index++;
8109  }
8110 
8111  return 1;
8112 error:
8113  if (object != NULL) {
8114  if (object->error_text != NULL) {
8115  SCFree(object->error_text);
8116  }
8117  SCFree(object);
8118  }
8119 
8120  return 0;
8121 }
8122 
8123 static int DNP3DecodeObjectG120V8(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
8124  uint32_t start, uint32_t count, DNP3PointList *points)
8125 {
8126  DNP3ObjectG120V8 *object = NULL;
8127  uint32_t prefix = 0;
8128  uint32_t point_index = start;
8129  uint32_t offset;
8130 
8131  if (prefix_code != 5) {
8132  goto error;
8133  }
8134 
8135  if (*len < count/8) {
8136  goto error;
8137  }
8138  while (count--) {
8139 
8140  object = SCCalloc(1, sizeof(*object));
8141  if (unlikely(object == NULL)) {
8142  goto error;
8143  }
8144 
8145  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
8146  goto error;
8147  }
8148 
8149  offset = *len;
8150 
8151  if (!DNP3ReadUint8(buf, len, &object->key_change_method)) {
8152  goto error;
8153  }
8154  if (!DNP3ReadUint8(buf, len, &object->certificate_type)) {
8155  goto error;
8156  }
8157  if (prefix < (offset - *len)) {
8158  goto error;
8159  }
8160  object->certificate_len = (uint16_t)(prefix - (offset - *len));
8161  if (object->certificate_len > 0) {
8162  if (*len < object->certificate_len) {
8163  /* Not enough data. */
8164  goto error;
8165  }
8166  object->certificate = SCCalloc(1, object->certificate_len);
8167  if (unlikely(object->certificate == NULL)) {
8168  goto error;
8169  }
8170  memcpy(object->certificate, *buf, object->certificate_len);
8171  *buf += object->certificate_len;
8172  *len -= object->certificate_len;
8173  }
8174 
8175  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
8176  goto error;
8177  }
8178 
8179  object = NULL;
8180  point_index++;
8181  }
8182 
8183  return 1;
8184 error:
8185  if (object != NULL) {
8186  if (object->certificate != NULL) {
8187  SCFree(object->certificate);
8188  }
8189  SCFree(object);
8190  }
8191 
8192  return 0;
8193 }
8194 
8195 static int DNP3DecodeObjectG120V9(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
8196  uint32_t start, uint32_t count, DNP3PointList *points)
8197 {
8198  DNP3ObjectG120V9 *object = NULL;
8199  uint32_t prefix = 0;
8200  uint32_t point_index = start;
8201  uint32_t offset;
8202 
8203  if (*len < count/8) {
8204  goto error;
8205  }
8206  while (count--) {
8207 
8208  object = SCCalloc(1, sizeof(*object));
8209  if (unlikely(object == NULL)) {
8210  goto error;
8211  }
8212 
8213  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
8214  goto error;
8215  }
8216 
8217  offset = *len;
8218 
8219  if (prefix < (offset - *len)) {
8220  goto error;
8221  }
8222  object->mac_value_len = (uint16_t)(prefix - (offset - *len));
8223  if (object->mac_value_len > 0) {
8224  if (*len < object->mac_value_len) {
8225  /* Not enough data. */
8226  goto error;
8227  }
8228  object->mac_value = SCCalloc(1, object->mac_value_len);
8229  if (unlikely(object->mac_value == NULL)) {
8230  goto error;
8231  }
8232  memcpy(object->mac_value, *buf, object->mac_value_len);
8233  *buf += object->mac_value_len;
8234  *len -= object->mac_value_len;
8235  }
8236 
8237  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
8238  goto error;
8239  }
8240 
8241  object = NULL;
8242  point_index++;
8243  }
8244 
8245  return 1;
8246 error:
8247  if (object != NULL) {
8248  if (object->mac_value != NULL) {
8249  SCFree(object->mac_value);
8250  }
8251  SCFree(object);
8252  }
8253 
8254  return 0;
8255 }
8256 
8257 static int DNP3DecodeObjectG120V10(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
8258  uint32_t start, uint32_t count, DNP3PointList *points)
8259 {
8260  DNP3ObjectG120V10 *object = NULL;
8261  uint32_t prefix = 0;
8262  uint32_t point_index = start;
8263 
8264  if (prefix_code != 5) {
8265  goto error;
8266  }
8267 
8268  if (*len < count/8) {
8269  goto error;
8270  }
8271  while (count--) {
8272 
8273  object = SCCalloc(1, sizeof(*object));
8274  if (unlikely(object == NULL)) {
8275  goto error;
8276  }
8277 
8278  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
8279  goto error;
8280  }
8281 
8282  if (!DNP3ReadUint8(buf, len, &object->key_change_method)) {
8283  goto error;
8284  }
8285  if (!DNP3ReadUint8(buf, len, &object->operation)) {
8286  goto error;
8287  }
8288  if (!DNP3ReadUint32(buf, len, &object->scs)) {
8289  goto error;
8290  }
8291  if (!DNP3ReadUint16(buf, len, &object->user_role)) {
8292  goto error;
8293  }
8294  if (!DNP3ReadUint16(buf, len, &object->user_role_expiry_interval)) {
8295  goto error;
8296  }
8297  if (!DNP3ReadUint16(buf, len, &object->username_len)) {
8298  goto error;
8299  }
8300  if (!DNP3ReadUint16(buf, len, &object->user_public_key_len)) {
8301  goto error;
8302  }
8303  if (!DNP3ReadUint16(buf, len, &object->certification_data_len)) {
8304  goto error;
8305  }
8306  if (*len < object->username_len) {
8307  goto error;
8308  }
8309  object->username = SCMalloc((size_t)object->username_len + 1);
8310  if (unlikely(object->username == NULL)) {
8311  goto error;
8312  }
8313  if (object->username_len > 0) {
8314  memcpy(object->username, *buf, object->username_len);
8315  }
8316  object->username[object->username_len] = '\0';
8317  *buf += object->username_len;
8318  *len -= object->username_len;
8319  if (object->user_public_key_len > 0) {
8320  if (*len < object->user_public_key_len) {
8321  /* Not enough data. */
8322  goto error;
8323  }
8324  object->user_public_key = SCCalloc(1, object->user_public_key_len);
8325  if (unlikely(object->user_public_key == NULL)) {
8326  goto error;
8327  }
8328  memcpy(object->user_public_key, *buf, object->user_public_key_len);
8329  *buf += object->user_public_key_len;
8330  *len -= object->user_public_key_len;
8331  }
8332  if (object->certification_data_len > 0) {
8333  if (*len < object->certification_data_len) {
8334  /* Not enough data. */
8335  goto error;
8336  }
8337  object->certification_data = SCCalloc(1, object->certification_data_len);
8338  if (unlikely(object->certification_data == NULL)) {
8339  goto error;
8340  }
8341  memcpy(object->certification_data, *buf, object->certification_data_len);
8342  *buf += object->certification_data_len;
8343  *len -= object->certification_data_len;
8344  }
8345 
8346  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
8347  goto error;
8348  }
8349 
8350  object = NULL;
8351  point_index++;
8352  }
8353 
8354  return 1;
8355 error:
8356  if (object != NULL) {
8357  if (object->username != NULL) {
8358  SCFree(object->username);
8359  }
8360  if (object->user_public_key != NULL) {
8361  SCFree(object->user_public_key);
8362  }
8363  if (object->certification_data != NULL) {
8364  SCFree(object->certification_data);
8365  }
8366  SCFree(object);
8367  }
8368 
8369  return 0;
8370 }
8371 
8372 static int DNP3DecodeObjectG120V11(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
8373  uint32_t start, uint32_t count, DNP3PointList *points)
8374 {
8375  DNP3ObjectG120V11 *object = NULL;
8376  uint32_t prefix = 0;
8377  uint32_t point_index = start;
8378 
8379  if (prefix_code != 5) {
8380  goto error;
8381  }
8382 
8383  if (*len < count/8) {
8384  goto error;
8385  }
8386  while (count--) {
8387 
8388  object = SCCalloc(1, sizeof(*object));
8389  if (unlikely(object == NULL)) {
8390  goto error;
8391  }
8392 
8393  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
8394  goto error;
8395  }
8396 
8397  if (!DNP3ReadUint8(buf, len, &object->key_change_method)) {
8398  goto error;
8399  }
8400  if (!DNP3ReadUint16(buf, len, &object->username_len)) {
8401  goto error;
8402  }
8403  if (!DNP3ReadUint16(buf, len, &object->master_challenge_data_len)) {
8404  goto error;
8405  }
8406  if (*len < object->username_len) {
8407  goto error;
8408  }
8409  object->username = SCMalloc((size_t)object->username_len + 1);
8410  if (unlikely(object->username == NULL)) {
8411  goto error;
8412  }
8413  if (object->username_len > 0) {
8414  memcpy(object->username, *buf, object->username_len);
8415  }
8416  object->username[object->username_len] = '\0';
8417  *buf += object->username_len;
8418  *len -= object->username_len;
8419  if (object->master_challenge_data_len > 0) {
8420  if (*len < object->master_challenge_data_len) {
8421  /* Not enough data. */
8422  goto error;
8423  }
8424  object->master_challenge_data = SCCalloc(1, object->master_challenge_data_len);
8425  if (unlikely(object->master_challenge_data == NULL)) {
8426  goto error;
8427  }
8428  memcpy(object->master_challenge_data, *buf, object->master_challenge_data_len);
8429  *buf += object->master_challenge_data_len;
8430  *len -= object->master_challenge_data_len;
8431  }
8432 
8433  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
8434  goto error;
8435  }
8436 
8437  object = NULL;
8438  point_index++;
8439  }
8440 
8441  return 1;
8442 error:
8443  if (object != NULL) {
8444  if (object->username != NULL) {
8445  SCFree(object->username);
8446  }
8447  if (object->master_challenge_data != NULL) {
8448  SCFree(object->master_challenge_data);
8449  }
8450  SCFree(object);
8451  }
8452 
8453  return 0;
8454 }
8455 
8456 static int DNP3DecodeObjectG120V12(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
8457  uint32_t start, uint32_t count, DNP3PointList *points)
8458 {
8459  DNP3ObjectG120V12 *object = NULL;
8460  uint32_t prefix = 0;
8461  uint32_t point_index = start;
8462 
8463  if (prefix_code != 5) {
8464  goto error;
8465  }
8466 
8467  if (*len < count/8) {
8468  goto error;
8469  }
8470  while (count--) {
8471 
8472  object = SCCalloc(1, sizeof(*object));
8473  if (unlikely(object == NULL)) {
8474  goto error;
8475  }
8476 
8477  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
8478  goto error;
8479  }
8480 
8481  if (!DNP3ReadUint32(buf, len, &object->ksq)) {
8482  goto error;
8483  }
8484  if (!DNP3ReadUint16(buf, len, &object->user_number)) {
8485  goto error;
8486  }
8487  if (!DNP3ReadUint16(buf, len, &object->challenge_data_len)) {
8488  goto error;
8489  }
8490  if (object->challenge_data_len > 0) {
8491  if (*len < object->challenge_data_len) {
8492  /* Not enough data. */
8493  goto error;
8494  }
8495  object->challenge_data = SCCalloc(1, object->challenge_data_len);
8496  if (unlikely(object->challenge_data == NULL)) {
8497  goto error;
8498  }
8499  memcpy(object->challenge_data, *buf, object->challenge_data_len);
8500  *buf += object->challenge_data_len;
8501  *len -= object->challenge_data_len;
8502  }
8503 
8504  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
8505  goto error;
8506  }
8507 
8508  object = NULL;
8509  point_index++;
8510  }
8511 
8512  return 1;
8513 error:
8514  if (object != NULL) {
8515  if (object->challenge_data != NULL) {
8516  SCFree(object->challenge_data);
8517  }
8518  SCFree(object);
8519  }
8520 
8521  return 0;
8522 }
8523 
8524 static int DNP3DecodeObjectG120V13(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
8525  uint32_t start, uint32_t count, DNP3PointList *points)
8526 {
8527  DNP3ObjectG120V13 *object = NULL;
8528  uint32_t prefix = 0;
8529  uint32_t point_index = start;
8530 
8531  if (prefix_code != 5) {
8532  goto error;
8533  }
8534 
8535  if (*len < count/8) {
8536  goto error;
8537  }
8538  while (count--) {
8539 
8540  object = SCCalloc(1, sizeof(*object));
8541  if (unlikely(object == NULL)) {
8542  goto error;
8543  }
8544 
8545  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
8546  goto error;
8547  }
8548 
8549  if (!DNP3ReadUint32(buf, len, &object->ksq)) {
8550  goto error;
8551  }
8552  if (!DNP3ReadUint16(buf, len, &object->user_number)) {
8553  goto error;
8554  }
8555  if (!DNP3ReadUint16(buf, len, &object->encrypted_update_key_len)) {
8556  goto error;
8557  }
8558  if (object->encrypted_update_key_len > 0) {
8559  if (*len < object->encrypted_update_key_len) {
8560  /* Not enough data. */
8561  goto error;
8562  }
8563  object->encrypted_update_key_data = SCCalloc(1, object->encrypted_update_key_len);
8564  if (unlikely(object->encrypted_update_key_data == NULL)) {
8565  goto error;
8566  }
8567  memcpy(object->encrypted_update_key_data, *buf, object->encrypted_update_key_len);
8568  *buf += object->encrypted_update_key_len;
8569  *len -= object->encrypted_update_key_len;
8570  }
8571 
8572  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
8573  goto error;
8574  }
8575 
8576  object = NULL;
8577  point_index++;
8578  }
8579 
8580  return 1;
8581 error:
8582  if (object != NULL) {
8583  if (object->encrypted_update_key_data != NULL) {
8585  }
8586  SCFree(object);
8587  }
8588 
8589  return 0;
8590 }
8591 
8592 static int DNP3DecodeObjectG120V14(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
8593  uint32_t start, uint32_t count, DNP3PointList *points)
8594 {
8595  DNP3ObjectG120V14 *object = NULL;
8596  uint32_t prefix = 0;
8597  uint32_t point_index = start;
8598  uint32_t offset;
8599 
8600  if (prefix_code != 5) {
8601  goto error;
8602  }
8603 
8604  if (*len < count/8) {
8605  goto error;
8606  }
8607  while (count--) {
8608 
8609  object = SCCalloc(1, sizeof(*object));
8610  if (unlikely(object == NULL)) {
8611  goto error;
8612  }
8613 
8614  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
8615  goto error;
8616  }
8617 
8618  offset = *len;
8619 
8620  if (prefix < (offset - *len)) {
8621  goto error;
8622  }
8623  object->digital_signature_len = (uint16_t)(prefix - (offset - *len));
8624  if (object->digital_signature_len > 0) {
8625  if (*len < object->digital_signature_len) {
8626  /* Not enough data. */
8627  goto error;
8628  }
8629  object->digital_signature = SCCalloc(1, object->digital_signature_len);
8630  if (unlikely(object->digital_signature == NULL)) {
8631  goto error;
8632  }
8633  memcpy(object->digital_signature, *buf, object->digital_signature_len);
8634  *buf += object->digital_signature_len;
8635  *len -= object->digital_signature_len;
8636  }
8637 
8638  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
8639  goto error;
8640  }
8641 
8642  object = NULL;
8643  point_index++;
8644  }
8645 
8646  return 1;
8647 error:
8648  if (object != NULL) {
8649  if (object->digital_signature != NULL) {
8650  SCFree(object->digital_signature);
8651  }
8652  SCFree(object);
8653  }
8654 
8655  return 0;
8656 }
8657 
8658 static int DNP3DecodeObjectG120V15(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
8659  uint32_t start, uint32_t count, DNP3PointList *points)
8660 {
8661  DNP3ObjectG120V15 *object = NULL;
8662  uint32_t prefix = 0;
8663  uint32_t point_index = start;
8664  uint32_t offset;
8665 
8666  if (prefix_code != 5) {
8667  goto error;
8668  }
8669 
8670  if (*len < count/8) {
8671  goto error;
8672  }
8673  while (count--) {
8674 
8675  object = SCCalloc(1, sizeof(*object));
8676  if (unlikely(object == NULL)) {
8677  goto error;
8678  }
8679 
8680  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
8681  goto error;
8682  }
8683 
8684  offset = *len;
8685 
8686  if (prefix < (offset - *len)) {
8687  goto error;
8688  }
8689  object->mac_len = (uint16_t)(prefix - (offset - *len));
8690  if (object->mac_len > 0) {
8691  if (*len < object->mac_len) {
8692  /* Not enough data. */
8693  goto error;
8694  }
8695  object->mac = SCCalloc(1, object->mac_len);
8696  if (unlikely(object->mac == NULL)) {
8697  goto error;
8698  }
8699  memcpy(object->mac, *buf, object->mac_len);
8700  *buf += object->mac_len;
8701  *len -= object->mac_len;
8702  }
8703 
8704  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
8705  goto error;
8706  }
8707 
8708  object = NULL;
8709  point_index++;
8710  }
8711 
8712  return 1;
8713 error:
8714  if (object != NULL) {
8715  if (object->mac != NULL) {
8716  SCFree(object->mac);
8717  }
8718  SCFree(object);
8719  }
8720 
8721  return 0;
8722 }
8723 
8724 static int DNP3DecodeObjectG121V1(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
8725  uint32_t start, uint32_t count, DNP3PointList *points)
8726 {
8727  DNP3ObjectG121V1 *object = NULL;
8728  uint32_t prefix = 0;
8729  uint32_t point_index = start;
8730 
8731  if (*len < count/8) {
8732  goto error;
8733  }
8734  while (count--) {
8735 
8736  object = SCCalloc(1, sizeof(*object));
8737  if (unlikely(object == NULL)) {
8738  goto error;
8739  }
8740 
8741  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
8742  goto error;
8743  }
8744 
8745  {
8746  uint8_t octet;
8747  if (!DNP3ReadUint8(buf, len, &octet)) {
8748  goto error;
8749  }
8750  object->online = (octet >> 0) & 0x1;
8751  object->restart = (octet >> 1) & 0x1;
8752  object->comm_lost = (octet >> 2) & 0x1;
8753  object->remote_forced = (octet >> 3) & 0x1;
8754  object->local_forced = (octet >> 4) & 0x1;
8755  object->reserved0 = (octet >> 5) & 0x1;
8756  object->discontinuity = (octet >> 6) & 0x1;
8757  object->reserved1 = (octet >> 7) & 0x1;
8758  }
8759  if (!DNP3ReadUint16(buf, len, &object->association_id)) {
8760  goto error;
8761  }
8762  if (!DNP3ReadUint32(buf, len, &object->count_value)) {
8763  goto error;
8764  }
8765 
8766  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
8767  goto error;
8768  }
8769 
8770  object = NULL;
8771  point_index++;
8772  }
8773 
8774  return 1;
8775 error:
8776  if (object != NULL) {
8777  SCFree(object);
8778  }
8779 
8780  return 0;
8781 }
8782 
8783 static int DNP3DecodeObjectG122V1(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
8784  uint32_t start, uint32_t count, DNP3PointList *points)
8785 {
8786  DNP3ObjectG122V1 *object = NULL;
8787  uint32_t prefix = 0;
8788  uint32_t point_index = start;
8789 
8790  if (*len < count/8) {
8791  goto error;
8792  }
8793  while (count--) {
8794 
8795  object = SCCalloc(1, sizeof(*object));
8796  if (unlikely(object == NULL)) {
8797  goto error;
8798  }
8799 
8800  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
8801  goto error;
8802  }
8803 
8804  {
8805  uint8_t octet;
8806  if (!DNP3ReadUint8(buf, len, &octet)) {
8807  goto error;
8808  }
8809  object->online = (octet >> 0) & 0x1;
8810  object->restart = (octet >> 1) & 0x1;
8811  object->comm_lost = (octet >> 2) & 0x1;
8812  object->remote_forced = (octet >> 3) & 0x1;
8813  object->local_forced = (octet >> 4) & 0x1;
8814  object->reserved0 = (octet >> 5) & 0x1;
8815  object->discontinuity = (octet >> 6) & 0x1;
8816  object->reserved1 = (octet >> 7) & 0x1;
8817  }
8818  if (!DNP3ReadUint16(buf, len, &object->association_id)) {
8819  goto error;
8820  }
8821  if (!DNP3ReadUint32(buf, len, &object->count_value)) {
8822  goto error;
8823  }
8824 
8825  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
8826  goto error;
8827  }
8828 
8829  object = NULL;
8830  point_index++;
8831  }
8832 
8833  return 1;
8834 error:
8835  if (object != NULL) {
8836  SCFree(object);
8837  }
8838 
8839  return 0;
8840 }
8841 
8842 static int DNP3DecodeObjectG122V2(const uint8_t **buf, uint16_t *len, uint8_t prefix_code,
8843  uint32_t start, uint32_t count, DNP3PointList *points)
8844 {
8845  DNP3ObjectG122V2 *object = NULL;
8846  uint32_t prefix = 0;
8847  uint32_t point_index = start;
8848 
8849  if (*len < count/8) {
8850  goto error;
8851  }
8852  while (count--) {
8853 
8854  object = SCCalloc(1, sizeof(*object));
8855  if (unlikely(object == NULL)) {
8856  goto error;
8857  }
8858 
8859  if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
8860  goto error;
8861  }
8862 
8863  {
8864  uint8_t octet;
8865  if (!DNP3ReadUint8(buf, len, &octet)) {
8866  goto error;
8867  }
8868  object->online = (octet >> 0) & 0x1;
8869  object->restart = (octet >> 1) & 0x1;
8870  object->comm_lost = (octet >> 2) & 0x1;
8871  object->remote_forced = (octet >> 3) & 0x1;
8872  object->local_forced = (octet >> 4) & 0x1;
8873  object->reserved0 = (octet >> 5) & 0x1;
8874  object->discontinuity = (octet >> 6) & 0x1;
8875  object->reserved1 = (octet >> 7) & 0x1;
8876  }
8877  if (!DNP3ReadUint16(buf, len, &object->association_id)) {
8878  goto error;
8879  }
8880  if (!DNP3ReadUint32(buf, len, &object->count_value)) {
8881  goto error;
8882  }
8883  if (!DNP3ReadUint48(buf, len, &object->timestamp)) {
8884  goto error;
8885  }
8886 
8887  if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
8888  goto error;
8889  }
8890 
8891  object = NULL;
8892  point_index++;
8893  }
8894 
8895  return 1;
8896 error:
8897  if (object != NULL) {
8898  SCFree(object);
8899  }
8900 
8901  return 0;
8902 }
8903 
8904 
8905 void DNP3FreeObjectPoint(int group, int variation, void *point)
8906 {
8907  switch(DNP3_OBJECT_CODE(group, variation)) {
8908  case DNP3_OBJECT_CODE(70, 1): {
8909  DNP3ObjectG70V1 *object = (DNP3ObjectG70V1 *)point;
8910  if (object->filename != NULL) {
8911  SCFree(object->filename);
8912  }
8913  if (object->data != NULL) {
8914  SCFree(object->data);
8915  }
8916  break;
8917  }
8918  case DNP3_OBJECT_CODE(70, 2): {
8919  DNP3ObjectG70V2 *object = (DNP3ObjectG70V2 *)point;
8920  if (object->username != NULL) {
8921  SCFree(object->username);
8922  }
8923  if (object->password != NULL) {
8924  SCFree(object->password);
8925  }
8926  break;
8927  }
8928  case DNP3_OBJECT_CODE(70, 3): {
8929  DNP3ObjectG70V3 *object = (DNP3ObjectG70V3 *)point;
8930  if (object->filename != NULL) {
8931  SCFree(object->filename);
8932  }
8933  break;
8934  }
8935  case DNP3_OBJECT_CODE(70, 7): {
8936  DNP3ObjectG70V7 *object = (DNP3ObjectG70V7 *)point;
8937  if (object->filename != NULL) {
8938  SCFree(object->filename);
8939  }
8940  break;
8941  }
8942  case DNP3_OBJECT_CODE(70, 8): {
8943  DNP3ObjectG70V8 *object = (DNP3ObjectG70V8 *)point;
8944  if (object->file_specification != NULL) {
8945  SCFree(object->file_specification);
8946  }
8947  break;
8948  }
8949  case DNP3_OBJECT_CODE(83, 1): {
8950  DNP3ObjectG83V1 *object = (DNP3ObjectG83V1 *)point;
8951  if (object->data_objects != NULL) {
8952  SCFree(object->data_objects);
8953  }
8954  break;
8955  }
8956  case DNP3_OBJECT_CODE(120, 1): {
8957  DNP3ObjectG120V1 *object = (DNP3ObjectG120V1 *)point;
8958  if (object->challenge_data != NULL) {
8959  SCFree(object->challenge_data);
8960  }
8961  break;
8962  }
8963  case DNP3_OBJECT_CODE(120, 2): {
8964  DNP3ObjectG120V2 *object = (DNP3ObjectG120V2 *)point;
8965  if (object->mac_value != NULL) {
8966  SCFree(object->mac_value);
8967  }
8968  break;
8969  }
8970  case DNP3_OBJECT_CODE(120, 5): {
8971  DNP3ObjectG120V5 *object = (DNP3ObjectG120V5 *)point;
8972  if (object->challenge_data != NULL) {
8973  SCFree(object->challenge_data);
8974  }
8975  if (object->mac_value != NULL) {
8976  SCFree(object->mac_value);
8977  }
8978  break;
8979  }
8980  case DNP3_OBJECT_CODE(120, 6): {
8981  DNP3ObjectG120V6 *object = (DNP3ObjectG120V6 *)point;
8982  if (object->wrapped_key_data != NULL) {
8983  SCFree(object->wrapped_key_data);
8984  }
8985  break;
8986  }
8987  case DNP3_OBJECT_CODE(120, 7): {
8988  DNP3ObjectG120V7 *object = (DNP3ObjectG120V7 *)point;
8989  if (object->error_text != NULL) {
8990  SCFree(object->error_text);
8991  }
8992  break;
8993  }
8994  case DNP3_OBJECT_CODE(120, 8): {
8995  DNP3ObjectG120V8 *object = (DNP3ObjectG120V8 *)point;
8996  if (object->certificate != NULL) {
8997  SCFree(object->certificate);
8998  }
8999  break;
9000  }
9001  case DNP3_OBJECT_CODE(120, 9): {
9002  DNP3ObjectG120V9 *object = (DNP3ObjectG120V9 *)point;
9003  if (object->mac_value != NULL) {
9004  SCFree(object->mac_value);
9005  }
9006  break;
9007  }
9008  case DNP3_OBJECT_CODE(120, 10): {
9009  DNP3ObjectG120V10 *object = (DNP3ObjectG120V10 *)point;
9010  if (object->username != NULL) {
9011  SCFree(object->username);
9012  }
9013  if (object->user_public_key != NULL) {
9014  SCFree(object->user_public_key);
9015  }
9016  if (object->certification_data != NULL) {
9017  SCFree(object->certification_data);
9018  }
9019  break;
9020  }
9021  case DNP3_OBJECT_CODE(120, 11): {
9022  DNP3ObjectG120V11 *object = (DNP3ObjectG120V11 *)point;
9023  if (object->username != NULL) {
9024  SCFree(object->username);
9025  }
9026  if (object->master_challenge_data != NULL) {
9027  SCFree(object->master_challenge_data);
9028  }
9029  break;
9030  }
9031  case DNP3_OBJECT_CODE(120, 12): {
9032  DNP3ObjectG120V12 *object = (DNP3ObjectG120V12 *)point;
9033  if (object->challenge_data != NULL) {
9034  SCFree(object->challenge_data);
9035  }
9036  break;
9037  }
9038  case DNP3_OBJECT_CODE(120, 13): {
9039  DNP3ObjectG120V13 *object = (DNP3ObjectG120V13 *)point;
9040  if (object->encrypted_update_key_data != NULL) {
9042  }
9043  break;
9044  }
9045  case DNP3_OBJECT_CODE(120, 14): {
9046  DNP3ObjectG120V14 *object = (DNP3ObjectG120V14 *)point;
9047  if (object->digital_signature != NULL) {
9048  SCFree(object->digital_signature);
9049  }
9050  break;
9051  }
9052  case DNP3_OBJECT_CODE(120, 15): {
9053  DNP3ObjectG120V15 *object = (DNP3ObjectG120V15 *)point;
9054  if (object->mac != NULL) {
9055  SCFree(object->mac);
9056  }
9057  break;
9058  }
9059  default:
9060  break;
9061  }
9062  SCFree(point);
9063 }
9064 
9065 /**
9066  * \brief Decode a DNP3 object.
9067  *
9068  * \retval 0 on success. On failure a positive integer corresponding
9069  * to a DNP3 application layer event will be returned.
9070  */
9071 int DNP3DecodeObject(int group, int variation, const uint8_t **buf, uint16_t *len,
9072  uint8_t prefix_code, uint32_t start, uint32_t count, DNP3PointList *points)
9073 {
9074  int rc = 0;
9075 
9076  switch (DNP3_OBJECT_CODE(group, variation)) {
9077  case DNP3_OBJECT_CODE(1, 1):
9078  rc = DNP3DecodeObjectG1V1(buf, len, prefix_code, start, count,
9079  points);
9080  break;
9081  case DNP3_OBJECT_CODE(1, 2):
9082  rc = DNP3DecodeObjectG1V2(buf, len, prefix_code, start, count,
9083  points);
9084  break;
9085  case DNP3_OBJECT_CODE(2, 1):
9086  rc = DNP3DecodeObjectG2V1(buf, len, prefix_code, start, count,
9087  points);
9088  break;
9089  case DNP3_OBJECT_CODE(2, 2):
9090  rc = DNP3DecodeObjectG2V2(buf, len, prefix_code, start, count,
9091  points);
9092  break;
9093  case DNP3_OBJECT_CODE(2, 3):
9094  rc = DNP3DecodeObjectG2V3(buf, len, prefix_code, start, count,
9095  points);
9096  break;
9097  case DNP3_OBJECT_CODE(3, 1):
9098  rc = DNP3DecodeObjectG3V1(buf, len, prefix_code, start, count,
9099  points);
9100  break;
9101  case DNP3_OBJECT_CODE(3, 2):
9102  rc = DNP3DecodeObjectG3V2(buf, len, prefix_code, start, count,
9103  points);
9104  break;
9105  case DNP3_OBJECT_CODE(4, 1):
9106  rc = DNP3DecodeObjectG4V1(buf, len, prefix_code, start, count,
9107  points);
9108  break;
9109  case DNP3_OBJECT_CODE(4, 2):
9110  rc = DNP3DecodeObjectG4V2(buf, len, prefix_code, start, count,
9111  points);
9112  break;
9113  case DNP3_OBJECT_CODE(4, 3):
9114  rc = DNP3DecodeObjectG4V3(buf, len, prefix_code, start, count,
9115  points);
9116  break;
9117  case DNP3_OBJECT_CODE(10, 1):
9118  rc = DNP3DecodeObjectG10V1(buf, len, prefix_code, start, count,
9119  points);
9120  break;
9121  case DNP3_OBJECT_CODE(10, 2):
9122  rc = DNP3DecodeObjectG10V2(buf, len, prefix_code, start, count,
9123  points);
9124  break;
9125  case DNP3_OBJECT_CODE(11, 1):
9126  rc = DNP3DecodeObjectG11V1(buf, len, prefix_code, start, count,
9127  points);
9128  break;
9129  case DNP3_OBJECT_CODE(11, 2):
9130  rc = DNP3DecodeObjectG11V2(buf, len, prefix_code, start, count,
9131  points);
9132  break;
9133  case DNP3_OBJECT_CODE(12, 1):
9134  rc = DNP3DecodeObjectG12V1(buf, len, prefix_code, start, count,
9135  points);
9136  break;
9137  case DNP3_OBJECT_CODE(12, 2):
9138  rc = DNP3DecodeObjectG12V2(buf, len, prefix_code, start, count,
9139  points);
9140  break;
9141  case DNP3_OBJECT_CODE(12, 3):
9142  rc = DNP3DecodeObjectG12V3(buf, len, prefix_code, start, count,
9143  points);
9144  break;
9145  case DNP3_OBJECT_CODE(13, 1):
9146  rc = DNP3DecodeObjectG13V1(buf, len, prefix_code, start, count,
9147  points);
9148  break;
9149  case DNP3_OBJECT_CODE(13, 2):
9150  rc = DNP3DecodeObjectG13V2(buf, len, prefix_code, start, count,
9151  points);
9152  break;
9153  case DNP3_OBJECT_CODE(20, 1):
9154  rc = DNP3DecodeObjectG20V1(buf, len, prefix_code, start, count,
9155  points);
9156  break;
9157  case DNP3_OBJECT_CODE(20, 2):
9158  rc = DNP3DecodeObjectG20V2(buf, len, prefix_code, start, count,
9159  points);
9160  break;
9161  case DNP3_OBJECT_CODE(20, 3):
9162  rc = DNP3DecodeObjectG20V3(buf, len, prefix_code, start, count,
9163  points);
9164  break;
9165  case DNP3_OBJECT_CODE(20, 4):
9166  rc = DNP3DecodeObjectG20V4(buf, len, prefix_code, start, count,
9167  points);
9168  break;
9169  case DNP3_OBJECT_CODE(20, 5):
9170  rc = DNP3DecodeObjectG20V5(buf, len, prefix_code, start, count,
9171  points);
9172  break;
9173  case DNP3_OBJECT_CODE(20, 6):
9174  rc = DNP3DecodeObjectG20V6(buf, len, prefix_code, start, count,
9175  points);
9176  break;
9177  case DNP3_OBJECT_CODE(20, 7):
9178  rc = DNP3DecodeObjectG20V7(buf, len, prefix_code, start, count,
9179  points);
9180  break;
9181  case DNP3_OBJECT_CODE(20, 8):
9182  rc = DNP3DecodeObjectG20V8(buf, len, prefix_code, start, count,
9183  points);
9184  break;
9185  case DNP3_OBJECT_CODE(21, 1):
9186  rc = DNP3DecodeObjectG21V1(buf, len, prefix_code, start, count,
9187  points);
9188  break;
9189  case DNP3_OBJECT_CODE(21, 2):
9190  rc = DNP3DecodeObjectG21V2(buf, len, prefix_code, start, count,
9191  points);
9192  break;
9193  case DNP3_OBJECT_CODE(21, 3):
9194  rc = DNP3DecodeObjectG21V3(buf, len, prefix_code, start, count,
9195  points);
9196  break;
9197  case DNP3_OBJECT_CODE(21, 4):
9198  rc = DNP3DecodeObjectG21V4(buf, len, prefix_code, start, count,
9199  points);
9200  break;
9201  case DNP3_OBJECT_CODE(21, 5):
9202  rc = DNP3DecodeObjectG21V5(buf, len, prefix_code, start, count,
9203  points);
9204  break;
9205  case DNP3_OBJECT_CODE(21, 6):
9206  rc = DNP3DecodeObjectG21V6(buf, len, prefix_code, start, count,
9207  points);
9208  break;
9209  case DNP3_OBJECT_CODE(21, 7):
9210  rc = DNP3DecodeObjectG21V7(buf, len, prefix_code, start, count,
9211  points);
9212  break;
9213  case DNP3_OBJECT_CODE(21, 8):
9214  rc = DNP3DecodeObjectG21V8(buf, len, prefix_code, start, count,
9215  points);
9216  break;
9217  case DNP3_OBJECT_CODE(21, 9):
9218  rc = DNP3DecodeObjectG21V9(buf, len, prefix_code, start, count,
9219  points);
9220  break;
9221  case DNP3_OBJECT_CODE(21, 10):
9222  rc = DNP3DecodeObjectG21V10(buf, len, prefix_code, start, count,
9223  points);
9224  break;
9225  case DNP3_OBJECT_CODE(21, 11):
9226  rc = DNP3DecodeObjectG21V11(buf, len, prefix_code, start, count,
9227  points);
9228  break;
9229  case DNP3_OBJECT_CODE(21, 12):
9230  rc = DNP3DecodeObjectG21V12(buf, len, prefix_code, start, count,
9231  points);
9232  break;
9233  case DNP3_OBJECT_CODE(22, 1):
9234  rc = DNP3DecodeObjectG22V1(buf, len, prefix_code, start, count,
9235  points);
9236  break;
9237  case DNP3_OBJECT_CODE(22, 2):
9238  rc = DNP3DecodeObjectG22V2(buf, len, prefix_code, start, count,
9239  points);
9240  break;
9241  case DNP3_OBJECT_CODE(22, 3):
9242  rc = DNP3DecodeObjectG22V3(buf, len, prefix_code, start, count,
9243  points);
9244  break;
9245  case DNP3_OBJECT_CODE(22, 4):
9246  rc = DNP3DecodeObjectG22V4(buf, len, prefix_code, start, count,
9247  points);
9248  break;
9249  case DNP3_OBJECT_CODE(22, 5):
9250  rc = DNP3DecodeObjectG22V5(buf, len, prefix_code, start, count,
9251  points);
9252  break;
9253  case DNP3_OBJECT_CODE(22, 6):
9254  rc = DNP3DecodeObjectG22V6(buf, len, prefix_code, start, count,
9255  points);
9256  break;
9257  case DNP3_OBJECT_CODE(22, 7):
9258  rc = DNP3DecodeObjectG22V7(buf, len, prefix_code, start, count,
9259  points);
9260  break;
9261  case DNP3_OBJECT_CODE(22, 8):
9262  rc = DNP3DecodeObjectG22V8(buf, len, prefix_code, start, count,
9263  points);
9264  break;
9265  case DNP3_OBJECT_CODE(23, 1):
9266  rc = DNP3DecodeObjectG23V1(buf, len, prefix_code, start, count,
9267  points);
9268  break;
9269  case DNP3_OBJECT_CODE(23, 2):
9270  rc = DNP3DecodeObjectG23V2(buf, len, prefix_code, start, count,
9271  points);
9272  break;
9273  case DNP3_OBJECT_CODE(23, 3):
9274  rc = DNP3DecodeObjectG23V3(buf, len, prefix_code, start, count,
9275  points);
9276  break;
9277  case DNP3_OBJECT_CODE(23, 4):
9278  rc = DNP3DecodeObjectG23V4(buf, len, prefix_code, start, count,
9279  points);
9280  break;
9281  case DNP3_OBJECT_CODE(23, 5):
9282  rc = DNP3DecodeObjectG23V5(buf, len, prefix_code, start, count,
9283  points);
9284  break;
9285  case DNP3_OBJECT_CODE(23, 6):
9286  rc = DNP3DecodeObjectG23V6(buf, len, prefix_code, start, count,
9287  points);
9288  break;
9289  case DNP3_OBJECT_CODE(23, 7):
9290  rc = DNP3DecodeObjectG23V7(buf, len, prefix_code, start, count,
9291  points);
9292  break;
9293  case DNP3_OBJECT_CODE(23, 8):
9294  rc = DNP3DecodeObjectG23V8(buf, len, prefix_code, start, count,
9295  points);
9296  break;
9297  case DNP3_OBJECT_CODE(30, 1):
9298  rc = DNP3DecodeObjectG30V1(buf, len, prefix_code, start, count,
9299  points);
9300  break;
9301  case DNP3_OBJECT_CODE(30, 2):
9302  rc = DNP3DecodeObjectG30V2(buf, len, prefix_code, start, count,
9303  points);
9304  break;
9305  case DNP3_OBJECT_CODE(30, 3):
9306  rc = DNP3DecodeObjectG30V3(buf, len, prefix_code, start, count,
9307  points);
9308  break;
9309  case DNP3_OBJECT_CODE(30, 4):
9310  rc = DNP3DecodeObjectG30V4(buf, len, prefix_code, start, count,
9311  points);
9312  break;
9313  case DNP3_OBJECT_CODE(30, 5):
9314  rc = DNP3DecodeObjectG30V5(buf, len, prefix_code, start, count,
9315  points);
9316  break;
9317  case DNP3_OBJECT_CODE(30, 6):
9318  rc = DNP3DecodeObjectG30V6(buf, len, prefix_code, start, count,
9319  points);
9320  break;
9321  case DNP3_OBJECT_CODE(31, 1):
9322  rc = DNP3DecodeObjectG31V1(buf, len, prefix_code, start, count,
9323  points);
9324  break;
9325  case DNP3_OBJECT_CODE(31, 2):
9326  rc = DNP3DecodeObjectG31V2(buf, len, prefix_code, start, count,
9327  points);
9328  break;
9329  case DNP3_OBJECT_CODE(31, 3):
9330  rc = DNP3DecodeObjectG31V3(buf, len, prefix_code, start, count,
9331  points);
9332  break;
9333  case DNP3_OBJECT_CODE(31, 4):
9334  rc = DNP3DecodeObjectG31V4(buf, len, prefix_code, start, count,
9335  points);
9336  break;
9337  case DNP3_OBJECT_CODE(31, 5):
9338  rc = DNP3DecodeObjectG31V5(buf, len, prefix_code, start, count,
9339  points);
9340  break;
9341  case DNP3_OBJECT_CODE(31, 6):
9342  rc = DNP3DecodeObjectG31V6(buf, len, prefix_code, start, count,
9343  points);
9344  break;
9345  case DNP3_OBJECT_CODE(31, 7):
9346  rc = DNP3DecodeObjectG31V7(buf, len, prefix_code, start, count,
9347  points);
9348  break;
9349  case DNP3_OBJECT_CODE(31, 8):
9350  rc = DNP3DecodeObjectG31V8(buf, len, prefix_code, start, count,
9351  points);
9352  break;
9353  case DNP3_OBJECT_CODE(32, 1):
9354  rc = DNP3DecodeObjectG32V1(buf, len, prefix_code, start, count,
9355  points);
9356  break;
9357  case DNP3_OBJECT_CODE(32, 2):
9358  rc = DNP3DecodeObjectG32V2(buf, len, prefix_code, start, count,
9359  points);
9360  break;
9361  case DNP3_OBJECT_CODE(32, 3):
9362  rc = DNP3DecodeObjectG32V3(buf, len, prefix_code, start, count,
9363  points);
9364  break;
9365  case DNP3_OBJECT_CODE(32, 4):
9366  rc = DNP3DecodeObjectG32V4(buf, len, prefix_code, start, count,
9367  points);
9368  break;
9369  case DNP3_OBJECT_CODE(32, 5):
9370  rc = DNP3DecodeObjectG32V5(buf, len, prefix_code, start, count,
9371  points);
9372  break;
9373  case DNP3_OBJECT_CODE(32, 6):
9374  rc = DNP3DecodeObjectG32V6(buf, len, prefix_code, start, count,
9375  points);
9376  break;
9377  case DNP3_OBJECT_CODE(32, 7):
9378  rc = DNP3DecodeObjectG32V7(buf, len, prefix_code, start, count,
9379  points);
9380  break;
9381  case DNP3_OBJECT_CODE(32, 8):
9382  rc = DNP3DecodeObjectG32V8(buf, len, prefix_code, start, count,
9383  points);
9384  break;
9385  case DNP3_OBJECT_CODE(33, 1):
9386  rc = DNP3DecodeObjectG33V1(buf, len, prefix_code, start, count,
9387  points);
9388  break;
9389  case DNP3_OBJECT_CODE(33, 2):
9390  rc = DNP3DecodeObjectG33V2(buf, len, prefix_code, start, count,
9391  points);
9392  break;
9393  case DNP3_OBJECT_CODE(33, 3):
9394  rc = DNP3DecodeObjectG33V3(buf, len, prefix_code, start, count,
9395  points);
9396  break;
9397  case DNP3_OBJECT_CODE(33, 4):
9398  rc = DNP3DecodeObjectG33V4(buf, len, prefix_code, start, count,
9399  points);
9400  break;
9401  case DNP3_OBJECT_CODE(33, 5):
9402  rc = DNP3DecodeObjectG33V5(buf, len, prefix_code, start, count,
9403  points);
9404  break;
9405  case DNP3_OBJECT_CODE(33, 6):
9406  rc = DNP3DecodeObjectG33V6(buf, len, prefix_code, start, count,
9407  points);
9408  break;
9409  case DNP3_OBJECT_CODE(33, 7):
9410  rc = DNP3DecodeObjectG33V7(buf, len, prefix_code, start, count,
9411  points);
9412  break;
9413  case DNP3_OBJECT_CODE(33, 8):
9414  rc = DNP3DecodeObjectG33V8(buf, len, prefix_code, start, count,
9415  points);
9416  break;
9417  case DNP3_OBJECT_CODE(34, 1):
9418  rc = DNP3DecodeObjectG34V1(buf, len, prefix_code, start, count,
9419  points);
9420  break;
9421  case DNP3_OBJECT_CODE(34, 2):
9422  rc = DNP3DecodeObjectG34V2(buf, len, prefix_code, start, count,
9423  points);
9424  break;
9425  case DNP3_OBJECT_CODE(34, 3):
9426  rc = DNP3DecodeObjectG34V3(buf, len, prefix_code, start, count,
9427  points);
9428  break;
9429  case DNP3_OBJECT_CODE(40, 1):
9430  rc = DNP3DecodeObjectG40V1(buf, len, prefix_code, start, count,
9431  points);
9432  break;
9433  case DNP3_OBJECT_CODE(40, 2):
9434  rc = DNP3DecodeObjectG40V2(buf, len, prefix_code, start, count,
9435  points);
9436  break;
9437  case DNP3_OBJECT_CODE(40, 3):
9438  rc = DNP3DecodeObjectG40V3(buf, len, prefix_code, start, count,
9439  points);
9440  break;
9441  case DNP3_OBJECT_CODE(40, 4):
9442  rc = DNP3DecodeObjectG40V4(buf, len, prefix_code, start, count,
9443  points);
9444  break;
9445  case DNP3_OBJECT_CODE(41, 1):
9446  rc = DNP3DecodeObjectG41V1(buf, len, prefix_code, start, count,
9447  points);
9448  break;
9449  case DNP3_OBJECT_CODE(41, 2):
9450  rc = DNP3DecodeObjectG41V2(buf, len, prefix_code, start, count,
9451  points);
9452  break;
9453  case DNP3_OBJECT_CODE(41, 3):
9454  rc = DNP3DecodeObjectG41V3(buf, len, prefix_code, start, count,
9455  points);
9456  break;
9457  case DNP3_OBJECT_CODE(41, 4):
9458  rc = DNP3DecodeObjectG41V4(buf, len, prefix_code, start, count,
9459  points);
9460  break;
9461  case DNP3_OBJECT_CODE(42, 1):
9462  rc = DNP3DecodeObjectG42V1(buf, len, prefix_code, start, count,
9463  points);
9464  break;
9465  case DNP3_OBJECT_CODE(42, 2):
9466  rc = DNP3DecodeObjectG42V2(buf, len, prefix_code, start, count,
9467  points);
9468  break;
9469  case DNP3_OBJECT_CODE(42, 3):
9470  rc = DNP3DecodeObjectG42V3(buf, len, prefix_code, start, count,
9471  points);
9472  break;
9473  case DNP3_OBJECT_CODE(42, 4):
9474  rc = DNP3DecodeObjectG42V4(buf, len, prefix_code, start, count,
9475  points);
9476  break;
9477  case DNP3_OBJECT_CODE(42, 5):
9478  rc = DNP3DecodeObjectG42V5(buf, len, prefix_code, start, count,
9479  points);
9480  break;
9481  case DNP3_OBJECT_CODE(42, 6):
9482  rc = DNP3DecodeObjectG42V6(buf, len, prefix_code, start, count,
9483  points);
9484  break;
9485  case DNP3_OBJECT_CODE(42, 7):
9486  rc = DNP3DecodeObjectG42V7(buf, len, prefix_code, start, count,
9487  points);
9488  break;
9489  case DNP3_OBJECT_CODE(42, 8):
9490  rc = DNP3DecodeObjectG42V8(buf, len, prefix_code, start, count,
9491  points);
9492  break;
9493  case DNP3_OBJECT_CODE(43, 1):
9494  rc = DNP3DecodeObjectG43V1(buf, len, prefix_code, start, count,
9495  points);
9496  break;
9497  case DNP3_OBJECT_CODE(43, 2):
9498  rc = DNP3DecodeObjectG43V2(buf, len, prefix_code, start, count,
9499  points);
9500  break;
9501  case DNP3_OBJECT_CODE(43, 3):
9502  rc = DNP3DecodeObjectG43V3(buf, len, prefix_code, start, count,
9503  points);
9504  break;
9505  case DNP3_OBJECT_CODE(43, 4):
9506  rc = DNP3DecodeObjectG43V4(buf, len, prefix_code, start, count,
9507  points);
9508  break;
9509  case DNP3_OBJECT_CODE(43, 5):
9510  rc = DNP3DecodeObjectG43V5(buf, len, prefix_code, start, count,
9511  points);
9512  break;
9513  case DNP3_OBJECT_CODE(43, 6):
9514  rc = DNP3DecodeObjectG43V6(buf, len, prefix_code, start, count,
9515  points);
9516  break;
9517  case DNP3_OBJECT_CODE(43, 7):
9518  rc = DNP3DecodeObjectG43V7(buf, len, prefix_code, start, count,
9519  points);
9520  break;
9521  case DNP3_OBJECT_CODE(43, 8):
9522  rc = DNP3DecodeObjectG43V8(buf, len, prefix_code, start, count,
9523  points);
9524  break;
9525  case DNP3_OBJECT_CODE(50, 1):
9526  rc = DNP3DecodeObjectG50V1(buf, len, prefix_code, start, count,
9527  points);
9528  break;
9529  case DNP3_OBJECT_CODE(50, 2):
9530  rc = DNP3DecodeObjectG50V2(buf, len, prefix_code, start, count,
9531  points);
9532  break;
9533  case DNP3_OBJECT_CODE(50, 3):
9534  rc = DNP3DecodeObjectG50V3(buf, len, prefix_code, start, count,
9535  points);
9536  break;
9537  case DNP3_OBJECT_CODE(50, 4):
9538  rc = DNP3DecodeObjectG50V4(buf, len, prefix_code, start, count,
9539  points);
9540  break;
9541  case DNP3_OBJECT_CODE(51, 1):
9542  rc = DNP3DecodeObjectG51V1(buf, len, prefix_code, start, count,
9543  points);
9544  break;
9545  case DNP3_OBJECT_CODE(51, 2):
9546  rc = DNP3DecodeObjectG51V2(buf, len, prefix_code, start, count,
9547  points);
9548  break;
9549  case DNP3_OBJECT_CODE(52, 1):
9550  rc = DNP3DecodeObjectG52V1(buf, len, prefix_code, start, count,
9551  points);
9552  break;
9553  case DNP3_OBJECT_CODE(52, 2):
9554  rc = DNP3DecodeObjectG52V2(buf, len, prefix_code, start, count,
9555  points);
9556  break;
9557  case DNP3_OBJECT_CODE(70, 1):
9558  rc = DNP3DecodeObjectG70V1(buf, len, prefix_code, start, count,
9559  points);
9560  break;
9561  case DNP3_OBJECT_CODE(70, 2):
9562  rc = DNP3DecodeObjectG70V2(buf, len, prefix_code, start, count,
9563  points);
9564  break;
9565  case DNP3_OBJECT_CODE(70, 3):
9566  rc = DNP3DecodeObjectG70V3(buf, len, prefix_code, start, count,
9567  points);
9568  break;
9569  case DNP3_OBJECT_CODE(70, 4):
9570  rc = DNP3DecodeObjectG70V4(buf, len, prefix_code, start, count,
9571  points);
9572  break;
9573  case DNP3_OBJECT_CODE(70, 5):
9574  rc = DNP3DecodeObjectG70V5(buf, len, prefix_code, start, count,
9575  points);
9576  break;
9577  case DNP3_OBJECT_CODE(70, 6):
9578  rc = DNP3DecodeObjectG70V6(buf, len, prefix_code, start, count,
9579  points);
9580  break;
9581  case DNP3_OBJECT_CODE(70, 7):
9582  rc = DNP3DecodeObjectG70V7(buf, len, prefix_code, start, count,
9583  points);
9584  break;
9585  case DNP3_OBJECT_CODE(70, 8):
9586  rc = DNP3DecodeObjectG70V8(buf, len, prefix_code, start, count,
9587  points);
9588  break;
9589  case DNP3_OBJECT_CODE(80, 1):
9590  rc = DNP3DecodeObjectG80V1(buf, len, prefix_code, start, count,
9591  points);
9592  break;
9593  case DNP3_OBJECT_CODE(81, 1):
9594  rc = DNP3DecodeObjectG81V1(buf, len, prefix_code, start, count,
9595  points);
9596  break;
9597  case DNP3_OBJECT_CODE(83, 1):
9598  rc = DNP3DecodeObjectG83V1(buf, len, prefix_code, start, count,
9599  points);
9600  break;
9601  case DNP3_OBJECT_CODE(86, 2):
9602  rc = DNP3DecodeObjectG86V2(buf, len, prefix_code, start, count,
9603  points);
9604  break;
9605  case DNP3_OBJECT_CODE(102, 1):
9606  rc = DNP3DecodeObjectG102V1(buf, len, prefix_code, start, count,
9607  points);
9608  break;
9609  case DNP3_OBJECT_CODE(120, 1):
9610  rc = DNP3DecodeObjectG120V1(buf, len, prefix_code, start, count,
9611  points);
9612  break;
9613  case DNP3_OBJECT_CODE(120, 2):
9614  rc = DNP3DecodeObjectG120V2(buf, len, prefix_code, start, count,
9615  points);
9616  break;
9617  case DNP3_OBJECT_CODE(120, 3):
9618  rc = DNP3DecodeObjectG120V3(buf, len, prefix_code, start, count,
9619  points);
9620  break;
9621  case DNP3_OBJECT_CODE(120, 4):
9622  rc = DNP3DecodeObjectG120V4(buf, len, prefix_code, start, count,
9623  points);
9624  break;
9625  case DNP3_OBJECT_CODE(120, 5):
9626  rc = DNP3DecodeObjectG120V5(buf, len, prefix_code, start, count,
9627  points);
9628  break;
9629  case DNP3_OBJECT_CODE(120, 6):
9630  rc = DNP3DecodeObjectG120V6(buf, len, prefix_code, start, count,
9631  points);
9632  break;
9633  case DNP3_OBJECT_CODE(120, 7):
9634  rc = DNP3DecodeObjectG120V7(buf, len, prefix_code, start, count,
9635  points);
9636  break;
9637  case DNP3_OBJECT_CODE(120, 8):
9638  rc = DNP3DecodeObjectG120V8(buf, len, prefix_code, start, count,
9639  points);
9640  break;
9641  case DNP3_OBJECT_CODE(120, 9):
9642  rc = DNP3DecodeObjectG120V9(buf, len, prefix_code, start, count,
9643  points);
9644  break;
9645  case DNP3_OBJECT_CODE(120, 10):
9646  rc = DNP3DecodeObjectG120V10(buf, len, prefix_code, start, count,
9647  points);
9648  break;
9649  case DNP3_OBJECT_CODE(120, 11):
9650  rc = DNP3DecodeObjectG120V11(buf, len, prefix_code, start, count,
9651  points);
9652  break;
9653  case DNP3_OBJECT_CODE(120, 12):
9654  rc = DNP3DecodeObjectG120V12(buf, len, prefix_code, start, count,
9655  points);
9656  break;
9657  case DNP3_OBJECT_CODE(120, 13):
9658  rc = DNP3DecodeObjectG120V13(buf, len, prefix_code, start, count,
9659  points);
9660  break;
9661  case DNP3_OBJECT_CODE(120, 14):
9662  rc = DNP3DecodeObjectG120V14(buf, len, prefix_code, start, count,
9663  points);
9664  break;
9665  case DNP3_OBJECT_CODE(120, 15):
9666  rc = DNP3DecodeObjectG120V15(buf, len, prefix_code, start, count,
9667  points);
9668  break;
9669  case DNP3_OBJECT_CODE(121, 1):
9670  rc = DNP3DecodeObjectG121V1(buf, len, prefix_code, start, count,
9671  points);
9672  break;
9673  case DNP3_OBJECT_CODE(122, 1):
9674  rc = DNP3DecodeObjectG122V1(buf, len, prefix_code, start, count,
9675  points);
9676  break;
9677  case DNP3_OBJECT_CODE(122, 2):
9678  rc = DNP3DecodeObjectG122V2(buf, len, prefix_code, start, count,
9679  points);
9680  break;
9681  default:
9683  }
9684 
9685  return rc ? 0 : DNP3_DECODER_EVENT_MALFORMED;
9686 }
9687 
9688 /* END GENERATED CODE */
DNP3ObjectG70V7_::filename_offset
uint16_t filename_offset
Definition: app-layer-dnp3-objects.h:1256
DNP3ObjectG31V8_
Definition: app-layer-dnp3-objects.h:709
DNP3ObjectG70V1_::status_code
uint8_t status_code
Definition: app-layer-dnp3-objects.h:1201
DNP3ObjectG31V7_
Definition: app-layer-dnp3-objects.h:697
DNP3ObjectG70V5_::block_number
uint32_t block_number
Definition: app-layer-dnp3-objects.h:1242
DNP3ObjectG31V6_
Definition: app-layer-dnp3-objects.h:693
DNP3ObjectG120V11_::master_challenge_data
uint8_t * master_challenge_data
Definition: app-layer-dnp3-objects.h:1389
DNP3ObjectG32V5_::value
float value
Definition: app-layer-dnp3-objects.h:780
DNP3ObjectG70V3_::maximum_block_size
uint16_t maximum_block_size
Definition: app-layer-dnp3-objects.h:1225
DNP3ObjectG120V10_::user_role
uint16_t user_role
Definition: app-layer-dnp3-objects.h:1374
DNP3ObjectG122V1_::count_value
uint32_t count_value
Definition: app-layer-dnp3-objects.h:1439
DNP3ObjectG20V3_::count
uint32_t count
Definition: app-layer-dnp3-objects.h:236
DNP3ObjectG20V1_
Definition: app-layer-dnp3-objects.h:203
DNP3ObjectG120V7_::sequence_number
uint32_t sequence_number
Definition: app-layer-dnp3-objects.h:1349
DNP3ObjectG120V11_::username
char * username
Definition: app-layer-dnp3-objects.h:1388
DNP3ObjectG70V7_::file_size
uint32_t file_size
Definition: app-layer-dnp3-objects.h:1259
len
uint8_t len
Definition: app-layer-dnp3.h:2
DNP3ObjectG20V5_
Definition: app-layer-dnp3-objects.h:251
DNP3ObjectG20V4_
Definition: app-layer-dnp3-objects.h:239
DNP3ObjectG20V3_
Definition: app-layer-dnp3-objects.h:227
DNP3ObjectG20V2_
Definition: app-layer-dnp3-objects.h:215
DNP3ObjectG70V1_::data
char * data
Definition: app-layer-dnp3-objects.h:1204
DNP3ObjectG20V8_
Definition: app-layer-dnp3-objects.h:263
DNP3ObjectG20V7_
Definition: app-layer-dnp3-objects.h:259
DNP3ObjectG20V6_
Definition: app-layer-dnp3-objects.h:255
DNP3ObjectG2V1_
Definition: app-layer-dnp3-objects.h:52
DNP3ObjectG2V2_
Definition: app-layer-dnp3-objects.h:56
DNP3ObjectG120V1_::csq
uint32_t csq
Definition: app-layer-dnp3-objects.h:1305
DNP3_DECODER_EVENT_MALFORMED
@ DNP3_DECODER_EVENT_MALFORMED
Definition: app-layer-dnp3.h:111
DNP3ObjectG30V4_::value
int16_t value
Definition: app-layer-dnp3-objects.h:612
DNP3ObjectG42V5_::value
float value
Definition: app-layer-dnp3-objects.h:1060
DNP3ObjectG52V2_::delay_ms
uint16_t delay_ms
Definition: app-layer-dnp3-objects.h:1185
DNP3ObjectG81V1_::group
uint8_t group
Definition: app-layer-dnp3-objects.h:1278
DNP3ObjectG23V7_::count
uint32_t count
Definition: app-layer-dnp3-objects.h:566
DNP3ObjectG2V3_
Definition: app-layer-dnp3-objects.h:68
DNP3ObjectG42V8_::value
double value
Definition: app-layer-dnp3-objects.h:1097
offset
uint64_t offset
Definition: util-streaming-buffer.h:0
DNP3ObjectG70V5_::file_handle
uint32_t file_handle
Definition: app-layer-dnp3-objects.h:1241
DNP3ObjectG70V1_::attribute_code
uint8_t attribute_code
Definition: app-layer-dnp3-objects.h:1191
DNP3ObjectG70V5_::file_data_len
uint8_t file_data_len
Definition: app-layer-dnp3-objects.h:1244
DNP3ObjectG50V3_::timestamp
uint64_t timestamp
Definition: app-layer-dnp3-objects.h:1163
TAILQ_INIT
#define TAILQ_INIT(head)
Definition: queue.h:262
DNP3ObjectG70V1_::data_size
uint16_t data_size
Definition: app-layer-dnp3-objects.h:1203
DNP3ObjectG70V2_::password_offset
uint16_t password_offset
Definition: app-layer-dnp3-objects.h:1210
DNP3ObjectG43V1_
Definition: app-layer-dnp3-objects.h:1101
DNP3ObjectG121V1_
Definition: app-layer-dnp3-objects.h:1416
DNP3ObjectG23V3_::count
uint32_t count
Definition: app-layer-dnp3-objects.h:516
DNP3ObjectG42V6_::value
double value
Definition: app-layer-dnp3-objects.h:1072
DNP3ObjectG43V5_
Definition: app-layer-dnp3-objects.h:1127
DNP3ObjectG43V4_
Definition: app-layer-dnp3-objects.h:1120
DNP3ObjectG43V3_
Definition: app-layer-dnp3-objects.h:1113
DNP3ObjectG43V2_
Definition: app-layer-dnp3-objects.h:1107
DNP3ObjectG70V1_::file_size
uint32_t file_size
Definition: app-layer-dnp3-objects.h:1194
DNP3ObjectG43V8_
Definition: app-layer-dnp3-objects.h:1146
DNP3ObjectG43V7_
Definition: app-layer-dnp3-objects.h:1139
DNP3ObjectG43V6_
Definition: app-layer-dnp3-objects.h:1133
DNP3ObjectG21V7_::timestamp
uint64_t timestamp
Definition: app-layer-dnp3-objects.h:351
DNP3ObjectG70V1_::filename_size
uint16_t filename_size
Definition: app-layer-dnp3-objects.h:1189
DNP3ObjectG52V1_
Definition: app-layer-dnp3-objects.h:1180
DNP3ObjectG4V2_::timestamp
uint64_t timestamp
Definition: app-layer-dnp3-objects.h:112
unlikely
#define unlikely(expr)
Definition: util-optimize.h:35
DNP3ObjectG41V2_::value
int16_t value
Definition: app-layer-dnp3-objects.h:987
DNP3ObjectG70V3_::request_id
uint16_t request_id
Definition: app-layer-dnp3-objects.h:1226
DNP3ObjectG70V6_::optional_text_len
uint8_t optional_text_len
Definition: app-layer-dnp3-objects.h:1252
DNP3ObjectG120V12_::challenge_data_len
uint16_t challenge_data_len
Definition: app-layer-dnp3-objects.h:1395
DNP3ObjectG120V10_::certification_data_len
uint16_t certification_data_len
Definition: app-layer-dnp3-objects.h:1378
DNP3ObjectG52V2_
Definition: app-layer-dnp3-objects.h:1184
DNP3ObjectG120V2_::csq
uint32_t csq
Definition: app-layer-dnp3-objects.h:1314
DNP3ObjectG120V2_::usr
uint16_t usr
Definition: app-layer-dnp3-objects.h:1315
DNP3ObjectG86V2_
Definition: app-layer-dnp3-objects.h:1289
DNP3ObjectG43V5_::commanded_value
float commanded_value
Definition: app-layer-dnp3-objects.h:1130
DNP3ObjectG40V1_
Definition: app-layer-dnp3-objects.h:933
DNP3ObjectG22V7_::timestamp
uint64_t timestamp
Definition: app-layer-dnp3-objects.h:467
DNP3ObjectG120V10_::user_role_expiry_interval
uint16_t user_role_expiry_interval
Definition: app-layer-dnp3-objects.h:1375
DNP3ObjectG40V4_
Definition: app-layer-dnp3-objects.h:969
DNP3ObjectG120V5_::key_wrap_alg
uint8_t key_wrap_alg
Definition: app-layer-dnp3-objects.h:1332
DNP3ObjectG40V3_
Definition: app-layer-dnp3-objects.h:957
DNP3ObjectG40V2_
Definition: app-layer-dnp3-objects.h:945
DNP3ObjectG122V2_::association_id
uint16_t association_id
Definition: app-layer-dnp3-objects.h:1451
next
struct HtpBodyChunk_ * next
Definition: app-layer-htp.h:0
DNP3ObjectG70V7_::filename_size
uint16_t filename_size
Definition: app-layer-dnp3-objects.h:1257
DNP3ObjectG32V8_::value
double value
Definition: app-layer-dnp3-objects.h:817
DNP3ObjectG21V1_::count
uint32_t count
Definition: app-layer-dnp3-objects.h:276
DNP3_SWAP32
#define DNP3_SWAP32(x)
Definition: app-layer-dnp3.h:97
DNP3ObjectG70V6_::optional_text
char optional_text[256]
Definition: app-layer-dnp3-objects.h:1251
DNP3ObjectG31V7_::value
float value
Definition: app-layer-dnp3-objects.h:706
DNP3ObjectG22V7_::count
uint32_t count
Definition: app-layer-dnp3-objects.h:466
DNP3ObjectG120V12_::ksq
uint32_t ksq
Definition: app-layer-dnp3-objects.h:1393
DNP3ObjectG42V3_::timestamp
uint64_t timestamp
Definition: app-layer-dnp3-objects.h:1035
DNP3ObjectG120V5_::challenge_data
uint8_t * challenge_data
Definition: app-layer-dnp3-objects.h:1336
DNP3ObjectG43V3_::timestamp
uint64_t timestamp
Definition: app-layer-dnp3-objects.h:1117
DNP3ObjectG21V9_::count
uint32_t count
Definition: app-layer-dnp3-objects.h:368
DNP3ObjectG12V1_::ontime
uint32_t ontime
Definition: app-layer-dnp3-objects.h:170
DNP3ObjectG20V2_::count
uint16_t count
Definition: app-layer-dnp3-objects.h:224
DNP3ObjectG22V5_::timestamp
uint64_t timestamp
Definition: app-layer-dnp3-objects.h:441
DNP3ObjectG21V11_::count
uint32_t count
Definition: app-layer-dnp3-objects.h:376
DNP3ObjectG12V2_::count
uint8_t count
Definition: app-layer-dnp3-objects.h:181
DNP3ObjectG20V5_::count
uint32_t count
Definition: app-layer-dnp3-objects.h:252
DNP3ObjectG70V3_::authentication_key
uint32_t authentication_key
Definition: app-layer-dnp3-objects.h:1222
DNP3ObjectG32V8_::timestamp
uint64_t timestamp
Definition: app-layer-dnp3-objects.h:818
DNP3ObjectG120V12_::user_number
uint16_t user_number
Definition: app-layer-dnp3-objects.h:1394
DNP3ObjectG120V10_::user_public_key_len
uint16_t user_public_key_len
Definition: app-layer-dnp3-objects.h:1377
DNP3ObjectG42V7_::value
float value
Definition: app-layer-dnp3-objects.h:1084
DNP3ObjectG31V8_::value
double value
Definition: app-layer-dnp3-objects.h:718
DNP3ObjectG120V14_::digital_signature
uint8_t * digital_signature
Definition: app-layer-dnp3-objects.h:1407
DNP3ObjectG70V2_::authentication_key
uint32_t authentication_key
Definition: app-layer-dnp3-objects.h:1212
DNP3ObjectG12V1_::count
uint8_t count
Definition: app-layer-dnp3-objects.h:169
DNP3ObjectG120V5_::user_number
uint16_t user_number
Definition: app-layer-dnp3-objects.h:1331
DNP3ObjectG102V1_::value
uint8_t value
Definition: app-layer-dnp3-objects.h:1301
DNP3ObjectG21V4_::count
uint16_t count
Definition: app-layer-dnp3-objects.h:312
DNP3ObjectG43V4_::timestamp
uint64_t timestamp
Definition: app-layer-dnp3-objects.h:1124
DNP3PrefixIsSize
int DNP3PrefixIsSize(uint8_t prefix_code)
Check if the prefix code is a size prefix.
Definition: app-layer-dnp3.c:1557
DNP3ObjectG81V1_::variation
uint8_t variation
Definition: app-layer-dnp3-objects.h:1279
DNP3ObjectG120V10_::key_change_method
uint8_t key_change_method
Definition: app-layer-dnp3-objects.h:1371
DNP3ObjectG21V5_::timestamp
uint64_t timestamp
Definition: app-layer-dnp3-objects.h:325
DNP3ObjectG32V7_::value
float value
Definition: app-layer-dnp3-objects.h:804
DNP3ObjectG120V10_
Definition: app-layer-dnp3-objects.h:1370
DNP3ObjectG120V11_
Definition: app-layer-dnp3-objects.h:1384
DNP3ObjectG120V12_
Definition: app-layer-dnp3-objects.h:1392
DNP3ObjectG120V14_
Definition: app-layer-dnp3-objects.h:1406
DNP3ObjectG120V15_
Definition: app-layer-dnp3-objects.h:1411
TAILQ_INSERT_TAIL
#define TAILQ_INSERT_TAIL(head, elm, field)
Definition: queue.h:294
DNP3ObjectG20V1_::count
uint32_t count
Definition: app-layer-dnp3-objects.h:212
DNP3ObjectG23V1_::count
uint32_t count
Definition: app-layer-dnp3-objects.h:492
DNP3ObjectG120V5_::ksq
uint32_t ksq
Definition: app-layer-dnp3-objects.h:1330
DNP3ObjectG120V13_
Definition: app-layer-dnp3-objects.h:1399
DNP3ObjectG22V4_::count
uint16_t count
Definition: app-layer-dnp3-objects.h:428
DNP3ObjectG120V15_::mac
uint8_t * mac
Definition: app-layer-dnp3-objects.h:1412
DNP3ObjectG120V11_::username_len
uint16_t username_len
Definition: app-layer-dnp3-objects.h:1386
DNP3ObjectG32V4_::timestamp
uint64_t timestamp
Definition: app-layer-dnp3-objects.h:768
DNP3ObjectG50V1_
Definition: app-layer-dnp3-objects.h:1153
DNP3ObjectG31V3_::timestamp
uint64_t timestamp
Definition: app-layer-dnp3-objects.h:673
DNP3ObjectG50V4_
Definition: app-layer-dnp3-objects.h:1166
DNP3ObjectG70V1_::file_id
uint32_t file_id
Definition: app-layer-dnp3-objects.h:1197
DNP3ObjectG50V3_
Definition: app-layer-dnp3-objects.h:1162
DNP3ObjectG50V2_
Definition: app-layer-dnp3-objects.h:1157
DNP3ObjectG83V1_::object_id
uint16_t object_id
Definition: app-layer-dnp3-objects.h:1284
DNP3ObjectG12V1_
Definition: app-layer-dnp3-objects.h:164
DNP3Point_::data
void * data
Definition: app-layer-dnp3.h:187
DNP3ObjectG120V3_::user_number
uint16_t user_number
Definition: app-layer-dnp3-objects.h:1322
DNP3ObjectG12V3_
Definition: app-layer-dnp3-objects.h:188
DNP3ObjectG12V2_
Definition: app-layer-dnp3-objects.h:176
DNP3ObjectG120V4_::user_number
uint16_t user_number
Definition: app-layer-dnp3-objects.h:1326
DNP3ObjectG120V7_::association_id
uint16_t association_id
Definition: app-layer-dnp3-objects.h:1351
DNP3ObjectG122V2_::count_value
uint32_t count_value
Definition: app-layer-dnp3-objects.h:1452
DNP3ObjectG21V2_::count
uint16_t count
Definition: app-layer-dnp3-objects.h:288
DNP3ObjectG120V10_::certification_data
uint8_t * certification_data
Definition: app-layer-dnp3-objects.h:1381
DNP3ObjectG120V1_::usr
uint16_t usr
Definition: app-layer-dnp3-objects.h:1306
DNP3ObjectG41V4_::control_status
uint8_t control_status
Definition: app-layer-dnp3-objects.h:998
DNP3ObjectG70V3_::created
uint64_t created
Definition: app-layer-dnp3-objects.h:1220
DNP3ObjectG81V1_
Definition: app-layer-dnp3-objects.h:1275
DNP3_SWAP16
#define DNP3_SWAP16(x)
Definition: app-layer-dnp3.h:96
DNP3ObjectG70V2_::username_offset
uint16_t username_offset
Definition: app-layer-dnp3-objects.h:1208
DNP3FreeObjectPointList
void DNP3FreeObjectPointList(int group, int variation, DNP3PointList *list)
Free a DNP3PointList.
Definition: app-layer-dnp3-objects.c:58
DNP3ObjectG120V8_::certificate_len
uint16_t certificate_len
Definition: app-layer-dnp3-objects.h:1362
DNP3ObjectG23V5_::count
uint32_t count
Definition: app-layer-dnp3-objects.h:540
DNP3ObjectG120V5_::key_status
uint8_t key_status
Definition: app-layer-dnp3-objects.h:1333
DNP3_DECODER_EVENT_UNKNOWN_OBJECT
@ DNP3_DECODER_EVENT_UNKNOWN_OBJECT
Definition: app-layer-dnp3.h:112
DNP3ObjectG3V1_
Definition: app-layer-dnp3-objects.h:80
DNP3ObjectG3V2_
Definition: app-layer-dnp3-objects.h:84
DNP3ObjectG70V1_
Definition: app-layer-dnp3-objects.h:1188
DNP3ObjectG41V3_::value
float value
Definition: app-layer-dnp3-objects.h:992
TAILQ_REMOVE
#define TAILQ_REMOVE(head, elm, field)
Definition: queue.h:312
DNP3ObjectG70V5_
Definition: app-layer-dnp3-objects.h:1240
DNP3ObjectG120V9_::mac_value_len
uint16_t mac_value_len
Definition: app-layer-dnp3-objects.h:1367
DNP3ObjectG70V4_
Definition: app-layer-dnp3-objects.h:1230
DNP3ObjectG70V3_
Definition: app-layer-dnp3-objects.h:1217
DNP3ObjectG70V2_
Definition: app-layer-dnp3-objects.h:1207
TAILQ_FIRST
#define TAILQ_FIRST(head)
Definition: queue.h:250
DNP3ObjectG70V8_
Definition: app-layer-dnp3-objects.h:1266
DNP3ObjectG32V1_
Definition: app-layer-dnp3-objects.h:721
DNP3ObjectG23V7_::timestamp
uint64_t timestamp
Definition: app-layer-dnp3-objects.h:567
DNP3ObjectG70V7_
Definition: app-layer-dnp3-objects.h:1255
DNP3ObjectG70V6_
Definition: app-layer-dnp3-objects.h:1247
DNP3ObjectG52V1_::delay_secs
uint16_t delay_secs
Definition: app-layer-dnp3-objects.h:1181
DNP3ObjectG12V1_::offtime
uint32_t offtime
Definition: app-layer-dnp3-objects.h:171
DNP3ObjectG2V2_::timestamp
uint64_t timestamp
Definition: app-layer-dnp3-objects.h:65
DNP3ObjectG32V5_
Definition: app-layer-dnp3-objects.h:771
DNP3ObjectG32V4_
Definition: app-layer-dnp3-objects.h:758
DNP3ObjectG32V3_
Definition: app-layer-dnp3-objects.h:745
DNP3ObjectG32V2_
Definition: app-layer-dnp3-objects.h:733
DNP3ObjectG120V3_::csq
uint32_t csq
Definition: app-layer-dnp3-objects.h:1321
DNP3ObjectG32V8_
Definition: app-layer-dnp3-objects.h:808
DNP3ObjectG32V7_
Definition: app-layer-dnp3-objects.h:795
DNP3ObjectG2V3_::timestamp
uint16_t timestamp
Definition: app-layer-dnp3-objects.h:77
DNP3ObjectG32V6_
Definition: app-layer-dnp3-objects.h:783
DNP3ObjectG21V7_::count
uint32_t count
Definition: app-layer-dnp3-objects.h:350
DNP3Point_::size
uint32_t size
Definition: app-layer-dnp3.h:185
DNP3ObjectG33V7_::value
float value
Definition: app-layer-dnp3-objects.h:904
DNP3ObjectG120V5_::mac_value
uint8_t * mac_value
Definition: app-layer-dnp3-objects.h:1337
DNP3ObjectG41V3_::control_status
uint8_t control_status
Definition: app-layer-dnp3-objects.h:993
app-layer-dnp3.h
DNP3_OBJECT_CODE
#define DNP3_OBJECT_CODE(group, variation)
Definition: app-layer-dnp3-objects.h:29
DNP3ObjectG33V3_::timestamp
uint64_t timestamp
Definition: app-layer-dnp3-objects.h:855
length
uint16_t length
Definition: decode-sctp.h:2
DNP3ObjectG41V2_::control_status
uint8_t control_status
Definition: app-layer-dnp3-objects.h:988
DNP3ObjectG13V1_
Definition: app-layer-dnp3-objects.h:192
DNP3ObjectG40V4_::value
double value
Definition: app-layer-dnp3-objects.h:978
DNP3ObjectG120V10_::username
char * username
Definition: app-layer-dnp3-objects.h:1379
DNP3ObjectG70V3_::filename_size
uint16_t filename_size
Definition: app-layer-dnp3-objects.h:1219
DNP3ObjectG21V1_
Definition: app-layer-dnp3-objects.h:267
DNP3ObjectG20V7_::count
uint32_t count
Definition: app-layer-dnp3-objects.h:260
DNP3ObjectG70V1_::file_function_code
uint8_t file_function_code
Definition: app-layer-dnp3-objects.h:1200
DNP3ObjectG13V2_
Definition: app-layer-dnp3-objects.h:197
DNP3ObjectG21V5_
Definition: app-layer-dnp3-objects.h:315
DNP3ObjectG21V4_
Definition: app-layer-dnp3-objects.h:303
DNP3ObjectG21V3_
Definition: app-layer-dnp3-objects.h:291
DNP3ObjectG21V2_
Definition: app-layer-dnp3-objects.h:279
DNP3ObjectG21V9_
Definition: app-layer-dnp3-objects.h:367
DNP3ObjectG21V8_
Definition: app-layer-dnp3-objects.h:354
DNP3ObjectG21V7_
Definition: app-layer-dnp3-objects.h:341
DNP3ObjectG21V6_
Definition: app-layer-dnp3-objects.h:328
DNP3ObjectG50V4_::interval_units
uint8_t interval_units
Definition: app-layer-dnp3-objects.h:1169
DNP3ObjectG50V2_::timestamp
uint64_t timestamp
Definition: app-layer-dnp3-objects.h:1158
DNP3ObjectG43V7_::commanded_value
float commanded_value
Definition: app-layer-dnp3-objects.h:1142
DNP3ObjectG34V2_::deadband_value
uint32_t deadband_value
Definition: app-layer-dnp3-objects.h:926
DNP3ObjectG10V1_
Definition: app-layer-dnp3-objects.h:126
DNP3ObjectG122V2_
Definition: app-layer-dnp3-objects.h:1442
DNP3ObjectG23V8_::timestamp
uint64_t timestamp
Definition: app-layer-dnp3-objects.h:580
DNP3ObjectG22V5_::count
uint32_t count
Definition: app-layer-dnp3-objects.h:440
DNP3ObjectG120V11_::key_change_method
uint8_t key_change_method
Definition: app-layer-dnp3-objects.h:1385
DNP3ObjectG120V1_::challenge_data
uint8_t * challenge_data
Definition: app-layer-dnp3-objects.h:1309
DNP3ObjectG120V8_::certificate_type
uint8_t certificate_type
Definition: app-layer-dnp3-objects.h:1360
DNP3ObjectG10V2_
Definition: app-layer-dnp3-objects.h:130
DNP3ObjectG122V1_
Definition: app-layer-dnp3-objects.h:1429
DNP3ObjectG120V6_::usr
uint16_t usr
Definition: app-layer-dnp3-objects.h:1343
DNP3ObjectG70V4_::file_size
uint32_t file_size
Definition: app-layer-dnp3-objects.h:1232
DNP3ObjectG120V7_::error_code
uint8_t error_code
Definition: app-layer-dnp3-objects.h:1352
DNP3ObjectG70V8_::file_specification_len
uint16_t file_specification_len
Definition: app-layer-dnp3-objects.h:1268
DNP3ObjectG21V10_::count
uint16_t count
Definition: app-layer-dnp3-objects.h:372
DNP3ObjectG22V6_::timestamp
uint64_t timestamp
Definition: app-layer-dnp3-objects.h:454
DNP3ObjectG120V13_::ksq
uint32_t ksq
Definition: app-layer-dnp3-objects.h:1400
DNP3ObjectG120V5_::challenge_data_len
uint16_t challenge_data_len
Definition: app-layer-dnp3-objects.h:1335
DNP3ObjectG2V1_::state
uint8_t state
Definition: app-layer-dnp3-objects.h:53
DNP3ObjectG83V1_::length
uint16_t length
Definition: app-layer-dnp3-objects.h:1285
DNP3ObjectG33V1_
Definition: app-layer-dnp3-objects.h:821
DNP3ObjectG21V6_::count
uint16_t count
Definition: app-layer-dnp3-objects.h:337
DNP3ObjectG70V1_::filename
char * filename
Definition: app-layer-dnp3-objects.h:1202
DNP3DecodeObject
int DNP3DecodeObject(int group, int variation, const uint8_t **buf, uint16_t *len, uint8_t prefix_code, uint32_t start, uint32_t count, DNP3PointList *points)
Decode a DNP3 object.
Definition: app-layer-dnp3-objects.c:9071
DNP3ObjectG40V3_::value
float value
Definition: app-layer-dnp3-objects.h:966
DNP3ObjectG41V1_
Definition: app-layer-dnp3-objects.h:981
DNP3ObjectG33V5_
Definition: app-layer-dnp3-objects.h:871
DNP3ObjectG33V4_
Definition: app-layer-dnp3-objects.h:858
DNP3ObjectG33V3_
Definition: app-layer-dnp3-objects.h:845
DNP3ObjectG33V2_
Definition: app-layer-dnp3-objects.h:833
DNP3ObjectG41V4_
Definition: app-layer-dnp3-objects.h:996
DNP3ObjectG70V3_::filename
char * filename
Definition: app-layer-dnp3-objects.h:1227
DNP3ObjectG33V8_
Definition: app-layer-dnp3-objects.h:908
DNP3ObjectG41V3_
Definition: app-layer-dnp3-objects.h:991
DNP3ObjectG33V8_::value
double value
Definition: app-layer-dnp3-objects.h:917
DNP3ObjectG21V8_::timestamp
uint64_t timestamp
Definition: app-layer-dnp3-objects.h:364
DNP3ObjectG33V7_
Definition: app-layer-dnp3-objects.h:895
DNP3ObjectG41V2_
Definition: app-layer-dnp3-objects.h:986
DNP3ObjectG33V6_
Definition: app-layer-dnp3-objects.h:883
DNP3ObjectG70V3_::filename_offset
uint16_t filename_offset
Definition: app-layer-dnp3-objects.h:1218
variation
uint8_t variation
Definition: app-layer-dnp3.h:1
DNP3ObjectG42V8_::timestamp
uint64_t timestamp
Definition: app-layer-dnp3-objects.h:1098
DNP3ObjectG22V6_::count
uint16_t count
Definition: app-layer-dnp3-objects.h:453
DNP3ObjectG51V1_::timestamp
uint64_t timestamp
Definition: app-layer-dnp3-objects.h:1173
DNP3ObjectG23V6_::count
uint16_t count
Definition: app-layer-dnp3-objects.h:553
DNP3ObjectG12V2_::offtime
uint32_t offtime
Definition: app-layer-dnp3-objects.h:183
DNP3ObjectG120V8_::certificate
uint8_t * certificate
Definition: app-layer-dnp3-objects.h:1361
DNP3ObjectG50V4_::interval_count
uint32_t interval_count
Definition: app-layer-dnp3-objects.h:1168
DNP3ObjectG70V2_::username
char * username
Definition: app-layer-dnp3-objects.h:1213
DNP3ObjectG120V5_::mac_value_len
uint16_t mac_value_len
Definition: app-layer-dnp3-objects.h:1338
DNP3ObjectG30V1_
Definition: app-layer-dnp3-objects.h:583
DNP3ObjectG70V4_::status_code
uint8_t status_code
Definition: app-layer-dnp3-objects.h:1235
DNP3ObjectG22V1_::count
uint32_t count
Definition: app-layer-dnp3-objects.h:392
DNP3ObjectG30V5_
Definition: app-layer-dnp3-objects.h:615
DNP3ObjectG30V4_
Definition: app-layer-dnp3-objects.h:611
DNP3ObjectG30V3_
Definition: app-layer-dnp3-objects.h:607
DNP3ObjectG30V2_
Definition: app-layer-dnp3-objects.h:595
DNP3ObjectG102V1_
Definition: app-layer-dnp3-objects.h:1300
DNP3ObjectG120V5_
Definition: app-layer-dnp3-objects.h:1329
DNP3ObjectG30V6_
Definition: app-layer-dnp3-objects.h:627
DNP3ObjectG20V4_::count
uint16_t count
Definition: app-layer-dnp3-objects.h:248
DNP3ObjectG31V5_::value
int32_t value
Definition: app-layer-dnp3-objects.h:690
DNP3ObjectG70V7_::filename
char * filename
Definition: app-layer-dnp3-objects.h:1263
DNP3ObjectG43V6_::commanded_value
double commanded_value
Definition: app-layer-dnp3-objects.h:1136
DNP3ObjectG31V6_::value
int16_t value
Definition: app-layer-dnp3-objects.h:694
DNP3ObjectG70V6_::block_number
uint32_t block_number
Definition: app-layer-dnp3-objects.h:1249
DNP3ObjectG70V3_::operational_mode
uint16_t operational_mode
Definition: app-layer-dnp3-objects.h:1224
DNP3ObjectG120V14_::digital_signature_len
uint16_t digital_signature_len
Definition: app-layer-dnp3-objects.h:1408
DNP3ObjectG50V1_::timestamp
uint64_t timestamp
Definition: app-layer-dnp3-objects.h:1154
DNP3ObjectG70V7_::request_id
uint16_t request_id
Definition: app-layer-dnp3-objects.h:1262
DNP3ObjectG70V1_::group_id
uint32_t group_id
Definition: app-layer-dnp3-objects.h:1199
DNP3ObjectG30V5_::value
float value
Definition: app-layer-dnp3-objects.h:624
DNP3ObjectG1V1_
Definition: app-layer-dnp3-objects.h:37
DNP3ObjectG1V2_
Definition: app-layer-dnp3-objects.h:41
DNP3ObjectG120V15_::mac_len
uint32_t mac_len
Definition: app-layer-dnp3-objects.h:1413
DNP3ObjectG32V7_::timestamp
uint64_t timestamp
Definition: app-layer-dnp3-objects.h:805
DNP3ObjectG70V3_::permissions
uint16_t permissions
Definition: app-layer-dnp3-objects.h:1221
DNP3PointListAlloc
DNP3PointList * DNP3PointListAlloc(void)
Allocate a list for DNP3 points.
Definition: app-layer-dnp3-objects.c:45
DNP3ObjectG41V4_::value
double value
Definition: app-layer-dnp3-objects.h:997
DNP3ObjectG120V2_
Definition: app-layer-dnp3-objects.h:1313
DNP3ObjectG70V2_::password
char * password
Definition: app-layer-dnp3-objects.h:1214
DNP3ObjectG50V2_::interval
uint32_t interval
Definition: app-layer-dnp3-objects.h:1159
group
uint8_t group
Definition: app-layer-dnp3.h:0
DNP3ObjectG120V1_
Definition: app-layer-dnp3-objects.h:1304
suricata-common.h
DNP3ObjectG120V7_
Definition: app-layer-dnp3-objects.h:1348
DNP3ObjectG120V8_
Definition: app-layer-dnp3-objects.h:1358
DNP3ObjectG120V7_::time_of_error
uint64_t time_of_error
Definition: app-layer-dnp3-objects.h:1353
DNP3ObjectG20V6_::count
uint16_t count
Definition: app-layer-dnp3-objects.h:256
DNP3ObjectG121V1_::count_value
uint32_t count_value
Definition: app-layer-dnp3-objects.h:1426
DNP3ObjectG70V1_::filetype_code
uint8_t filetype_code
Definition: app-layer-dnp3-objects.h:1190
DNP3ObjectG120V6_
Definition: app-layer-dnp3-objects.h:1341
DNP3ObjectG23V8_::count
uint16_t count
Definition: app-layer-dnp3-objects.h:579
DNP3ObjectG120V3_
Definition: app-layer-dnp3-objects.h:1320
DNP3ObjectG120V6_::wrapped_key_data
uint8_t * wrapped_key_data
Definition: app-layer-dnp3-objects.h:1344
DNP3ObjectG120V4_
Definition: app-layer-dnp3-objects.h:1325
DNP3ObjectG120V9_
Definition: app-layer-dnp3-objects.h:1365
DNP3ObjectG121V1_::association_id
uint16_t association_id
Definition: app-layer-dnp3-objects.h:1425
DNP3ObjectG120V7_::usr
uint16_t usr
Definition: app-layer-dnp3-objects.h:1350
DNP3ObjectG70V1_::start_record
uint16_t start_record
Definition: app-layer-dnp3-objects.h:1192
DNP3ObjectG51V1_
Definition: app-layer-dnp3-objects.h:1172
DNP3ObjectG120V1_::mal
uint8_t mal
Definition: app-layer-dnp3-objects.h:1307
DNP3ObjectG70V1_::created_timestamp
uint64_t created_timestamp
Definition: app-layer-dnp3-objects.h:1195
DNP3ObjectG4V3_::relative_time_ms
uint16_t relative_time_ms
Definition: app-layer-dnp3-objects.h:123
DNP3ObjectG70V3_::file_size
uint32_t file_size
Definition: app-layer-dnp3-objects.h:1223
DNP3ObjectG70V4_::maximum_block_size
uint16_t maximum_block_size
Definition: app-layer-dnp3-objects.h:1233
DNP3ObjectG70V1_::owner_id
uint32_t owner_id
Definition: app-layer-dnp3-objects.h:1198
DNP3ObjectG51V2_
Definition: app-layer-dnp3-objects.h:1176
DNP3ObjectG33V6_::value
double value
Definition: app-layer-dnp3-objects.h:892
DNP3ObjectG120V6_::ksq
uint32_t ksq
Definition: app-layer-dnp3-objects.h:1342
DNP3ObjectG22V8_::count
uint16_t count
Definition: app-layer-dnp3-objects.h:479
DNP3ObjectG23V5_::timestamp
uint64_t timestamp
Definition: app-layer-dnp3-objects.h:541
DNP3ObjectG70V1_::permission
uint16_t permission
Definition: app-layer-dnp3-objects.h:1196
DNP3ObjectG70V4_::file_handle
uint32_t file_handle
Definition: app-layer-dnp3-objects.h:1231
DNP3ObjectG70V4_::optional_text_len
uint8_t optional_text_len
Definition: app-layer-dnp3-objects.h:1237
DNP3ObjectG12V2_::ontime
uint32_t ontime
Definition: app-layer-dnp3-objects.h:182
DNP3ObjectG33V5_::value
float value
Definition: app-layer-dnp3-objects.h:880
DNP3ObjectG122V2_::timestamp
uint64_t timestamp
Definition: app-layer-dnp3-objects.h:1453
DNP3ObjectG33V4_::timestamp
uint64_t timestamp
Definition: app-layer-dnp3-objects.h:868
SCMalloc
#define SCMalloc(sz)
Definition: util-mem.h:47
DNP3ObjectG21V8_::count
uint16_t count
Definition: app-layer-dnp3-objects.h:363
DNP3ObjectG120V10_::user_public_key
uint8_t * user_public_key
Definition: app-layer-dnp3-objects.h:1380
DNP3ObjectG83V1_::data_objects
uint8_t * data_objects
Definition: app-layer-dnp3-objects.h:1286
DNP3ObjectG120V2_::mac_value
uint8_t * mac_value
Definition: app-layer-dnp3-objects.h:1316
DNP3ObjectG122V1_::association_id
uint16_t association_id
Definition: app-layer-dnp3-objects.h:1438
DNP3ObjectG33V7_::timestamp
uint64_t timestamp
Definition: app-layer-dnp3-objects.h:905
DNP3ObjectG70V2_::username_size
uint16_t username_size
Definition: app-layer-dnp3-objects.h:1209
DNP3ObjectG41V1_::control_status
uint8_t control_status
Definition: app-layer-dnp3-objects.h:983
DNP3ObjectG4V1_
Definition: app-layer-dnp3-objects.h:94
DNP3ObjectG120V9_::mac_value
uint8_t * mac_value
Definition: app-layer-dnp3-objects.h:1366
DNP3ObjectG30V6_::value
double value
Definition: app-layer-dnp3-objects.h:636
DNP3ObjectG4V2_
Definition: app-layer-dnp3-objects.h:104
DNP3ObjectG70V7_::created_timestamp
uint64_t created_timestamp
Definition: app-layer-dnp3-objects.h:1260
SCFree
#define SCFree(p)
Definition: util-mem.h:61
DNP3ObjectG120V11_::master_challenge_data_len
uint16_t master_challenge_data_len
Definition: app-layer-dnp3-objects.h:1387
DNP3ObjectG4V3_
Definition: app-layer-dnp3-objects.h:115
DNP3ObjectG21V5_::count
uint32_t count
Definition: app-layer-dnp3-objects.h:324
DNP3ObjectG32V6_::value
double value
Definition: app-layer-dnp3-objects.h:792
DNP3ObjectG70V8_::file_specification
char * file_specification
Definition: app-layer-dnp3-objects.h:1267
DNP3ObjectG120V5_::mal
uint8_t mal
Definition: app-layer-dnp3-objects.h:1334
DNP3ObjectG23V2_::count
uint16_t count
Definition: app-layer-dnp3-objects.h:504
DNP3ObjectG70V6_::status_code
uint8_t status_code
Definition: app-layer-dnp3-objects.h:1250
DNP3ObjectG70V6_::file_handle
uint32_t file_handle
Definition: app-layer-dnp3-objects.h:1248
DNP3FreeObjectPoint
void DNP3FreeObjectPoint(int group, int variation, void *point)
Definition: app-layer-dnp3-objects.c:8905
DNP3ObjectG11V2_::timestamp
uint64_t timestamp
Definition: app-layer-dnp3-objects.h:161
DNP3ObjectG34V3_::deadband_value
float deadband_value
Definition: app-layer-dnp3-objects.h:930
DNP3ObjectG83V1_::vendor_code
char vendor_code[5]
Definition: app-layer-dnp3-objects.h:1283
DNP3ObjectG22V1_
Definition: app-layer-dnp3-objects.h:383
DNP3ObjectG70V2_::password_size
uint16_t password_size
Definition: app-layer-dnp3-objects.h:1211
DNP3ObjectG22V5_
Definition: app-layer-dnp3-objects.h:431
DNP3ObjectG22V4_
Definition: app-layer-dnp3-objects.h:419
DNP3ObjectG22V3_
Definition: app-layer-dnp3-objects.h:407
DNP3ObjectG20V8_::count
uint16_t count
Definition: app-layer-dnp3-objects.h:264
DNP3ObjectG22V2_
Definition: app-layer-dnp3-objects.h:395
DNP3ObjectG43V7_::timestamp
uint64_t timestamp
Definition: app-layer-dnp3-objects.h:1143
DNP3ObjectG22V8_
Definition: app-layer-dnp3-objects.h:470
DNP3ObjectG22V7_
Definition: app-layer-dnp3-objects.h:457
DNP3ObjectG22V6_
Definition: app-layer-dnp3-objects.h:444
DNP3ObjectG43V8_::timestamp
uint64_t timestamp
Definition: app-layer-dnp3-objects.h:1150
DNP3Point_::index
uint32_t index
Definition: app-layer-dnp3.h:181
DNP3ObjectG41V1_::value
int32_t value
Definition: app-layer-dnp3-objects.h:982
DNP3ObjectG21V12_
Definition: app-layer-dnp3-objects.h:379
DNP3ObjectG21V10_
Definition: app-layer-dnp3-objects.h:371
DNP3ObjectG83V1_
Definition: app-layer-dnp3-objects.h:1282
DNP3ObjectG70V4_::optional_text
char optional_text[256]
Definition: app-layer-dnp3-objects.h:1236
DNP3ObjectG21V11_
Definition: app-layer-dnp3-objects.h:375
DNP3ObjectG120V10_::operation
uint8_t operation
Definition: app-layer-dnp3-objects.h:1372
app-layer-dnp3-objects.h
DNP3ObjectG30V3_::value
int32_t value
Definition: app-layer-dnp3-objects.h:608
DNP3ObjectG11V1_
Definition: app-layer-dnp3-objects.h:141
DNP3ObjectG120V6_::wrapped_key_data_len
uint16_t wrapped_key_data_len
Definition: app-layer-dnp3-objects.h:1345
DNP3Point_::prefix
uint32_t prefix
Definition: app-layer-dnp3.h:180
DNP3ObjectG70V1_::end_record
uint16_t end_record
Definition: app-layer-dnp3-objects.h:1193
DNP3ObjectG42V4_::timestamp
uint64_t timestamp
Definition: app-layer-dnp3-objects.h:1048
DNP3ObjectG11V2_
Definition: app-layer-dnp3-objects.h:152
DNP3ObjectG22V8_::timestamp
uint64_t timestamp
Definition: app-layer-dnp3-objects.h:480
DNP3ObjectG120V10_::username_len
uint16_t username_len
Definition: app-layer-dnp3-objects.h:1376
DNP3ObjectG120V13_::user_number
uint16_t user_number
Definition: app-layer-dnp3-objects.h:1401
DNP3ObjectG70V5_::file_data
char file_data[256]
Definition: app-layer-dnp3-objects.h:1243
DNP3ObjectG120V13_::encrypted_update_key_data
uint8_t * encrypted_update_key_data
Definition: app-layer-dnp3-objects.h:1403
DNP3ObjectG51V2_::timestamp
uint64_t timestamp
Definition: app-layer-dnp3-objects.h:1177
DNP3ObjectG33V8_::timestamp
uint64_t timestamp
Definition: app-layer-dnp3-objects.h:918
DNP3ObjectG23V6_::timestamp
uint64_t timestamp
Definition: app-layer-dnp3-objects.h:554
DNP3ObjectG23V4_::count
uint16_t count
Definition: app-layer-dnp3-objects.h:528
DNP3ObjectG120V2_::mac_value_len
uint16_t mac_value_len
Definition: app-layer-dnp3-objects.h:1317
DNP3ObjectG120V7_::error_text
char * error_text
Definition: app-layer-dnp3-objects.h:1354
SCCalloc
#define SCCalloc(nm, sz)
Definition: util-mem.h:53
DNP3ObjectG50V4_::timestamp
uint64_t timestamp
Definition: app-layer-dnp3-objects.h:1167
DNP3ObjectG120V7_::error_text_len
uint16_t error_text_len
Definition: app-layer-dnp3-objects.h:1355
DNP3ObjectG80V1_
Definition: app-layer-dnp3-objects.h:1271
DNP3ObjectG120V1_::challenge_data_len
uint16_t challenge_data_len
Definition: app-layer-dnp3-objects.h:1310
DNP3ObjectG22V2_::count
uint16_t count
Definition: app-layer-dnp3-objects.h:404
DNP3ObjectG70V7_::file_type
uint16_t file_type
Definition: app-layer-dnp3-objects.h:1258
DNP3ObjectG21V3_::count
uint32_t count
Definition: app-layer-dnp3-objects.h:300
DNP3ObjectG34V1_
Definition: app-layer-dnp3-objects.h:921
DNP3ObjectG42V7_::timestamp
uint64_t timestamp
Definition: app-layer-dnp3-objects.h:1085
DNP3ObjectG43V8_::commanded_value
double commanded_value
Definition: app-layer-dnp3-objects.h:1149
DNP3ObjectG42V1_
Definition: app-layer-dnp3-objects.h:1001
DNP3ObjectG34V3_
Definition: app-layer-dnp3-objects.h:929
DNP3ObjectG34V2_
Definition: app-layer-dnp3-objects.h:925
DNP3ObjectG42V5_
Definition: app-layer-dnp3-objects.h:1051
DNP3ObjectG42V4_
Definition: app-layer-dnp3-objects.h:1038
DNP3ObjectG42V3_
Definition: app-layer-dnp3-objects.h:1025
DNP3ObjectG42V2_
Definition: app-layer-dnp3-objects.h:1013
DNP3ObjectG70V7_::permissions
uint16_t permissions
Definition: app-layer-dnp3-objects.h:1261
DNP3ObjectG42V8_
Definition: app-layer-dnp3-objects.h:1088
DNP3ObjectG42V7_
Definition: app-layer-dnp3-objects.h:1075
DNP3ObjectG42V6_
Definition: app-layer-dnp3-objects.h:1063
DNP3ObjectG21V12_::count
uint16_t count
Definition: app-layer-dnp3-objects.h:380
DNP3ObjectG120V8_::key_change_method
uint8_t key_change_method
Definition: app-layer-dnp3-objects.h:1359
DNP3ObjectG120V12_::challenge_data
uint8_t * challenge_data
Definition: app-layer-dnp3-objects.h:1396
DNP3ObjectG34V1_::deadband_value
uint16_t deadband_value
Definition: app-layer-dnp3-objects.h:922
DNP3Point_
DNP3 object point.
Definition: app-layer-dnp3.h:179
DNP3ObjectG120V13_::encrypted_update_key_len
uint16_t encrypted_update_key_len
Definition: app-layer-dnp3-objects.h:1402
DNP3ObjectG21V6_::timestamp
uint64_t timestamp
Definition: app-layer-dnp3-objects.h:338
DNP3ObjectG120V1_::reason
uint8_t reason
Definition: app-layer-dnp3-objects.h:1308
DNP3ObjectG31V4_::timestamp
uint64_t timestamp
Definition: app-layer-dnp3-objects.h:686
DNP3ObjectG23V1_
Definition: app-layer-dnp3-objects.h:483
DNP3ObjectG120V10_::scs
uint32_t scs
Definition: app-layer-dnp3-objects.h:1373
DNP3ObjectG31V1_
Definition: app-layer-dnp3-objects.h:639
DNP3ObjectG23V5_
Definition: app-layer-dnp3-objects.h:531
DNP3ObjectG23V4_
Definition: app-layer-dnp3-objects.h:519
DNP3ObjectG23V3_
Definition: app-layer-dnp3-objects.h:507
DNP3ObjectG32V3_::timestamp
uint64_t timestamp
Definition: app-layer-dnp3-objects.h:755
DNP3ObjectG22V3_::count
uint32_t count
Definition: app-layer-dnp3-objects.h:416
DNP3ObjectG70V4_::request_id
uint16_t request_id
Definition: app-layer-dnp3-objects.h:1234
DNP3ObjectG23V2_
Definition: app-layer-dnp3-objects.h:495
DNP3ObjectG31V5_
Definition: app-layer-dnp3-objects.h:689
DNP3ObjectG31V4_
Definition: app-layer-dnp3-objects.h:676
DNP3ObjectG23V8_
Definition: app-layer-dnp3-objects.h:570
DNP3ObjectG31V3_
Definition: app-layer-dnp3-objects.h:663
DNP3ObjectG13V2_::timestamp
uint64_t timestamp
Definition: app-layer-dnp3-objects.h:200
DNP3ObjectG23V7_
Definition: app-layer-dnp3-objects.h:557
DNP3ObjectG31V2_
Definition: app-layer-dnp3-objects.h:651
DNP3ObjectG23V6_
Definition: app-layer-dnp3-objects.h:544