Skip to content

Commit

Permalink
misc: prefix functions with SC not Sc
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonish authored and victorjulien committed Jun 8, 2024
1 parent d02054f commit f0dbfe8
Show file tree
Hide file tree
Showing 15 changed files with 28 additions and 28 deletions.
4 changes: 2 additions & 2 deletions rust/src/detect/byte_math.rs
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ fn parse_bytemath(input: &str) -> IResult<&str, DetectByteMathData, RuleParseErr

/// Intermediary function between the C code and the parsing functions.
#[no_mangle]
pub unsafe extern "C" fn ScByteMathParse(c_arg: *const c_char) -> *mut DetectByteMathData {
pub unsafe extern "C" fn SCByteMathParse(c_arg: *const c_char) -> *mut DetectByteMathData {
if c_arg.is_null() {
return std::ptr::null_mut();
}
Expand All @@ -438,7 +438,7 @@ pub unsafe extern "C" fn ScByteMathParse(c_arg: *const c_char) -> *mut DetectByt
}

#[no_mangle]
pub unsafe extern "C" fn ScByteMathFree(ptr: *mut DetectByteMathData) {
pub unsafe extern "C" fn SCByteMathFree(ptr: *mut DetectByteMathData) {
if !ptr.is_null() {
let _ = Box::from_raw(ptr);
}
Expand Down
22 changes: 11 additions & 11 deletions rust/src/enip/detect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ pub unsafe extern "C" fn SCEnipParseStatus(
}

#[no_mangle]
pub unsafe extern "C" fn ScEnipTxGetCommand(
pub unsafe extern "C" fn SCEnipTxGetCommand(
tx: &mut EnipTransaction, direction: u8, value: *mut u16,
) -> bool {
let direction: Direction = direction.into();
Expand Down Expand Up @@ -452,7 +452,7 @@ pub unsafe extern "C" fn SCEnipTxHasCipAttribute(
}

#[no_mangle]
pub unsafe extern "C" fn ScEnipTxGetStatus(
pub unsafe extern "C" fn SCEnipTxGetStatus(
tx: &mut EnipTransaction, direction: u8, value: *mut u32,
) -> bool {
if let Some(x) = enip_get_status(tx, direction.into()) {
Expand Down Expand Up @@ -491,7 +491,7 @@ fn enip_tx_get_protocol_version(tx: &mut EnipTransaction, direction: Direction)
}

#[no_mangle]
pub unsafe extern "C" fn ScEnipTxGetProtocolVersion(
pub unsafe extern "C" fn SCEnipTxGetProtocolVersion(
tx: &mut EnipTransaction, direction: u8, value: *mut u16,
) -> bool {
if let Some(val) = enip_tx_get_protocol_version(tx, direction.into()) {
Expand All @@ -502,7 +502,7 @@ pub unsafe extern "C" fn ScEnipTxGetProtocolVersion(
}

#[no_mangle]
pub unsafe extern "C" fn ScEnipTxGetCapabilities(
pub unsafe extern "C" fn SCEnipTxGetCapabilities(
tx: &mut EnipTransaction, value: *mut u16,
) -> bool {
if let Some(ref response) = tx.response {
Expand All @@ -519,7 +519,7 @@ pub unsafe extern "C" fn ScEnipTxGetCapabilities(
}

#[no_mangle]
pub unsafe extern "C" fn ScEnipTxGetRevision(tx: &mut EnipTransaction, value: *mut u16) -> bool {
pub unsafe extern "C" fn SCEnipTxGetRevision(tx: &mut EnipTransaction, value: *mut u16) -> bool {
if let Some(ref response) = tx.response {
if let EnipPayload::ListIdentity(lip) = &response.payload {
if !lip.is_empty() {
Expand All @@ -534,7 +534,7 @@ pub unsafe extern "C" fn ScEnipTxGetRevision(tx: &mut EnipTransaction, value: *m
}

#[no_mangle]
pub unsafe extern "C" fn ScEnipTxGetIdentityStatus(
pub unsafe extern "C" fn SCEnipTxGetIdentityStatus(
tx: &mut EnipTransaction, value: *mut u16,
) -> bool {
if let Some(ref response) = tx.response {
Expand All @@ -551,7 +551,7 @@ pub unsafe extern "C" fn ScEnipTxGetIdentityStatus(
}

#[no_mangle]
pub unsafe extern "C" fn ScEnipTxGetState(tx: &mut EnipTransaction, value: *mut u8) -> bool {
pub unsafe extern "C" fn SCEnipTxGetState(tx: &mut EnipTransaction, value: *mut u8) -> bool {
if let Some(ref response) = tx.response {
if let EnipPayload::ListIdentity(lip) = &response.payload {
if !lip.is_empty() {
Expand All @@ -566,7 +566,7 @@ pub unsafe extern "C" fn ScEnipTxGetState(tx: &mut EnipTransaction, value: *mut
}

#[no_mangle]
pub unsafe extern "C" fn ScEnipTxGetSerial(tx: &mut EnipTransaction, value: *mut u32) -> bool {
pub unsafe extern "C" fn SCEnipTxGetSerial(tx: &mut EnipTransaction, value: *mut u32) -> bool {
if let Some(ref response) = tx.response {
if let EnipPayload::ListIdentity(lip) = &response.payload {
if !lip.is_empty() {
Expand All @@ -581,7 +581,7 @@ pub unsafe extern "C" fn ScEnipTxGetSerial(tx: &mut EnipTransaction, value: *mut
}

#[no_mangle]
pub unsafe extern "C" fn ScEnipTxGetProductCode(tx: &mut EnipTransaction, value: *mut u16) -> bool {
pub unsafe extern "C" fn SCEnipTxGetProductCode(tx: &mut EnipTransaction, value: *mut u16) -> bool {
if let Some(ref response) = tx.response {
if let EnipPayload::ListIdentity(lip) = &response.payload {
if !lip.is_empty() {
Expand All @@ -596,7 +596,7 @@ pub unsafe extern "C" fn ScEnipTxGetProductCode(tx: &mut EnipTransaction, value:
}

#[no_mangle]
pub unsafe extern "C" fn ScEnipTxGetDeviceType(tx: &mut EnipTransaction, value: *mut u16) -> bool {
pub unsafe extern "C" fn SCEnipTxGetDeviceType(tx: &mut EnipTransaction, value: *mut u16) -> bool {
if let Some(ref response) = tx.response {
if let EnipPayload::ListIdentity(lip) = &response.payload {
if !lip.is_empty() {
Expand All @@ -611,7 +611,7 @@ pub unsafe extern "C" fn ScEnipTxGetDeviceType(tx: &mut EnipTransaction, value:
}

#[no_mangle]
pub unsafe extern "C" fn ScEnipTxGetVendorId(tx: &mut EnipTransaction, value: *mut u16) -> bool {
pub unsafe extern "C" fn SCEnipTxGetVendorId(tx: &mut EnipTransaction, value: *mut u16) -> bool {
if let Some(ref response) = tx.response {
if let EnipPayload::ListIdentity(lip) = &response.payload {
if !lip.is_empty() {
Expand Down
4 changes: 2 additions & 2 deletions rust/src/enip/enip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ pub enum EnipFrameType {
}

export_tx_data_get!(rs_enip_get_tx_data, EnipTransaction);
export_state_data_get!(ScEnipTxGetState_data, EnipState);
export_state_data_get!(SCEnipTxGetState_data, EnipState);

// Parser name as a C style string.
const PARSER_NAME: &[u8] = b"enip\0";
Expand Down Expand Up @@ -609,7 +609,7 @@ pub unsafe extern "C" fn SCEnipRegisterParsers() {
get_tx_files: None,
get_tx_iterator: Some(applayer::state_get_tx_iterator::<EnipState, EnipTransaction>),
get_tx_data: rs_enip_get_tx_data,
get_state_data: ScEnipTxGetState_data,
get_state_data: SCEnipTxGetState_data,
apply_tx_config: None,
flags: 0,
truncate: None,
Expand Down
4 changes: 2 additions & 2 deletions src/detect-bytemath.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ static DetectByteMathData *DetectByteMathParse(
DetectEngineCtx *de_ctx, const char *arg, char **nbytes, char **rvalue)
{
DetectByteMathData *bmd;
if ((bmd = ScByteMathParse(arg)) == NULL) {
if ((bmd = SCByteMathParse(arg)) == NULL) {
SCLogError("invalid bytemath values");
return NULL;
}
Expand Down Expand Up @@ -428,7 +428,7 @@ static int DetectByteMathSetup(DetectEngineCtx *de_ctx, Signature *s, const char
*/
static void DetectByteMathFree(DetectEngineCtx *de_ctx, void *ptr)
{
ScByteMathFree(ptr);
SCByteMathFree(ptr);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/detect-enip-capabilities.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ static int DetectEnipCapabilitiesMatch(DetectEngineThreadCtx *det_ctx, Flow *f,

{
uint16_t value;
if (!ScEnipTxGetCapabilities(txv, &value))
if (!SCEnipTxGetCapabilities(txv, &value))
SCReturnInt(0);
const DetectU16Data *du16 = (const DetectU16Data *)ctx;
return DetectU16Match(value, du16);
Expand Down
2 changes: 1 addition & 1 deletion src/detect-enip-command.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ static int DetectEnipCommandMatch(DetectEngineThreadCtx *det_ctx, Flow *f, uint8

{
uint16_t value;
if (!ScEnipTxGetCommand(txv, flags, &value))
if (!SCEnipTxGetCommand(txv, flags, &value))
SCReturnInt(0);
const DetectU16Data *du16 = (const DetectU16Data *)ctx;
return DetectU16Match(value, du16);
Expand Down
2 changes: 1 addition & 1 deletion src/detect-enip-device-type.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ static int DetectEnipDeviceTypeMatch(DetectEngineThreadCtx *det_ctx, Flow *f, ui

{
uint16_t value;
if (!ScEnipTxGetDeviceType(txv, &value))
if (!SCEnipTxGetDeviceType(txv, &value))
SCReturnInt(0);
const DetectU16Data *du16 = (const DetectU16Data *)ctx;
return DetectU16Match(value, du16);
Expand Down
2 changes: 1 addition & 1 deletion src/detect-enip-identity-status.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ static int DetectEnipIdentityStatusMatch(DetectEngineThreadCtx *det_ctx, Flow *f

{
uint16_t value;
if (!ScEnipTxGetIdentityStatus(txv, &value))
if (!SCEnipTxGetIdentityStatus(txv, &value))
SCReturnInt(0);
const DetectU16Data *du16 = (const DetectU16Data *)ctx;
return DetectU16Match(value, du16);
Expand Down
2 changes: 1 addition & 1 deletion src/detect-enip-product-code.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ static int DetectEnipProductCodeMatch(DetectEngineThreadCtx *det_ctx, Flow *f, u

{
uint16_t value;
if (!ScEnipTxGetProductCode(txv, &value))
if (!SCEnipTxGetProductCode(txv, &value))
SCReturnInt(0);
const DetectU16Data *du16 = (const DetectU16Data *)ctx;
return DetectU16Match(value, du16);
Expand Down
2 changes: 1 addition & 1 deletion src/detect-enip-protocol-version.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ static int DetectEnipProtocolVersionMatch(DetectEngineThreadCtx *det_ctx, Flow *

{
uint16_t value;
if (!ScEnipTxGetProtocolVersion(txv, flags, &value))
if (!SCEnipTxGetProtocolVersion(txv, flags, &value))
SCReturnInt(0);
const DetectU16Data *du16 = (const DetectU16Data *)ctx;
return DetectU16Match(value, du16);
Expand Down
2 changes: 1 addition & 1 deletion src/detect-enip-revision.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ static int DetectEnipRevisionMatch(DetectEngineThreadCtx *det_ctx, Flow *f, uint

{
uint16_t value;
if (!ScEnipTxGetRevision(txv, &value))
if (!SCEnipTxGetRevision(txv, &value))
SCReturnInt(0);
const DetectU16Data *du16 = (const DetectU16Data *)ctx;
return DetectU16Match(value, du16);
Expand Down
2 changes: 1 addition & 1 deletion src/detect-enip-serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ static int DetectEnipSerialMatch(DetectEngineThreadCtx *det_ctx, Flow *f, uint8_

{
uint32_t value;
if (!ScEnipTxGetSerial(txv, &value))
if (!SCEnipTxGetSerial(txv, &value))
SCReturnInt(0);
const DetectU32Data *du32 = (const DetectU32Data *)ctx;
return DetectU32Match(value, du32);
Expand Down
2 changes: 1 addition & 1 deletion src/detect-enip-state.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ static int DetectEnipStateMatch(DetectEngineThreadCtx *det_ctx, Flow *f, uint8_t

{
uint8_t value;
if (!ScEnipTxGetState(txv, &value))
if (!SCEnipTxGetState(txv, &value))
SCReturnInt(0);
const DetectU8Data *du8 = (const DetectU8Data *)ctx;
return DetectU8Match(value, du8);
Expand Down
2 changes: 1 addition & 1 deletion src/detect-enip-status.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ static int DetectEnipStatusMatch(DetectEngineThreadCtx *det_ctx, Flow *f, uint8_

{
uint32_t status;
if (!ScEnipTxGetStatus(txv, flags, &status))
if (!SCEnipTxGetStatus(txv, flags, &status))
SCReturnInt(0);
const DetectU32Data *du32 = (const DetectU32Data *)ctx;
return DetectU32Match(status, du32);
Expand Down
2 changes: 1 addition & 1 deletion src/detect-enip-vendor-id.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ static int DetectEnipVendorIdMatch(DetectEngineThreadCtx *det_ctx, Flow *f, uint

{
uint16_t value;
if (!ScEnipTxGetVendorId(txv, &value))
if (!SCEnipTxGetVendorId(txv, &value))
SCReturnInt(0);
const DetectU16Data *du16 = (const DetectU16Data *)ctx;
return DetectU16Match(value, du16);
Expand Down

0 comments on commit f0dbfe8

Please sign in to comment.