An mbed implementation of IEC 61850-9-2LE Sample Values. Creating using the rapid61850 library, available at: https://github.com/stevenblair/rapid61850.
An mbed implementation of IEC 61850-9-2LE Sample Values. Creating using the rapid61850 library, available at: https://github.com/stevenblair/rapid61850.
rapid61850/svPacketData.h@0:f09b7bb8bcce, 2012-10-02 (annotated)
- Committer:
- sblair
- Date:
- Tue Oct 02 21:31:05 2012 +0000
- Revision:
- 0:f09b7bb8bcce
converted library to folder
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sblair | 0:f09b7bb8bcce | 1 | /** |
sblair | 0:f09b7bb8bcce | 2 | * Rapid-prototyping protection schemes with IEC 61850 |
sblair | 0:f09b7bb8bcce | 3 | * |
sblair | 0:f09b7bb8bcce | 4 | * Copyright (c) 2012 Steven Blair |
sblair | 0:f09b7bb8bcce | 5 | * |
sblair | 0:f09b7bb8bcce | 6 | * This program is free software; you can redistribute it and/or |
sblair | 0:f09b7bb8bcce | 7 | * modify it under the terms of the GNU General Public License |
sblair | 0:f09b7bb8bcce | 8 | * as published by the Free Software Foundation; either version 2 |
sblair | 0:f09b7bb8bcce | 9 | * of the License, or (at your option) any later version. |
sblair | 0:f09b7bb8bcce | 10 | |
sblair | 0:f09b7bb8bcce | 11 | * This program is distributed in the hope that it will be useful, |
sblair | 0:f09b7bb8bcce | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
sblair | 0:f09b7bb8bcce | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
sblair | 0:f09b7bb8bcce | 14 | * GNU General Public License for more details. |
sblair | 0:f09b7bb8bcce | 15 | |
sblair | 0:f09b7bb8bcce | 16 | * You should have received a copy of the GNU General Public License |
sblair | 0:f09b7bb8bcce | 17 | * along with this program; if not, write to the Free Software |
sblair | 0:f09b7bb8bcce | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
sblair | 0:f09b7bb8bcce | 19 | */ |
sblair | 0:f09b7bb8bcce | 20 | |
sblair | 0:f09b7bb8bcce | 21 | #ifndef SV_PACKET_DATA_H |
sblair | 0:f09b7bb8bcce | 22 | #define SV_PACKET_DATA_H |
sblair | 0:f09b7bb8bcce | 23 | |
sblair | 0:f09b7bb8bcce | 24 | #include <stdlib.h> |
sblair | 0:f09b7bb8bcce | 25 | #include <string.h> |
sblair | 0:f09b7bb8bcce | 26 | #include "ctypes.h" |
sblair | 0:f09b7bb8bcce | 27 | |
sblair | 0:f09b7bb8bcce | 28 | #define SV_USE_VLAN 0 // set to "1" to insert VLAN tag into SV packets |
sblair | 0:f09b7bb8bcce | 29 | #define SV_OPTIONAL_SUPPORTED 0 // set to "1" to enable output of optional items in SV packets (Wireshark does not support these) |
sblair | 0:f09b7bb8bcce | 30 | #define SV_FIXED_SMPCNT_CONFREV_SIZE 1 // set to "1" to force smpCnt and confRev field to be fixed size, rather than BER encoded |
sblair | 0:f09b7bb8bcce | 31 | |
sblair | 0:f09b7bb8bcce | 32 | #define SV_MAX_DATASET_SIZE 512//1024 |
sblair | 0:f09b7bb8bcce | 33 | |
sblair | 0:f09b7bb8bcce | 34 | struct ASDU { |
sblair | 0:f09b7bb8bcce | 35 | unsigned char *svID; |
sblair | 0:f09b7bb8bcce | 36 | unsigned char *datset; // optional |
sblair | 0:f09b7bb8bcce | 37 | CTYPE_INT16U smpCnt; |
sblair | 0:f09b7bb8bcce | 38 | CTYPE_INT32U confRev; |
sblair | 0:f09b7bb8bcce | 39 | //struct UtcTime refrTm; // optional |
sblair | 0:f09b7bb8bcce | 40 | CTYPE_TIMESTAMP refrTm; // optional |
sblair | 0:f09b7bb8bcce | 41 | CTYPE_BOOLEAN smpSynch; |
sblair | 0:f09b7bb8bcce | 42 | CTYPE_INT16U smpRate; // optional |
sblair | 0:f09b7bb8bcce | 43 | int showDatset; |
sblair | 0:f09b7bb8bcce | 44 | int showRefrTm; |
sblair | 0:f09b7bb8bcce | 45 | int showSmpRate; |
sblair | 0:f09b7bb8bcce | 46 | struct data { |
sblair | 0:f09b7bb8bcce | 47 | unsigned char data[SV_MAX_DATASET_SIZE]; |
sblair | 0:f09b7bb8bcce | 48 | CTYPE_INT32U size; |
sblair | 0:f09b7bb8bcce | 49 | } data; |
sblair | 0:f09b7bb8bcce | 50 | }; |
sblair | 0:f09b7bb8bcce | 51 | |
sblair | 0:f09b7bb8bcce | 52 | struct svControl { |
sblair | 0:f09b7bb8bcce | 53 | struct ethHeaderData ethHeaderData; |
sblair | 0:f09b7bb8bcce | 54 | short noASDU; |
sblair | 0:f09b7bb8bcce | 55 | struct ASDU *ASDU; |
sblair | 0:f09b7bb8bcce | 56 | CTYPE_INT16U ASDUCount; // stores present ASDU count; transmit a packet when equals "noASDU" |
sblair | 0:f09b7bb8bcce | 57 | CTYPE_INT16U sampleCountMaster; |
sblair | 0:f09b7bb8bcce | 58 | int (*update)(unsigned char *buf); // function pointer to save next ASDU, and possible send SV packet |
sblair | 0:f09b7bb8bcce | 59 | }; |
sblair | 0:f09b7bb8bcce | 60 | |
sblair | 0:f09b7bb8bcce | 61 | #endif |