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