Skip to content

Commit

Permalink
dnp3: clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonish committed Dec 1, 2023
1 parent dcd460d commit 837b09d
Show file tree
Hide file tree
Showing 11 changed files with 1,843 additions and 2,234 deletions.
1,560 changes: 623 additions & 937 deletions src/app-layer/dnp3/app-layer-dnp3-objects.c

Large diffs are not rendered by default.

1,345 changes: 672 additions & 673 deletions src/app-layer/dnp3/app-layer-dnp3-objects.h

Large diffs are not rendered by default.

820 changes: 392 additions & 428 deletions src/app-layer/dnp3/app-layer-dnp3.c

Large diffs are not rendered by default.

70 changes: 35 additions & 35 deletions src/app-layer/dnp3/app-layer-dnp3.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@
#define DNP3_APP_FC_AUTH_REQ_NR 0x21

/* DNP3 application response function codes. */
#define DNP3_APP_FC_RESPONSE 0x81
#define DNP3_APP_FC_UNSOLICITED_RESP 0x82
#define DNP3_APP_FC_AUTH_RESP 0x83
#define DNP3_APP_FC_RESPONSE 0x81
#define DNP3_APP_FC_UNSOLICITED_RESP 0x82
#define DNP3_APP_FC_AUTH_RESP 0x83

/* Extract fields from the link control octet. */
#define DNP3_LINK_DIR(control) (control & 0x80)
Expand Down Expand Up @@ -115,13 +115,13 @@ enum {
* \brief DNP3 link header.
*/
typedef struct DNP3LinkHeader_ {
uint8_t start_byte0; /**< First check byte. */
uint8_t start_byte1; /**< Second check byte. */
uint8_t len; /**< Length of PDU without CRCs. */
uint8_t control; /**< Control flags. */
uint16_t dst; /**< DNP3 destination address. */
uint16_t src; /**< DNP3 source address. */
uint16_t crc; /**< Link header CRC. */
uint8_t start_byte0; /**< First check byte. */
uint8_t start_byte1; /**< Second check byte. */
uint8_t len; /**< Length of PDU without CRCs. */
uint8_t control; /**< Control flags. */
uint16_t dst; /**< DNP3 destination address. */
uint16_t src; /**< DNP3 source address. */
uint16_t crc; /**< Link header CRC. */
} __attribute__((__packed__)) DNP3LinkHeader;

/**
Expand All @@ -133,8 +133,8 @@ typedef uint8_t DNP3TransportHeader;
* \brief DNP3 application header.
*/
typedef struct DNP3ApplicationHeader_ {
uint8_t control; /**< Control flags. */
uint8_t function_code; /**< Application function code. */
uint8_t control; /**< Control flags. */
uint8_t function_code; /**< Application function code. */
} __attribute__((__packed__)) DNP3ApplicationHeader;

/**
Expand All @@ -152,9 +152,9 @@ typedef struct DNP3InternalInd_ {
*/
typedef struct DNP3Buffer_ {
uint8_t *buffer;
size_t size;
int len;
int offset;
size_t size;
int len;
int offset;
} DNP3Buffer;

/**
Expand All @@ -173,14 +173,14 @@ typedef struct DNP3ObjHeader_ {
* of the object.
*/
typedef struct DNP3Point_ {
uint32_t prefix; /**< Prefix value for point. */
uint32_t index; /**< Index of point. If the object is prefixed
* with an index then this will be that
* value. Otherwise this is the place the point
* was in the list of points (starting at 0). */
uint32_t size; /**< Size of point if the object prefix was a
* size. */
void *data; /**< Data for this point. */
uint32_t prefix; /**< Prefix value for point. */
uint32_t index; /**< Index of point. If the object is prefixed
* with an index then this will be that
* value. Otherwise this is the place the point
* was in the list of points (starting at 0). */
uint32_t size; /**< Size of point if the object prefix was a
* size. */
void *data; /**< Data for this point. */
TAILQ_ENTRY(DNP3Point_) next;
} DNP3Point;

Expand All @@ -190,14 +190,14 @@ typedef TAILQ_HEAD(DNP3PointList_, DNP3Point_) DNP3PointList;
* \brief Struct to hold the list of decoded objects.
*/
typedef struct DNP3Object_ {
uint8_t group;
uint8_t variation;
uint8_t qualifier;
uint8_t prefix_code;
uint8_t range_code;
uint32_t start;
uint32_t stop;
uint32_t count;
uint8_t group;
uint8_t variation;
uint8_t qualifier;
uint8_t prefix_code;
uint8_t range_code;
uint32_t start;
uint32_t stop;
uint32_t count;
DNP3PointList *points; /**< List of points for this object. */

TAILQ_ENTRY(DNP3Object_) next;
Expand All @@ -209,7 +209,7 @@ typedef TAILQ_HEAD(DNP3ObjectList_, DNP3Object_) DNP3ObjectList;
* \brief DNP3 transaction.
*/
typedef struct DNP3Transaction_ {
AppLayerTxData tx_data;
AppLayerTxData tx_data;

uint64_t tx_num; /**< Internal transaction ID. */
bool is_request; /**< Is this tx a request? */
Expand Down Expand Up @@ -238,11 +238,11 @@ TAILQ_HEAD(TxListHead, DNP3Transaction_);
typedef struct DNP3State_ {
AppLayerStateData state_data;
TAILQ_HEAD(, DNP3Transaction_) tx_list;
DNP3Transaction *curr; /**< Current transaction. */
DNP3Transaction *curr; /**< Current transaction. */
uint64_t transaction_max;
uint16_t events;
uint32_t unreplied; /**< Number of unreplied requests. */
uint8_t flooded; /**< Flag indicating flood. */
uint32_t unreplied; /**< Number of unreplied requests. */
uint8_t flooded; /**< Flag indicating flood. */

DNP3Buffer request_buffer; /**< Request buffer for buffering
* incomplete request PDUs received
Expand Down
Loading

0 comments on commit 837b09d

Please sign in to comment.