⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dce2_config.h

📁 snort2.8.4版本
💻 H
📖 第 1 页 / 共 3 页
字号:
 * Arguments: *  const char *      The character to make the determination on. *  DCE2_WordCharPosition *      The position in the word the character is. * * Returns: *  int *      1 if a valid word character. *      0 if not a valid word character. * ********************************************************************/static INLINE int DCE2_IsWordChar(const char c, const DCE2_WordCharPosition pos){    if (pos == DCE2_WORD_CHAR_POSITION__START)    {        if (isalpha((int)c))            return 1;    }    else if (pos == DCE2_WORD_CHAR_POSITION__MIDDLE)    {        if (isalpha((int)c) ||            isdigit((int)c) ||            (c == DCE2_CFG_TOK__DASH) ||            (c == DCE2_CFG_TOK__UNDERSCORE) ||            (c == DCE2_CFG_TOK__DOT))        {            return 1;        }    }    else if (pos == DCE2_WORD_CHAR_POSITION__END)    {        if (isalpha((int)c) || isdigit((int)c))            return 1;    }    return 0;}/******************************************************************** * Function: DCE2_IsListSepChar() * * Determines if the character passed in is a character that * separates values in lists. * * Arguments: *  const char *      The character to make the determination on. * * Returns: *  int *      1 if a valid list separator character. *      0 if not a valid list separator character. * ********************************************************************/static INLINE int DCE2_IsListSepChar(const char c){    if (c == DCE2_CFG_TOK__LIST_SEP) return 1;    return 0;}/******************************************************************** * Function: DCE2_IsOptEndChar() * * Determines if the character passed in is a character that * marks the end of an option and start of a new option. * * Arguments: *  const char *      The character to make the determination on. * * Returns: *  int *      1 if a valid option end character. *      0 if not a valid option end character. * ********************************************************************/static INLINE int DCE2_IsOptEndChar(const char c){    if (c == DCE2_CFG_TOK__OPT_SEP) return 1;    return 0;}/******************************************************************** * Function: DCE2_IsSpaceChar() * * Determines if the character passed in is a character that * the preprocessor considers a to be a space character. * * Arguments: *  const char *      The character to make the determination on. * * Returns: *  int *      1 if a valid space character. *      0 if not a valid space character. * ********************************************************************/static INLINE int DCE2_IsSpaceChar(const char c){    if (isspace((int)c)) return 1;    return 0;}/******************************************************************** * Function: DCE2_IsConfigEndChar() * * Determines if the character passed in is a character that * the preprocessor considers a to be an end of configuration * character. * * Arguments: *  const char *      The character to make the determination on. * * Returns: *  int *      1 if a valid end of configuration character. *      0 if not a valid end of configuration character. * ********************************************************************/static INLINE int DCE2_IsConfigEndChar(const char c){    if (c == DCE2_CFG_TOK__END) return 1;    return 0;}/******************************************************************** * Function: DCE2_IsPortChar() * * Determines if the character passed in is a character that * the preprocessor considers a to be a valid character for a port. * * Arguments: *  const char *      The character to make the determination on. * * Returns: *  int *      1 if a valid port character. *      0 if not a valid port character. * ********************************************************************/static INLINE int DCE2_IsPortChar(const char c){    if (isdigit((int)c)) return 1;    return 0;}/******************************************************************** * Function: DCE2_IsPortRangeChar() * * Determines if the character passed in is a character that can be * placed before, between or after a port to specify a port range. * * Arguments: *  const char *      The character to make the determination on. * * Returns: *  int *      1 if a valid port range character. *      0 if not a valid port range character. * ********************************************************************/static INLINE int DCE2_IsPortRangeChar(const char c){    if (c == DCE2_CFG_TOK__PORT_RANGE) return 1;    return 0;}/******************************************************************** * Function: DCE2_IsOpnumChar() * * Determines if the character passed in is a character that * the preprocessor considers a to be a valid character for a * DCE/RPC opnum. * * Arguments: *  const char *      The character to make the determination on. * * Returns: *  int *      1 if a valid DCE/RPC opnum character. *      0 if not a valid DCE/RPC opnum character. * ********************************************************************/static INLINE int DCE2_IsOpnumChar(const char c){    if (isdigit((int)c)) return 1;    return 0;}/******************************************************************** * Function: DCE2_IsOpnumRangeChar() * * Determines if the character passed in is a character that is * used to indicate a range of DCE/RPC opnums. * * Arguments: *  const char *      The character to make the determination on. * * Returns: *  int *      1 if a valid DCE/RPC opnum range character. *      0 if not a valid DCE/RPC opnum range character. * ********************************************************************/static INLINE int DCE2_IsOpnumRangeChar(const char c){    if (c == DCE2_CFG_TOK__OPNUM_RANGE) return 1;    return 0;}/******************************************************************** * Function: DCE2_IsListStartChar() * * Determines if the character passed in is a character that is * used to indicate the start of a list. * * Arguments: *  const char *      The character to make the determination on. * * Returns: *  int *      1 if a valid start of list character. *      0 if not a valid start of list character. * ********************************************************************/static INLINE int DCE2_IsListStartChar(const char c){    if (c == DCE2_CFG_TOK__LIST_START) return 1;    return 0;}/******************************************************************** * Function: DCE2_IsListEndChar() * * Determines if the character passed in is a character that is * used to indicate the end of a list. * * Arguments: *  const char *      The character to make the determination on. * * Returns: *  int *      1 if a valid end of list character. *      0 if not a valid end of list character. * ********************************************************************/static INLINE int DCE2_IsListEndChar(const char c){    if (c == DCE2_CFG_TOK__LIST_END) return 1;    return 0;}/******************************************************************** * Function: DCE2_IsQuoteChar() * * Determines if the character passed in is a what the preprocessor * considers to be a quote character. * * Arguments: *  const char *      The character to make the determination on. * * Returns: *  int *      1 if a valid quote character. *      0 if not a valid quote character. * ********************************************************************/static INLINE int DCE2_IsQuoteChar(const char c){    if (c == DCE2_CFG_TOK__QUOTE) return 1;    return 0;}/******************************************************************** * Function: DCE2_IsIpChar() * * Determines if the character passed in is a character that can * be used in an IP address - IPv4 or IPv6. * * Arguments: *  const char *      The character to make the determination on. * * Returns: *  int *      1 if a valid IP character. *      0 if not a valid IP character. * ********************************************************************/static INLINE int DCE2_IsIpChar(const char c){    if (isxdigit((int)c) ||        (c == DCE2_CFG_TOK__IP6_TET_SEP) ||        (c == DCE2_CFG_TOK__IP4_TET_SEP) ||        (c == DCE2_CFG_TOK__IP_PREFIX_SEP))    {        return 1;    }    return 0;}/******************************************************************** * Function: DCE2_IsGraphChar() * * Determines is the character passed in is a graphical character. * Characters excluded are what the preprocessor considers as * meta characters or space characters. * * Arguments: *  const char *      The character to make the determination on. * * Returns: *  int *      1 if a valid graphical character. *      0 if not a valid graphical character. * ********************************************************************/static INLINE int DCE2_IsGraphChar(const char c){    if (!DCE2_IsListStartChar(c) && !DCE2_IsListEndChar(c) &&        !DCE2_IsQuoteChar(c) && !DCE2_IsListSepChar(c) &&        !DCE2_IsSpaceChar(c))        return 1;    return 0;}/********************************************************************* * Function: DCE2_CheckAndSetMask() * * Checks to see if a flag passed in is already set in the mask * passed in.  If it is, error is returned.  If it is not, the  * flag is set in the mask. * * Arguments: *  int *      The flag to check and set. *  int * *      The mask to check and set the flag against. * * Returns: *  DCE2_Ret *      DCE2_RET__ERROR if the flag is already set in the mask. *      DCE2_RET__SUCCESS if the flag is not already set in the mask. * *********************************************************************/static INLINE DCE2_Ret DCE2_CheckAndSetMask(int flag, int *mask){    if (*mask & flag)        return DCE2_RET__ERROR;    *mask |= flag;    return DCE2_RET__SUCCESS;}#endif  /* _DCE2_CONFIG_H_ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -