📄 dce2_config.h
字号:
static INLINE int DCE2_GcAlertOnEvent(DCE2_EventFlag eflag){ return dce2_gconfig->event_mask & eflag;}/******************************************************************** * Function: DCE2_GcDceDefrag() * * Convenience function for determining if we are configured * to do DCE/RPC defragmentation. * * Arguments: None * * Returns: * DCE2_CS * DCE2_CS__ENABLED if we are configured to do DCE/RPC * defragmentation. * DCE2_CS__DISABLED if we are not configured to do DCE/RPC * defragmentation. * ********************************************************************/static INLINE DCE2_CS DCE2_GcDceDefrag(void){ return dce2_gconfig->dce_defrag;}/******************************************************************** * Function: DCE2_GcReassembleEarly() * * Convenience function for checking if the reassemble threshold * was configured for the preprocessor. * * Arguments: None * * Returns: * int * 1 if it was configured. * 0 if it was not configured. * ********************************************************************/static INLINE int DCE2_GcReassembleEarly(void){ if (dce2_gconfig->reassemble_threshold > 0) return 1; return 0;}/******************************************************************** * Function: DCE2_GcReassembleThreshold() * * Convenience function for getting the reassemble threshold * that is configured for the preprocessor. If not configured, * just return the maximum the return value can hold. One should * check if configured first. * * Arguments: None * * Returns: * uint16_t * The reassemble threshold configured. * UINT16_MAX if not configured. * ********************************************************************/static INLINE uint16_t DCE2_GcReassembleThreshold(void){ if (DCE2_GcReassembleEarly()) return dce2_gconfig->reassemble_threshold; return UINT16_MAX;}/******************************************************************** * Function: DCE2_ScPolicy() * * Convenience function for getting the policy the server * configuration is configured for. * * Arguments: * const DCE2_ServerConfig * * Pointer to the server configuration to check. * * Returns: * DCE2_Policy * The policy the server configuration is configured for. * DCE2_POLICY__NONE if a NULL pointer is passed in. * ********************************************************************/static INLINE DCE2_Policy DCE2_ScPolicy(const DCE2_ServerConfig *sc){ if (sc == NULL) return DCE2_POLICY__NONE; return sc->policy;}/********************************************************************* * Function: DCE2_ScIsDetectPortSet() * * Determines if the server configuration is configured to detect * on the port and transport passed in. * * Arguments: * const DCE2_ServerConfig * * Pointer to the server configuration to check. * const uint16_t * The port to check. * const DCE2_TransType * The transport to check for the port. * * Returns: * int * 1 if configured to detect on this port for the given * transport. * 0 if not configured to detect on this port for the given * transport, or if the server configuration passed in * is NULL. * *********************************************************************/static INLINE int DCE2_ScIsDetectPortSet(const DCE2_ServerConfig *sc, const uint16_t port, const DCE2_TransType ttype){ const uint8_t *port_array; if (sc == NULL) return 0; switch (ttype) { case DCE2_TRANS_TYPE__SMB: port_array = sc->smb_ports; break; case DCE2_TRANS_TYPE__TCP: port_array = sc->tcp_ports; break; case DCE2_TRANS_TYPE__UDP: port_array = sc->udp_ports; break; case DCE2_TRANS_TYPE__HTTP_PROXY: port_array = sc->http_proxy_ports; break; case DCE2_TRANS_TYPE__HTTP_SERVER: port_array = sc->http_server_ports; break; default: return 0; } return DCE2_IsPortSet(port_array, port);}/********************************************************************* * Function: DCE2_ScIsAutodetectPortSet() * * Determines if the server configuration is configured to autodetect * on the port and transport passed in. * * Arguments: * const DCE2_ServerConfig * * Pointer to the server configuration to check. * const uint16_t * The port to check. * const DCE2_TransType * The transport to check for the port. * * Returns: * int * 1 if configured to autodetect on this port for the given * transport. * 0 if not configured to autodetect on this port for the given * transport, or if the server configuration passed in * is NULL. * *********************************************************************/static INLINE int DCE2_ScIsAutodetectPortSet(const DCE2_ServerConfig *sc, const uint16_t port, const DCE2_TransType ttype){ const uint8_t *port_array; if (sc == NULL) return 0; switch (ttype) { case DCE2_TRANS_TYPE__SMB: port_array = sc->auto_smb_ports; break; case DCE2_TRANS_TYPE__TCP: port_array = sc->auto_tcp_ports; break; case DCE2_TRANS_TYPE__UDP: port_array = sc->auto_udp_ports; break; case DCE2_TRANS_TYPE__HTTP_PROXY: port_array = sc->auto_http_proxy_ports; break; case DCE2_TRANS_TYPE__HTTP_SERVER: port_array = sc->auto_http_server_ports; break; default: return 0; } return DCE2_IsPortSet(port_array, port);}/******************************************************************** * Function: DCE2_ScAutodetectHttpProxyPorts() * * Convenience function to determine if the server configuration * is configured to autodetect on all rpc over http proxy detect * ports. * * Arguments: * const DCE2_ServerConfig * * Pointer to the server configuration to check. * * Returns: * DCE2_CS * DCE2_CS__ENABLED if configured to autodetect on all rpc * over http proxy ports. This is also returned it the * server configuration passed in is NULL. * DCE2_CS__DISABLED if not configured to autodetect on all * rpc over http proxy ports. * ********************************************************************/static INLINE DCE2_CS DCE2_ScAutodetectHttpProxyPorts(const DCE2_ServerConfig *sc){ if (sc == NULL) return DCE2_CS__ENABLED; return sc->autodetect_http_proxy_ports;}/******************************************************************** * Function: DCE2_ScSmbMaxChain() * * Convenience function to get the SMB maximum amount of command * chaining allowed. * * Arguments: * const DCE2_ServerConfig * * Pointer to the server configuration to check. * * Returns: * uint8_t * The value for the maximum amount of command chaining. * 0 is returned if the server configuration passed in is NULL. * ********************************************************************/static INLINE uint8_t DCE2_ScSmbMaxChain(const DCE2_ServerConfig *sc){ if (sc == NULL) return 0; return sc->smb_max_chain;}/******************************************************************** * Function: DCE2_ScSmbInvalidShares() * * Returns the list of SMB invalid shares configured. If no * shares were configured, this will return a NULL list. * * Arguments: * const DCE2_ServerConfig * * Pointer to the server configuration to check. * * Returns: * DCE2_List * * Pointer to the list containing the SMB invalid share * strings. * NULL if no shares were configured or the server * configuration passed in is NULL. * ********************************************************************/static INLINE DCE2_List * DCE2_ScSmbInvalidShares(const DCE2_ServerConfig *sc){ if (sc == NULL) return NULL; return sc->smb_invalid_shares;}/********************************************************************* * Function: DCE2_IsPortSet() * * Checks to see if a port is set in one in the port array mask * passed in. * * Arguments: * uint8_t * * Pointer to a port array mask. * const uint16_t * The port to check for in the mask. * * Returns: * int * Non-zero if the port is set. * Zero if the port is not set. * *********************************************************************/static INLINE int DCE2_IsPortSet(const uint8_t *port_array, const uint16_t port){ return port_array[(port / 8)] & (1 << (port % 8));}/********************************************************************* * Function: DCE2_SetPort() * * Sets a port in the port array mask passed in. * * Arguments: * uint8_t * * Pointer to a port array mask. * const uint16_t * The port to set in the port array mask. * * Returns: None * *********************************************************************/static INLINE void DCE2_SetPort(uint8_t *port_array, const uint16_t port){ port_array[(port / 8)] |= (1 << (port % 8));}/********************************************************************* * Function: DCE2_SetPortRange() * * Sets ports from lo to hi in one of the transport port * configurations. * * Arguments: * uint8_t * * Pointer to a port array mask. * uint16_t * The lo port to start setting ports in the port array mask. * uint16_t * The hi port to end setting ports in the port array mask. * * Returns: None * *********************************************************************/static INLINE void DCE2_SetPortRange(uint8_t *port_array, uint16_t lo_port, uint16_t hi_port){ uint16_t i; if (lo_port > hi_port) { uint16_t tmp = lo_port; lo_port = hi_port; hi_port = tmp; } for (i = lo_port; i <= hi_port; i++) DCE2_SetPort(port_array, i);}/******************************************************************** * Function: DCE2_ClearPorts() * * Clears all of the port bits set in the port array mask. * * Arguments: * uint8_t * * Pointer to a port array mask. * * Returns: None * ********************************************************************/static INLINE void DCE2_ClearPorts(uint8_t *port_array){ memset(port_array, 0, DCE2_PORTS__MAX_INDEX);}/******************************************************************** * Function: DCE2_IsWordChar() * * Determines if a character is a valid word character based on * position in the word. Of course, this is the preprocessor's * definition. Mainly used for restricting preprocessor option * names and set argument names. *
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -