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