app-layer-dnp3.c File Reference
#include "suricata-common.h"
#include "stream.h"
#include "util-byte.h"
#include "util-unittest.h"
#include "util-hashlist.h"
#include "util-print.h"
#include "app-layer-protos.h"
#include "app-layer-parser.h"
#include "app-layer-detect-proto.h"
#include "app-layer-dnp3.h"
#include "app-layer-dnp3-objects.h"
#include "app-layer-dcerpc-common.h"
#include "flow-util.h"
#include "stream-tcp.h"
Include dependency graph for app-layer-dnp3.c:

Go to the source code of this file.


#define DNP3_DEFAULT_PORT   "20000"
#define DNP3_START_BYTE0   0x05
#define DNP3_START_BYTE1   0x64
#define DNP3_MIN_LEN   5
#define DNP3_CRC_LEN   2
#define DNP3_BLOCK_SIZE   16
#define DNP3_MAX_TRAN_SEQNO   64
#define DNP3_MAX_APP_SEQNO   16
#define DNP3_LINK_HDR_LEN   5
#define DNP3_RESERVED_ADDR_MIN   0xfff0
#define DNP3_RESERVED_ADDR_MAX   0xfffb
#define DNP3_SRC_ADDR_MAX   0xfff0
#define DNP3_OBJ_TIME_SIZE   6 /* AKA UINT48. */
#define DNP3_OBJ_G12_V1_SIZE   11
#define DNP3_OBJ_G12_V2_SIZE   11
#define DNP3_OBJ_G12_V3_SIZE   1
#define DNP3_OBJ_PREFIX(x)   ((x >> 4) & 0x7)
#define DNP3_OBJ_RANGE(x)   (x & 0xf)
#define NEXT_TH_SEQNO(current)   ((current + 1) % DNP3_MAX_TRAN_SEQNO)
#define NEXT_APP_SEQNO(current)   ((current + 1) % DNP3_MAX_APP_SEQNO)




int DNP3PrefixIsSize (uint8_t prefix_code)
 Check if the prefix code is a size prefix. More...
void RegisterDNP3Parsers (void)
 Register the DNP3 application protocol parser. More...
void DNP3ParserRegisterTests (void)


SCEnumCharMap dnp3_decoder_event_table []

Macro Definition Documentation

#define DNP3_BLOCK_SIZE   16

Definition at line 53 of file app-layer-dnp3.c.

Referenced by RegisterDNP3Parsers().

#define DNP3_CRC_LEN   2

Definition at line 49 of file app-layer-dnp3.c.

Referenced by RegisterDNP3Parsers().

#define DNP3_DEFAULT_PORT   "20000"

Definition at line 39 of file app-layer-dnp3.c.

Referenced by RegisterDNP3Parsers().


Definition at line 37 of file app-layer-dnp3.c.

Referenced by RegisterDNP3Parsers().

#define DNP3_LINK_HDR_LEN   5

Definition at line 63 of file app-layer-dnp3.c.

#define DNP3_MAX_APP_SEQNO   16

Definition at line 59 of file app-layer-dnp3.c.

#define DNP3_MAX_TRAN_SEQNO   64

Definition at line 56 of file app-layer-dnp3.c.

#define DNP3_MIN_LEN   5

Definition at line 46 of file app-layer-dnp3.c.

#define DNP3_OBJ_G12_V1_SIZE   11

Definition at line 79 of file app-layer-dnp3.c.

#define DNP3_OBJ_G12_V2_SIZE   11

Definition at line 80 of file app-layer-dnp3.c.

#define DNP3_OBJ_G12_V3_SIZE   1

Definition at line 81 of file app-layer-dnp3.c.

#define DNP3_OBJ_PREFIX (   x)    ((x >> 4) & 0x7)

Definition at line 84 of file app-layer-dnp3.c.

#define DNP3_OBJ_RANGE (   x)    (x & 0xf)

Definition at line 87 of file app-layer-dnp3.c.

#define DNP3_OBJ_TIME_SIZE   6 /* AKA UINT48. */

Definition at line 78 of file app-layer-dnp3.c.

#define DNP3_RESERVED_ADDR_MAX   0xfffb

Definition at line 73 of file app-layer-dnp3.c.

#define DNP3_RESERVED_ADDR_MIN   0xfff0

Definition at line 72 of file app-layer-dnp3.c.

#define DNP3_SRC_ADDR_MAX   0xfff0

Definition at line 76 of file app-layer-dnp3.c.

#define DNP3_START_BYTE0   0x05

Definition at line 42 of file app-layer-dnp3.c.

#define DNP3_START_BYTE1   0x64

Definition at line 43 of file app-layer-dnp3.c.

#define NEXT_APP_SEQNO (   current)    ((current + 1) % DNP3_MAX_APP_SEQNO)

Definition at line 107 of file app-layer-dnp3.c.

#define NEXT_TH_SEQNO (   current)    ((current + 1) % DNP3_MAX_TRAN_SEQNO)

Definition at line 104 of file app-layer-dnp3.c.

Enumeration Type Documentation

anonymous enum

Definition at line 66 of file app-layer-dnp3.c.

Function Documentation

void DNP3ParserRegisterTests ( void  )

Definition at line 2646 of file app-layer-dnp3.c.

References UtRegisterTest().

Referenced by RegisterDNP3Parsers().

Here is the call graph for this function:

Here is the caller graph for this function:

int DNP3PrefixIsSize ( uint8_t  prefix_code)

Check if the prefix code is a size prefix.

Return values
1if the prefix_code specifies a size prefix, 0 if not.

Definition at line 1562 of file app-layer-dnp3.c.

References DNP3Transaction_::detect_flags_tc, DNP3Transaction_::detect_flags_ts, and STREAM_TOSERVER.

Referenced by DNP3FreeObjectPointList().

Here is the caller graph for this function:

void RegisterDNP3Parsers ( void  )

Register the DNP3 application protocol parser.

Definition at line 1599 of file app-layer-dnp3.c.

References Flow_::alproto, ALPROTO_DNP3, ALPROTO_FAILED, ALPROTO_UNKNOWN, Flow_::alstate, AppLayerParserConfParserEnabled(), AppLayerParserParse(), AppLayerParserRegisterDetectFlagsFuncs(), AppLayerParserRegisterDetectStateFuncs(), AppLayerParserRegisterGetEventInfo(), AppLayerParserRegisterGetEventInfoById(), AppLayerParserRegisterGetEventsFunc(), AppLayerParserRegisterGetStateProgressCompletionStatus(), AppLayerParserRegisterGetStateProgressFunc(), AppLayerParserRegisterGetTx(), AppLayerParserRegisterGetTxCnt(), AppLayerParserRegisterLoggerFuncs(), AppLayerParserRegisterParser(), AppLayerParserRegisterProtocolUnittests(), AppLayerParserRegisterStateFuncs(), AppLayerParserRegisterTxFreeFunc(), AppLayerParserThreadCtxAlloc(), AppLayerParserThreadCtxFree(), AppLayerProtoDetectConfProtoDetectionEnabled(), AppLayerProtoDetectPPParseConfPorts(), AppLayerProtoDetectPPRegister(), AppLayerProtoDetectRegisterProtocol(), DNP3Buffer_::buffer, DNP3Object_::count, crc, DNP3State_::curr, DNP3Point_::data, DNP3_APP_FC_DIR_OPERATE, DNP3_APP_FC_UNSOLICITED_RESP, DNP3_BLOCK_SIZE, DNP3_CRC_LEN, DNP3_DEFAULT_PORT, DNP3_DEFAULT_REQ_FLOOD_COUNT, DNP3ParserRegisterTests(), FAIL_IF, FAIL_IF_NOT, FAIL_IF_NULL, DNP3ObjectG70V3_::filename, DNP3State_::flooded, FLOW_DESTROY, DNP3Object_::group, DNP3Transaction_::has_request, DNP3Buffer_::len, len, Flow_::m, DNP3Buffer_::offset, PASS, DNP3Object_::points, DNP3Point_::prefix, DNP3Object_::prefix_code, Flow_::proto, Flow_::protoctx, DNP3Object_::range_code, DNP3Transaction_::request_ah, DNP3Transaction_::request_buffer, DNP3State_::request_buffer, DNP3Transaction_::request_buffer_len, DNP3Transaction_::request_objects, DNP3Transaction_::response_ah, DNP3Transaction_::response_buffer, DNP3State_::response_buffer, DNP3Transaction_::response_buffer_len, DNP3Transaction_::response_done, RunmodeIsUnittests(), SCEnter, SCFree, SCMutexLock, SCMutexUnlock, SCReturn, DNP3Point_::size, STREAM_TOCLIENT, STREAM_TOSERVER, StreamTcpFreeConfig(), StreamTcpInitConfig(), TAILQ_EMPTY, TAILQ_FIRST, DNP3State_::transaction_max, TRUE, DNP3Transaction_::tx_num, and DNP3Object_::variation.

Referenced by AppLayerParserRegisterProtocolParsers(), and GetProgramVersion().

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation