Go to the documentation of this file.
18 #ifndef __APP_LAYER_DNP3_H__
19 #define __APP_LAYER_DNP3_H__
29 #define DNP3_MAX_LINK_PDU_LEN 292
32 #define DNP3_APP_FC_CONFIRM 0x00
33 #define DNP3_APP_FC_READ 0x01
34 #define DNP3_APP_FC_WRITE 0x02
35 #define DNP3_APP_FC_SELECT 0x03
36 #define DNP3_APP_FC_OPERATE 0x04
37 #define DNP3_APP_FC_DIR_OPERATE 0x05
38 #define DNP3_APP_FC_DIR_OPERATE_NR 0x06
39 #define DNP3_APP_FC_FREEZE 0x07
40 #define DNP3_APP_FC_FREEZE_NR 0x08
41 #define DNP3_APP_FC_FREEZE_CLEAR 0x09
42 #define DNP3_APP_FC_FREEZE_CLEAR_NR 0x0a
43 #define DNP3_APP_FC_FREEZE_AT_TIME 0x0b
44 #define DNP3_APP_FC_FREEZE_AT_TIME_NR 0x0c
45 #define DNP3_APP_FC_COLD_RESTART 0x0d
46 #define DNP3_APP_FC_WARM_RESTART 0x0e
47 #define DNP3_APP_FC_INITIALIZE_DATA 0x0f
48 #define DNP3_APP_FC_INITIALIZE_APPLICATION 0x10
49 #define DNP3_APP_FC_START_APPLICATION 0x11
50 #define DNP3_APP_FC_STOP_APPLICATION 0x12
51 #define DNP3_APP_FC_SAVE_CONFIGURATION 0x13
52 #define DNP3_APP_FC_ENABLE_UNSOLICITED 0x14
53 #define DNP3_APP_FC_DISABLE_UNSOLICTED 0x15
54 #define DNP3_APP_FC_ASSIGN_CLASS 0x16
55 #define DNP3_APP_FC_DELAY_MEASUREMENT 0x17
56 #define DNP3_APP_FC_RECORD_CURRENT_TIME 0x18
57 #define DNP3_APP_FC_OPEN_TIME 0x19
58 #define DNP3_APP_FC_CLOSE_FILE 0x1a
59 #define DNP3_APP_FC_DELETE_FILE 0x1b
60 #define DNP3_APP_FC_GET_FILE_INFO 0x1c
61 #define DNP3_APP_FC_AUTHENTICATE_FILE 0x1d
62 #define DNP3_APP_FC_ABORT_FILE 0x1e
63 #define DNP3_APP_FC_ACTIVATE_CONFIG 0x1f
64 #define DNP3_APP_FC_AUTH_REQ 0x20
65 #define DNP3_APP_FC_AUTH_REQ_NR 0x21
68 #define DNP3_APP_FC_RESPONSE 0x81
69 #define DNP3_APP_FC_UNSOLICITED_RESP 0x82
70 #define DNP3_APP_FC_AUTH_RESP 0x83
73 #define DNP3_LINK_DIR(control) (control & 0x80)
74 #define DNP3_LINK_PRI(control) (control & 0x40)
75 #define DNP3_LINK_FCB(control) (control & 0x20)
76 #define DNP3_LINK_FCV(control) (control & 0x10)
77 #define DNP3_LINK_FC(control) (control & 0x0f)
80 #define DNP3_TH_FIN(x) (x & 0x80)
81 #define DNP3_TH_FIR(x) (x & 0x40)
82 #define DNP3_TH_SEQ(x) (x & 0x3f)
85 #define DNP3_APP_FIR(x) (x & 0x80)
86 #define DNP3_APP_FIN(x) (x & 0x40)
87 #define DNP3_APP_CON(x) (x & 0x20)
88 #define DNP3_APP_UNS(x) (x & 0x10)
89 #define DNP3_APP_SEQ(x) (x & 0x0f)
93 #if __BYTE_ORDER == __BIG_ENDIAN
94 #define DNP3_SWAP16(x) SCByteSwap16(x)
95 #define DNP3_SWAP32(x) SCByteSwap32(x)
96 #define DNP3_SWAP64(x) SCByteSwap64(x)
97 #elif __BYTE_ORDER == __LITTLE_ENDIAN
98 #define DNP3_SWAP16(x) x
99 #define DNP3_SWAP32(x) x
100 #define DNP3_SWAP64(x) x
TAILQ_ENTRY(DNP3Transaction_) next
void DNP3ParserRegisterTests(void)
DNP3LinkHeader response_lh
@ DNP3_DECODER_EVENT_MALFORMED
DNP3Buffer response_buffer
struct HtpBodyChunk_ * next
@ DNP3_DECODER_EVENT_FLOODED
Struct to hold the list of decoded objects.
struct DNP3Object_ DNP3Object
Struct to hold the list of decoded objects.
struct DNP3LinkHeader_ __attribute__((__packed__)) DNP3LinkHeader
DNP3 link header.
uint8_t * response_buffer
typedef TAILQ_HEAD(DNP3PointList_, DNP3Point_) DNP3PointList
void RegisterDNP3Parsers(void)
Register the DNP3 application protocol parser.
DNP3Buffer request_buffer
uint8_t response_complete
Data structure to store app layer decoder events.
@ DNP3_DECODER_EVENT_UNKNOWN_OBJECT
TAILQ_ENTRY(DNP3Object_) next
DNP3InternalInd response_iin
DNP3TransportHeader response_th
DNP3 internal indicators.
struct DNP3State_ DNP3State
Per flow DNP3 state.
TAILQ_HEAD(, DNP3Transaction_) tx_list
uint32_t request_buffer_len
Data structures and function prototypes for keeping state for the detection engine.
DNP3ApplicationHeader request_ah
DNP3ApplicationHeader response_ah
DNP3TransportHeader request_th
@ DNP3_DECODER_EVENT_BAD_LINK_CRC
struct DNP3Point_ DNP3Point
DNP3 object point.
@ DNP3_DECODER_EVENT_BAD_TRANSPORT_CRC
DNP3LinkHeader request_lh
struct DNP3Transaction_ DNP3Transaction
DNP3 transaction.
DNP3ObjectList request_objects
struct DNP3Buffer_ DNP3Buffer
A struct used for buffering incoming data prior to reassembly.
TAILQ_ENTRY(DNP3Point_) next
DetectEngineState * de_state
uint8_t DNP3TransportHeader
DNP3 transport header.
int DNP3PrefixIsSize(uint8_t)
Check if the prefix code is a size prefix.
uint32_t response_buffer_len
AppLayerDecoderEvents * decoder_events
DNP3ObjectList response_objects
A struct used for buffering incoming data prior to reassembly.
@ DNP3_DECODER_EVENT_LEN_TOO_SMALL