From: hyunuktak Date: Thu, 30 Aug 2018 08:03:34 +0000 (+0900) Subject: Separate source code from internal header X-Git-Tag: accepted/tizen/unified/20180913.063958^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5fc9d31a3871a4b92783fa9f91cd2e36854ad18d;p=platform%2Fcore%2Fapi%2Fsmart-traffic-control.git Separate source code from internal header Change-Id: I272a3caf9b3c6f0677d27bde835ffd543bf3ad22 Signed-off-by: hyunuktak --- diff --git a/include/stc_fw_internal.h b/include/stc_fw_internal.h index a410ee9..a315a03 100755 --- a/include/stc_fw_internal.h +++ b/include/stc_fw_internal.h @@ -24,26 +24,1680 @@ extern "C" { #endif +/** + * @file stc_fw_internal.h + */ + /***************************************************************************** * Standard headers *****************************************************************************/ +#include +#include +#include /***************************************************************************** * Macros and Typedefs *****************************************************************************/ +/** + * @addtogroup CAPI_NETWORK_STC_FIREWALL_MODULE + * @{ + */ + +/** + * @brief The firewall chain handle. + * @since_tizen 5.0 + */ +typedef void *stc_firewall_chain_h; + +/** + * @brief The firewall rule handle. + * @since_tizen 5.0 + */ +typedef void *stc_firewall_rule_h; + +/** +* @} +*/ + /***************************************************************************** * Enumeration *****************************************************************************/ +/** + * @addtogroup CAPI_NETWORK_STC_FIREWALL_MODULE + * @{ + */ + +typedef enum { + STC_FIREWALL_UNKNOWN, + STC_FIREWALL_UNLOCKED, + STC_FIREWALL_LOCKED +} stc_firewall_lock_e; + +/** + * @brief Enumeration for firewall direction. + * @since_tizen 5.0 + */ +typedef enum { + STC_FIREWALL_DIRECTION_NONE, + STC_FIREWALL_DIRECTION_IN, + STC_FIREWALL_DIRECTION_OUT +} stc_firewall_direction_e; + +/** + * @brief Enumeration for firewall IP type. + * @since_tizen 5.0 + */ +typedef enum { + STC_FIREWALL_IP_NONE, + STC_FIREWALL_IP_SINGLE, + STC_FIREWALL_IP_MASK, + STC_FIREWALL_IP_RANGE +} stc_firewall_ip_type_e; + +/** + * @brief Enumeration for firewall port type. + * @since_tizen 5.0 + */ +typedef enum { + STC_FIREWALL_PORT_NONE, + STC_FIREWALL_PORT_SINGLE, + STC_FIREWALL_PORT_RANGE +} stc_firewall_port_type_e; + +/** + * @brief Enumeration for firewall protocol type. + * @since_tizen 5.0 + */ +typedef enum { + STC_FIREWALL_PROTOCOL_NONE, + STC_FIREWALL_PROTOCOL_TCP, + STC_FIREWALL_PROTOCOL_UDP, + STC_FIREWALL_PROTOCOL_ICMP, + STC_FIREWALL_PROTOCOL_ALL, +} stc_firewall_protocol_type_e; + +/** + * @brief Enumeration for firewall family type. + * @since_tizen 5.0 + */ +typedef enum { + STC_FIREWALL_FAMILY_NONE, + STC_FIREWALL_FAMILY_V4, + STC_FIREWALL_FAMILY_V6 +} stc_firewall_family_type_e; + +/** + * @brief Enumeration for firewall chain target. + * @since_tizen 5.0 + */ +typedef enum { + STC_FIREWALL_CHAIN_TARGET_NONE, + STC_FIREWALL_CHAIN_TARGET_INPUT, + STC_FIREWALL_CHAIN_TARGET_OUTPUT, + STC_FIREWALL_CHAIN_TARGET_MAX +} stc_firewall_chain_target_e; + +/** + * @brief Enumeration for firewall rule target. + * @since_tizen 5.0 + */ +typedef enum { + STC_FIREWALL_RULE_TARGET_NONE, + STC_FIREWALL_RULE_TARGET_ACCEPT, + STC_FIREWALL_RULE_TARGET_DROP, + STC_FIREWALL_RULE_TARGET_LOG, + STC_FIREWALL_RULE_TARGET_NFLOG, + STC_FIREWALL_RULE_TARGET_MAX, +} stc_firewall_rule_target_e; + +/** +* @} +*/ + + /***************************************************************************** * Callback functions *****************************************************************************/ +/** + * @addtogroup CAPI_NETWORK_STC_FIREWALL_MODULE + * @{ + */ + +/** + * @brief Called for enumerate firewall chain information. + * @since_tizen 5.0 + * + * @param[in] info The firewall chain handle + * @param[in] user_data The user data passed from the callback firewall chain function + * @return @c STC_CALLBACK_CONTINUE to continue with the next iteration of the loop, + * otherwise @c STC_CALLBACK_CANCEL to break out of the loop + * + * @pre stc_firewall_chain_foreach() will invoke this callback. + * @see stc_firewall_chain_get_name() + * @see stc_firewall_chain_get_target() + * @see stc_firewall_chain_get_priority() + * @see stc_firewall_chain_foreach() + */ +typedef stc_callback_ret_e (*stc_firewall_chain_info_cb)(stc_firewall_chain_h info_h, + void *user_data); + +/** + * @brief Called for enumerate firewall rule information. + * @since_tizen 5.0 + * + * @param[in] info The firewall rule handle + * @param[in] user_data The user data passed from the callback firewall rule function + * @return @c STC_CALLBACK_CONTINUE to continue with the next iteration of the loop, + * otherwise @c STC_CALLBACK_CANCEL to break out of the loop + * + * @pre stc_firewall_rule_foreach() will invoke this callback. + * @see stc_firewall_rule_get_chain() + * @see stc_firewall_rule_get_direction() + * @see stc_firewall_rule_get_src_ip_type() + * @see stc_firewall_rule_get_dst_ip_type() + * @see stc_firewall_rule_get_src_port_type() + * @see stc_firewall_rule_get_dst_port_type() + * @see stc_firewall_rule_get_protocol_type() + * @see stc_firewall_rule_get_family_type() + * @see stc_firewall_rule_get_src_ip() + * @see stc_firewall_rule_get_dst_ip() + * @see stc_firewall_rule_get_src_port() + * @see stc_firewall_rule_get_dst_port() + * @see stc_firewall_rule_get_ifname() + * @see stc_firewall_rule_get_target() + * @see stc_firewall_rule_foreach() + */ +typedef stc_callback_ret_e (*stc_firewall_rule_info_cb)(stc_firewall_rule_h info, + void *user_data); + +/** +* @} +*/ + /***************************************************************************** * Core API functions *****************************************************************************/ +/** + * @addtogroup CAPI_NETWORK_STC_FIREWALL_MODULE + * @{ + */ + +/** + * @brief Locks the firewall. + * @since_tizen 5.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/firewall.admin + * + * @param[in] stc The stc handle + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_h + * @see stc_initialize() + * @see stc_firewall_unlock() + * @see stc_firewall_get_lock() + */ +int stc_firewall_lock(stc_h stc); + +/** + * @brief Unlocks the firewall. + * @since_tizen 5.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/firewall.admin + * + * @param[in] stc The stc handle + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_h + * @see stc_initialize() + * @see stc_firewall_lock() + * @see stc_firewall_get_lock() + */ +int stc_firewall_unlock(stc_h stc); + +/** + * @brief Gets the firewall lock state. + * @since_tizen 5.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/firewall.admin + * + * @param[in] stc The stc handle + * @param[out] state The firewall lock state + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_h + * @see stc_initialize() + * @see stc_firewall_lock() + * @see stc_firewall_unlock() + */ +int stc_firewall_get_lock(stc_h stc, stc_firewall_lock_e *state); + +/** + * @brief Creates the firewall chain handle. + * @since_tizen 5.0 + * @remarks You must release @a handle using stc_firewall_chain_destroy(). + * + * @param[in] stc The stc handle + * @param[in] name The chain name + * @param[out] chain The firewall chain handle + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_h + * @see #stc_firewall_chain_h + * @see stc_initialize() + * @see stc_firewall_chain_destroy() + */ +int stc_firewall_chain_create(stc_h stc, const char *name, + stc_firewall_chain_h *chain_h); + +/** + * @brief Clones the firewall chain handle. + * @since_tizen 5.0 + * @remarks You must release @a handle using stc_firewall_chain_destroy(). + * + * @param[in] origin The origin firewall chain handle + * @param[out] cloned_chain The cloned firewall chain handle + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_h + * @see #stc_firewall_chain_h + * @see stc_initialize() + * @see stc_firewall_chain_create() + * @see stc_firewall_chain_destroy() + */ +int stc_firewall_chain_clone(stc_firewall_chain_h origin_h, + stc_firewall_chain_h *cloned_chain_h); + +/** + * @brief Destroys the firewall chain handle. + * @since_tizen 5.0 + * + * @param[in] chain The firewall chain handle + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_chain_h + * @see stc_firewall_chain_create() + */ +int stc_firewall_chain_destroy(stc_firewall_chain_h chain_h); + +/** + * @brief Gets the name for chain. + * @since_tizen 5.0 + * + * @param[in] chain The firewall chain handle + * @param[out] name The chain name + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_chain_h + * @see stc_firewall_chain_create() + * @see stc_firewall_chain_destroy() + */ +int stc_firewall_chain_get_name(stc_firewall_chain_h chain, char **name); + +/** + * @brief Gets the target type for chain. + * @since_tizen 5.0 + * + * @param[in] chain The firewall chain handle + * @param[out] target The target type + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_chain_h + * @see stc_firewall_chain_create() + * @see stc_firewall_chain_destroy() + */ +int stc_firewall_chain_get_target(stc_firewall_chain_h chain_h, + stc_firewall_chain_target_e *target); + +/** + * @brief Gets the priority for chain. + * @since_tizen 5.0 + * + * @param[in] chain The firewall chain handle + * @param[out] priority The priority + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_chain_h + * @see stc_firewall_chain_create() + * @see stc_firewall_chain_destroy() + */ +int stc_firewall_chain_get_priority(stc_firewall_chain_h chain_h, + unsigned int *priority); + +/** + * @brief Adds the chain. + * @since_tizen 5.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/firewall.common + * + * @param[in] chain The firewall chain handle + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_chain_h + * @see stc_firewall_chain_create() + * @see stc_firewall_chain_destroy() + */ +int stc_firewall_chain_add(stc_firewall_chain_h chain_h); + +/** + * @brief Removes the chain. + * @since_tizen 5.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/firewall.common + * + * @param[in] chain The firewall chain handle + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_chain_h + * @see stc_firewall_chain_create() + * @see stc_firewall_chain_destroy() + */ +int stc_firewall_chain_remove(stc_firewall_chain_h chain_h); + +/** + * @brief Flushs the chain. + * @since_tizen 5.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/firewall.common + * + * @param[in] chain The firewall chain handle + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_chain_h + * @see stc_firewall_chain_create() + * @see stc_firewall_chain_destroy() + */ +int stc_firewall_chain_flush(stc_firewall_chain_h chain_h); + +/** + * @brief Gets all chains. + * @since_tizen 5.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/firewall.common + * + * @param[in] stc The stc handle + * @param[in] callback The callback to be called + * @param[in] user_data The user data passed to the callback function + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_chain_h + * @see stc_firewall_chain_create() + * @see stc_firewall_chain_destroy() + */ +int stc_firewall_chain_foreach(stc_h stc, + stc_firewall_chain_info_cb callback, void *user_data); + +/** + * @brief Sets the chain to target. + * @since_tizen 5.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/firewall.common + * @remarks You should set only one chain. + * + * @param[in] chain The firewall chain handle + * @param[in] target The target type + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_chain_h + * @see stc_firewall_chain_create() + * @see stc_firewall_chain_destroy() + */ +int stc_firewall_chain_set(stc_firewall_chain_h chain_h, + stc_firewall_chain_target_e target); + +/** + * @brief Unsets the chain. + * @since_tizen 5.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/firewall.common + * + * @param[in] chain The firewall chain handle + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_chain_h + * @see stc_firewall_chain_create() + * @see stc_firewall_chain_destroy() + */ +int stc_firewall_chain_unset(stc_firewall_chain_h chain_h); + +/** + * @brief Creates the firewall rule handle. + * @since_tizen 5.0 + * @remarks You must release @a handle using stc_firewall_rule_destroy(). + * + * @param[in] stc The stc handle + * @param[out] rule The firewall rule handle + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_h + * @see #stc_firewall_rule_h + * @see stc_initialize() + * @see stc_firewall_rule_destroy() + */ +int stc_firewall_rule_create(stc_h stc, stc_firewall_rule_h *rule_h); + +/** + * @brief Clones the firewall rule handle. + * @since_tizen 5.0 + * @remarks You must release @a handle using stc_firewall_rule_destroy(). + * + * @param[in] origin The origin firewall rule handle + * @param[out] cloned_rule The cloned firewall rule handle + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_h + * @see #stc_firewall_rule_h + * @see stc_initialize() + * @see stc_firewall_rule_create() + * @see stc_firewall_rule_destroy() + */ +int stc_firewall_rule_clone(stc_firewall_rule_h origin_h, + stc_firewall_rule_h *cloned_rule_h); + +/** + * @brief Destroys the firewall rule handle. + * @since_tizen 5.0 + * + * @param[in] rule The firewall chain handle + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_rule_h + * @see stc_firewall_rule_create() + */ +int stc_firewall_rule_destroy(stc_firewall_rule_h rule_h); + +/** + * @brief Sets the chain name to rule. + * @since_tizen 5.0 + * + * @param[in] rule The firewall rule handle + * @param[in] chain The chain name + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_rule_h + * @see stc_firewall_rule_create() + * @see stc_firewall_rule_destroy() + * @see stc_firewall_rule_get_chain() + */ +int stc_firewall_rule_set_chain(stc_firewall_rule_h rule_h, char *chain); + +/** + * @brief Sets the direction to rule. + * @since_tizen 5.0 + * + * @param[in] rule The firewall rule handle + * @param[in] direction The direction + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_rule_h + * @see stc_firewall_rule_create() + * @see stc_firewall_rule_destroy() + * @see stc_firewall_rule_get_direction() + */ +int stc_firewall_rule_set_direction(stc_firewall_rule_h rule_h, + stc_firewall_direction_e direction); + +/** + * @brief Sets the source IP type to rule. + * @since_tizen 5.0 + * + * @param[in] rule The firewall rule handle + * @param[in] type The IP type + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_rule_h + * @see stc_firewall_rule_create() + * @see stc_firewall_rule_destroy() + * @see stc_firewall_rule_get_src_ip_type() + */ +int stc_firewall_rule_set_src_ip_type(stc_firewall_rule_h rule_h, + stc_firewall_ip_type_e type); + +/** + * @brief Sets the destination IP type to rule. + * @since_tizen 5.0 + * + * @param[in] rule The firewall rule handle + * @param[in] type The IP type + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_rule_h + * @see stc_firewall_rule_create() + * @see stc_firewall_rule_destroy() + * @see stc_firewall_rule_get_dst_ip_type() + */ +int stc_firewall_rule_set_dst_ip_type(stc_firewall_rule_h rule_h, + stc_firewall_ip_type_e type); + +/** + * @brief Sets the source port type to rule. + * @since_tizen 5.0 + * + * @param[in] rule The firewall rule handle + * @param[in] type The port type + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_rule_h + * @see stc_firewall_rule_create() + * @see stc_firewall_rule_destroy() + * @see stc_firewall_rule_get_src_port_type() + */ +int stc_firewall_rule_set_src_port_type(stc_firewall_rule_h rule_h, + stc_firewall_port_type_e type); + +/** + * @brief Sets the destination port type to rule. + * @since_tizen 5.0 + * + * @param[in] rule The firewall rule handle + * @param[in] type The port type + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_rule_h + * @see stc_firewall_rule_create() + * @see stc_firewall_rule_destroy() + * @see stc_firewall_rule_get_dst_port_type() + */ +int stc_firewall_rule_set_dst_port_type(stc_firewall_rule_h rule_h, + stc_firewall_port_type_e type); + +/** + * @brief Sets the protocol type to rule. + * @since_tizen 5.0 + * + * @param[in] rule The firewall rule handle + * @param[in] type The protocol type + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_rule_h + * @see stc_firewall_rule_create() + * @see stc_firewall_rule_destroy() + * @see stc_firewall_rule_get_protocol_type() + */ +int stc_firewall_rule_set_protocol_type(stc_firewall_rule_h rule_h, + stc_firewall_protocol_type_e type); + +/** + * @brief Sets the address family type to rule. + * @since_tizen 5.0 + * + * @param[in] rule The firewall rule handle + * @param[in] type The address family type + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_rule_h + * @see stc_firewall_rule_create() + * @see stc_firewall_rule_destroy() + * @see stc_firewall_rule_get_family_type() + */ +int stc_firewall_rule_set_family_type(stc_firewall_rule_h rule_h, + stc_firewall_family_type_e type); + +/** + * @brief Sets source IP addresses to rule. + * @since_tizen 5.0 + * + * @param[in] rule The firewall rule handle + * @param[in] ip1 The address 1 + * @param[in] ip2 The address 2 which will be IP address or mask + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_rule_h + * @see stc_firewall_rule_create() + * @see stc_firewall_rule_destroy() + * @see stc_firewall_rule_set_src_ip_type() + * @see stc_firewall_rule_get_src_ip() + */ +int stc_firewall_rule_set_src_ip(stc_firewall_rule_h rule_h, + char *ip1, char *ip2); + +/** + * @brief Sets destination IP addresses to rule. + * @since_tizen 5.0 + * + * @param[in] rule The firewall rule handle + * @param[in] ip1 The address 1 + * @param[in] ip2 The address 2 which will be IP address or mask + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_rule_h + * @see stc_firewall_rule_create() + * @see stc_firewall_rule_destroy() + * @see stc_firewall_rule_set_dst_ip_type() + * @see stc_firewall_rule_get_dst_ip() + */ +int stc_firewall_rule_set_dst_ip(stc_firewall_rule_h rule_h, + char *ip1, char *ip2); + +/** + * @brief Sets source ports to rule. + * @since_tizen 5.0 + * + * @param[in] rule The firewall rule handle + * @param[in] port1 The port 1 + * @param[in] port2 The port 2 + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_rule_h + * @see stc_firewall_rule_create() + * @see stc_firewall_rule_destroy() + * @see stc_firewall_rule_set_src_port_type() + * @see stc_firewall_rule_get_src_port() + */ +int stc_firewall_rule_set_src_port(stc_firewall_rule_h rule_h, + unsigned int port1, unsigned int port2); + +/** + * @brief Sets destination ports to rule. + * @since_tizen 5.0 + * + * @param[in] rule The firewall rule handle + * @param[in] port1 The port 1 + * @param[in] port2 The port 2 + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_rule_h + * @see stc_firewall_rule_create() + * @see stc_firewall_rule_destroy() + * @see stc_firewall_rule_set_dst_port_type() + * @see stc_firewall_rule_get_dst_port() + */ +int stc_firewall_rule_set_dst_port(stc_firewall_rule_h rule_h, + unsigned int port1, unsigned int port2); + +/** + * @brief Sets interface name to rule. + * @since_tizen 5.0 + * + * @param[in] rule The firewall rule handle + * @param[in] ifname The interface name + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_rule_h + * @see stc_firewall_rule_create() + * @see stc_firewall_rule_destroy() + * @see stc_firewall_rule_get_ifname() + */ +int stc_firewall_rule_set_ifname(stc_firewall_rule_h rule_h, char *ifname); + +/** + * @brief Sets target type to rule. + * @since_tizen 5.0 + * + * @param[in] rule The firewall rule handle + * @param[in] target The target type + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_rule_h + * @see stc_firewall_rule_create() + * @see stc_firewall_rule_destroy() + * @see stc_firewall_rule_get_target() + */ +int stc_firewall_rule_set_target(stc_firewall_rule_h rule_h, + stc_firewall_rule_target_e target); + +/** + * @brief Sets log level to rule. + * @since_tizen 5.0 + * + * @param[in] rule The firewall rule handle + * @param[in] level The level + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_rule_h + * @see stc_firewall_rule_create() + * @see stc_firewall_rule_destroy() + * @see stc_firewall_rule_get_log_level() + */ +int stc_firewall_rule_set_log_level(stc_firewall_rule_h rule_h, + unsigned char level); + +/** + * @brief Sets log prefix to rule. + * @since_tizen 5.0 + * + * @param[in] rule The firewall rule handle + * @param[in] prefix The prefix + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_rule_h + * @see stc_firewall_rule_create() + * @see stc_firewall_rule_destroy() + * @see stc_firewall_rule_get_log_prefix() + */ +int stc_firewall_rule_set_log_prefix(stc_firewall_rule_h rule_h, + char *prefix); + +/** + * @brief Sets nflog group to rule. + * @since_tizen 5.0 + * + * @param[in] rule The firewall rule handle + * @param[in] group The group + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_rule_h + * @see stc_firewall_rule_create() + * @see stc_firewall_rule_destroy() + * @see stc_firewall_rule_get_nflog_group() + */ +int stc_firewall_rule_set_nflog_group(stc_firewall_rule_h rule_h, + unsigned int group); + +/** + * @brief Sets nflog prefix to rule. + * @since_tizen 5.0 + * + * @param[in] rule The firewall rule handle + * @param[in] prefix The prefix + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_rule_h + * @see stc_firewall_rule_create() + * @see stc_firewall_rule_destroy() + * @see stc_firewall_rule_get_nflog_prefix() + */ +int stc_firewall_rule_set_nflog_prefix(stc_firewall_rule_h rule_h, + char *prefix); + +/** + * @brief Sets nflog range to rule. + * @since_tizen 5.0 + * + * @param[in] rule The firewall rule handle + * @param[in] range The range + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_rule_h + * @see stc_firewall_rule_create() + * @see stc_firewall_rule_destroy() + * @see stc_firewall_rule_get_nflog_range() + */ +int stc_firewall_rule_set_nflog_range(stc_firewall_rule_h rule_h, + unsigned int range); + +/** + * @brief Sets nflog threshold to rule. + * @since_tizen 5.0 + * + * @param[in] rule The firewall rule handle + * @param[in] threshold The threshold + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_rule_h + * @see stc_firewall_rule_create() + * @see stc_firewall_rule_destroy() + * @see stc_firewall_rule_get_nflog_threshold() + */ +int stc_firewall_rule_set_nflog_threshold(stc_firewall_rule_h rule_h, + unsigned int threshold); + +/** + * @brief Gets the chain name from rule. + * @since_tizen 5.0 + * + * @param[in] rule The firewall rule handle + * @param[out] chain The chain name + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_rule_h + * @see stc_firewall_rule_create() + * @see stc_firewall_rule_destroy() + * @see stc_firewall_rule_set_chain() + */ +int stc_firewall_rule_get_chain(stc_firewall_rule_h rule_h, char **chain); + +/** + * @brief Gets the direction from rule. + * @since_tizen 5.0 + * + * @param[in] rule The firewall rule handle + * @param[out] direction The direction + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_rule_h + * @see stc_firewall_rule_create() + * @see stc_firewall_rule_destroy() + * @see stc_firewall_rule_set_direction() + */ +int stc_firewall_rule_get_direction(stc_firewall_rule_h rule_h, + stc_firewall_direction_e *direction); + +/** + * @brief Gets the source IP type from rule. + * @since_tizen 5.0 + * + * @param[in] rule The firewall rule handle + * @param[out] type The IP type + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_rule_h + * @see stc_firewall_rule_create() + * @see stc_firewall_rule_destroy() + * @see stc_firewall_rule_set_src_ip_type() + */ +int stc_firewall_rule_get_src_ip_type(stc_firewall_rule_h rule_h, + stc_firewall_ip_type_e *type); + +/** + * @brief Gets the destination IP type from rule. + * @since_tizen 5.0 + * + * @param[in] rule The firewall rule handle + * @param[out] type The IP type + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_rule_h + * @see stc_firewall_rule_create() + * @see stc_firewall_rule_destroy() + * @see stc_firewall_rule_set_dst_ip_type() + */ +int stc_firewall_rule_get_dst_ip_type(stc_firewall_rule_h rule_h, + stc_firewall_ip_type_e *type); + +/** + * @brief Gets the source port type from rule. + * @since_tizen 5.0 + * + * @param[in] rule The firewall rule handle + * @param[out] type The port type + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_rule_h + * @see stc_firewall_rule_create() + * @see stc_firewall_rule_destroy() + * @see stc_firewall_rule_set_src_port_type() + */ +int stc_firewall_rule_get_src_port_type(stc_firewall_rule_h rule_h, + stc_firewall_port_type_e *type); + +/** + * @brief Gets the destination port type from rule. + * @since_tizen 5.0 + * + * @param[in] rule The firewall rule handle + * @param[out] type The port type + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_rule_h + * @see stc_firewall_rule_create() + * @see stc_firewall_rule_destroy() + * @see stc_firewall_rule_set_dst_port_type() + */ +int stc_firewall_rule_get_dst_port_type(stc_firewall_rule_h rule_h, + stc_firewall_port_type_e *type); + +/** + * @brief Gets the protocol type from rule. + * @since_tizen 5.0 + * + * @param[in] rule The firewall rule handle + * @param[out] type The protocol type + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_rule_h + * @see stc_firewall_rule_create() + * @see stc_firewall_rule_destroy() + * @see stc_firewall_rule_set_protocol_type() + */ +int stc_firewall_rule_get_protocol_type(stc_firewall_rule_h rule_h, + stc_firewall_protocol_type_e *type); + +/** + * @brief Gets the address family type from rule. + * @since_tizen 5.0 + * + * @param[in] rule The firewall rule handle + * @param[out] type The address family type + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_rule_h + * @see stc_firewall_rule_create() + * @see stc_firewall_rule_destroy() + * @see stc_firewall_rule_set_family_type() + */ +int stc_firewall_rule_get_family_type(stc_firewall_rule_h rule_h, + stc_firewall_family_type_e *type); + +/** + * @brief Gets the source IP addresses from rule. + * @since_tizen 5.0 + * + * @param[in] rule The firewall rule handle + * @param[out] ip1 The address 1 + * @param[out] ip2 The address 2 which will be IP address or mask + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_rule_h + * @see stc_firewall_rule_create() + * @see stc_firewall_rule_destroy() + * @see stc_firewall_rule_get_src_ip_type() + * @see stc_firewall_rule_set_src_ip() + */ +int stc_firewall_rule_get_src_ip(stc_firewall_rule_h rule_h, + char **ip1, char **ip2); + +/** + * @brief Gets the destination IP addresses from rule. + * @since_tizen 5.0 + * + * @param[in] rule The firewall rule handle + * @param[out] ip1 The address 1 + * @param[out] ip2 The address 2 which will be IP address or mask + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_rule_h + * @see stc_firewall_rule_create() + * @see stc_firewall_rule_destroy() + * @see stc_firewall_rule_get_dst_ip_type() + * @see stc_firewall_rule_set_dst_ip() + */ +int stc_firewall_rule_get_dst_ip(stc_firewall_rule_h rule_h, + char **ip1, char **ip2); + +/** + * @brief Gets the source ports from rule. + * @since_tizen 5.0 + * + * @param[in] rule The firewall rule handle + * @param[out] port1 The port 1 + * @param[out] port2 The port 2 + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_rule_h + * @see stc_firewall_rule_create() + * @see stc_firewall_rule_destroy() + * @see stc_firewall_rule_get_src_port_type() + * @see stc_firewall_rule_set_src_port() + */ +int stc_firewall_rule_get_src_port(stc_firewall_rule_h rule_h, + unsigned int *port1, unsigned int *port2); + +/** + * @brief Gets the destination ports from rule. + * @since_tizen 5.0 + * + * @param[in] rule The firewall rule handle + * @param[out] port1 The port 1 + * @param[out] port2 The port 2 + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_rule_h + * @see stc_firewall_rule_create() + * @see stc_firewall_rule_destroy() + * @see stc_firewall_rule_get_dst_port_type() + * @see stc_firewall_rule_set_dst_port() + */ +int stc_firewall_rule_get_dst_port(stc_firewall_rule_h rule_h, + unsigned int *port1, unsigned int *port2); + +/** + * @brief Gets the interface name from rule. + * @since_tizen 5.0 + * + * @param[in] rule The firewall rule handle + * @param[out] ifname The interface name + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_rule_h + * @see stc_firewall_rule_create() + * @see stc_firewall_rule_destroy() + * @see stc_firewall_rule_set_ifname() + */ +int stc_firewall_rule_get_ifname(stc_firewall_rule_h rule_h, char **ifname); + +/** + * @brief Gets the target type from rule. + * @since_tizen 5.0 + * + * @param[in] rule The firewall rule handle + * @param[out] target The target type + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_rule_h + * @see stc_firewall_rule_create() + * @see stc_firewall_rule_destroy() + * @see stc_firewall_rule_set_target() + */ +int stc_firewall_rule_get_target(stc_firewall_rule_h rule_h, + stc_firewall_rule_target_e *target); + +/** + * @brief Gets log level from rule. + * @since_tizen 5.0 + * + * @param[in] rule The firewall rule handle + * @param[out] level The level + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_rule_h + * @see stc_firewall_rule_create() + * @see stc_firewall_rule_destroy() + * @see stc_firewall_rule_set_log_level() + */ +int stc_firewall_rule_get_log_level(stc_firewall_rule_h rule_h, + unsigned char *level); + +int stc_firewall_rule_get_log_prefix(stc_firewall_rule_h rule_h, + char **prefix); + +/** + * @brief Gets nflog group from rule. + * @since_tizen 5.0 + * + * @param[in] rule The firewall rule handle + * @param[out] group The group + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_rule_h + * @see stc_firewall_rule_create() + * @see stc_firewall_rule_destroy() + * @see stc_firewall_rule_set_nflog_group() + */ +int stc_firewall_rule_get_nflog_group(stc_firewall_rule_h rule_h, + unsigned int *group); + +int stc_firewall_rule_get_nflog_prefix(stc_firewall_rule_h rule_h, + char **prefix); + +int stc_firewall_rule_get_nflog_range(stc_firewall_rule_h rule_h, + unsigned int *range); + +int stc_firewall_rule_get_nflog_threshold(stc_firewall_rule_h rule_h, + unsigned int *threshold); + +/** + * @brief Adds the rule. + * @since_tizen 5.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/firewall.common + * + * @param[in] rule The firewall rule handle + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_rule_h + * @see stc_firewall_rule_create() + * @see stc_firewall_rule_destroy() + */ +int stc_firewall_rule_add(stc_firewall_rule_h rule_h); + +/** + * @brief Removes the rule. + * @since_tizen 5.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/firewall.common + * + * @param[in] rule The firewall rule handle + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_rule_h + * @see stc_firewall_rule_create() + * @see stc_firewall_rule_destroy() + */ +int stc_firewall_rule_remove(stc_firewall_rule_h rule_h); + +/** + * @brief Updates the rule. + * @since_tizen 5.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/firewall.common + * + * @param[in] rule The firewall rule handle + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_rule_h + * @see stc_firewall_rule_create() + * @see stc_firewall_rule_destroy() + */ +int stc_firewall_rule_update(stc_firewall_rule_h rule_h); + +/** + * @brief Gets all rules. + * @since_tizen 5.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/firewall.common + * + * @param[in] stc The stc handle + * @param[in] callback The callback to be called + * @param[in] user_data The user data passed to the callback function + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_firewall_rule_h + * @see stc_firewall_rule_create() + * @see stc_firewall_rule_destroy() + */ +int stc_firewall_rule_foreach(stc_h stc, + stc_firewall_rule_info_cb callback, void *user_data); + +/** +* @} +*/ + #ifdef __cplusplus } #endif diff --git a/include/stc_internal.h b/include/stc_internal.h index 8225ed1..a25e757 100755 --- a/include/stc_internal.h +++ b/include/stc_internal.h @@ -36,3133 +36,30 @@ extern "C" { #include /***************************************************************************** - * Macros and Typedefs + * Smart Traffic Control (STC) library headers *****************************************************************************/ +#include "stc_mgr_internal.h" +#include "stc_stat_internal.h" +#include "stc_rstn_internal.h" +#include "stc_fw_internal.h" +#include "stc_ipt_internal.h" -/** - * @addtogroup CAPI_NETWORK_STC_STATISTICS_MODULE - * @{ - */ - -/** - * @brief The reset rule handle. - * @since_tizen 4.0 - */ -typedef void *stc_reset_rule_h; - - -/** -* @} -*/ - -/** - * @addtogroup CAPI_NETWORK_STC_FIREWALL_MODULE - * @{ - */ - -/** - * @brief The firewall chain handle. - * @since_tizen 5.0 - */ -typedef void *stc_firewall_chain_h; - -/** - * @brief The firewall rule handle. - * @since_tizen 5.0 - */ -typedef void *stc_firewall_rule_h; - -/** -* @} -*/ - -/** - * @addtogroup CAPI_NETWORK_STC_RESTRICTION_MODULE - * @{ - */ - -/** - * @brief The restriction rule handle. - * @since_tizen 4.0 - */ -typedef void *stc_restriction_rule_h; - -/** -* @} -*/ +/***************************************************************************** + * Macros and Typedefs + *****************************************************************************/ /***************************************************************************** * Enumeration *****************************************************************************/ -/** - * @addtogroup CAPI_NETWORK_STC_RESTRICTION_MODULE - * @{ - */ - -/** - * @brief Enumeration for network restriction type. - * @since_tizen 5.0 - */ -typedef enum { - STC_RSTN_TYPE_UNKNOWN, - STC_RSTN_TYPE_ACCEPT, - STC_RSTN_TYPE_DROP, - STC_RSTN_TYPE_LAST_ELEM, -} stc_restriction_type_e; - -/** -* @} -*/ - -/** - * @addtogroup CAPI_NETWORK_STC_FIREWALL_MODULE - * @{ - */ - -typedef enum { - STC_FIREWALL_UNKNOWN, - STC_FIREWALL_UNLOCKED, - STC_FIREWALL_LOCKED -} stc_firewall_lock_e; - -/** - * @brief Enumeration for firewall direction. - * @since_tizen 5.0 - */ -typedef enum { - STC_FIREWALL_DIRECTION_NONE, - STC_FIREWALL_DIRECTION_IN, - STC_FIREWALL_DIRECTION_OUT -} stc_firewall_direction_e; - -/** - * @brief Enumeration for firewall IP type. - * @since_tizen 5.0 - */ -typedef enum { - STC_FIREWALL_IP_NONE, - STC_FIREWALL_IP_SINGLE, - STC_FIREWALL_IP_MASK, - STC_FIREWALL_IP_RANGE -} stc_firewall_ip_type_e; - -/** - * @brief Enumeration for firewall port type. - * @since_tizen 5.0 - */ -typedef enum { - STC_FIREWALL_PORT_NONE, - STC_FIREWALL_PORT_SINGLE, - STC_FIREWALL_PORT_RANGE -} stc_firewall_port_type_e; - -/** - * @brief Enumeration for firewall protocol type. - * @since_tizen 5.0 - */ -typedef enum { - STC_FIREWALL_PROTOCOL_NONE, - STC_FIREWALL_PROTOCOL_TCP, - STC_FIREWALL_PROTOCOL_UDP, - STC_FIREWALL_PROTOCOL_ICMP, - STC_FIREWALL_PROTOCOL_ALL, -} stc_firewall_protocol_type_e; - -/** - * @brief Enumeration for firewall family type. - * @since_tizen 5.0 - */ -typedef enum { - STC_FIREWALL_FAMILY_NONE, - STC_FIREWALL_FAMILY_V4, - STC_FIREWALL_FAMILY_V6 -} stc_firewall_family_type_e; - -/** - * @brief Enumeration for firewall chain target. - * @since_tizen 5.0 - */ -typedef enum { - STC_FIREWALL_CHAIN_TARGET_NONE, - STC_FIREWALL_CHAIN_TARGET_INPUT, - STC_FIREWALL_CHAIN_TARGET_OUTPUT, - STC_FIREWALL_CHAIN_TARGET_MAX -} stc_firewall_chain_target_e; - -/** - * @brief Enumeration for firewall rule target. - * @since_tizen 5.0 - */ -typedef enum { - STC_FIREWALL_RULE_TARGET_NONE, - STC_FIREWALL_RULE_TARGET_ACCEPT, - STC_FIREWALL_RULE_TARGET_DROP, - STC_FIREWALL_RULE_TARGET_LOG, - STC_FIREWALL_RULE_TARGET_NFLOG, - STC_FIREWALL_RULE_TARGET_MAX, -} stc_firewall_rule_target_e; - -/** -* @} -*/ - - /***************************************************************************** * Callback functions *****************************************************************************/ -/** - * @addtogroup CAPI_NETWORK_STC_MANAGER_MODULE - * @{ - */ - -/** - * @brief Called for enumerate restriction rule. - * @since_tizen 5.0 - * - * @param[in] result The result - * @param[in] rule The restriction rule handle - * @param[in] user_data The user data passed from the callback registration function - * @return @c STC_CALLBACK_CONTINUE to continue with the next iteration of the loop, - * otherwise @c STC_CALLBACK_CANCEL to break out of the loop - * - * @pre stc_get_restriction() will invoke this callback. - * @pre stc_foreach_restriction() will invoke this callback. - * @see stc_restriction_rule_get_app_id() - * @see stc_restriction_rule_get_iface_name() - * @see stc_restriction_rule_get_subscriber_id() - * @see stc_restriction_rule_get_type() - * @see stc_restriction_rule_get_iface_type() - * @see stc_restriction_rule_get_limit() - * @see stc_restriction_rule_get_warning_limit() - * @see stc_restriction_rule_get_monthly_limit() - * @see stc_restriction_rule_get_weekly_limit() - * @see stc_restriction_rule_get_daily_limit() - * @see stc_restriction_rule_get_month_start_date() - * @see stc_restriction_rule_get_roaming_type() - * @see stc_get_restriction() - * @see stc_foreach_restriction() - */ -typedef stc_callback_ret_e (*stc_restriction_rule_cb)(stc_error_e result, - stc_restriction_rule_h rule, void *user_data); - -typedef void (*stc_threshold_crossed_cb)(stc_restriction_rule_h rule, - void *user_data); - -/** -* @} -*/ - -/** - * @addtogroup CAPI_NETWORK_STC_FIREWALL_MODULE - * @{ - */ - -/** - * @brief Called for enumerate firewall chain information. - * @since_tizen 5.0 - * - * @param[in] info The firewall chain handle - * @param[in] user_data The user data passed from the callback firewall chain function - * @return @c STC_CALLBACK_CONTINUE to continue with the next iteration of the loop, - * otherwise @c STC_CALLBACK_CANCEL to break out of the loop - * - * @pre stc_firewall_chain_foreach() will invoke this callback. - * @see stc_firewall_chain_get_name() - * @see stc_firewall_chain_get_target() - * @see stc_firewall_chain_get_priority() - * @see stc_firewall_chain_foreach() - */ -typedef stc_callback_ret_e (*stc_firewall_chain_info_cb)(stc_firewall_chain_h info_h, - void *user_data); - -/** - * @brief Called for enumerate firewall rule information. - * @since_tizen 5.0 - * - * @param[in] info The firewall rule handle - * @param[in] user_data The user data passed from the callback firewall rule function - * @return @c STC_CALLBACK_CONTINUE to continue with the next iteration of the loop, - * otherwise @c STC_CALLBACK_CANCEL to break out of the loop - * - * @pre stc_firewall_rule_foreach() will invoke this callback. - * @see stc_firewall_rule_get_chain() - * @see stc_firewall_rule_get_direction() - * @see stc_firewall_rule_get_src_ip_type() - * @see stc_firewall_rule_get_dst_ip_type() - * @see stc_firewall_rule_get_src_port_type() - * @see stc_firewall_rule_get_dst_port_type() - * @see stc_firewall_rule_get_protocol_type() - * @see stc_firewall_rule_get_family_type() - * @see stc_firewall_rule_get_src_ip() - * @see stc_firewall_rule_get_dst_ip() - * @see stc_firewall_rule_get_src_port() - * @see stc_firewall_rule_get_dst_port() - * @see stc_firewall_rule_get_ifname() - * @see stc_firewall_rule_get_target() - * @see stc_firewall_rule_foreach() - */ -typedef stc_callback_ret_e (*stc_firewall_rule_info_cb)(stc_firewall_rule_h info, - void *user_data); - -/** -* @} -*/ - /***************************************************************************** * Core API functions *****************************************************************************/ -/** - * @addtogroup CAPI_NETWORK_STC_MANAGER_MODULE - * @{ - */ - -/** - * @brief Resets stats information. - * @since_tizen 4.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/network.get - * - * @param[in] stc The stc handle - * @param[in] rule The reset rule handle - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_h - * @see #stc_reset_rule_h - * @see stc_initialize() - * @see stc_reset_rule_create() - * @see stc_reset_rule_destroy() - * @see stc_reset_rule_set_app_id() - * @see stc_reset_rule_set_subscriber_id() - * @see stc_reset_rule_set_iface_type() - * @see stc_reset_rule_set_time_interval() - * @see stc_reset_rule_get_app_id() - * @see stc_reset_rule_get_subscriber_id() - * @see stc_reset_rule_get_iface_type() - * @see stc_reset_rule_get_time_interval() - */ -int stc_reset_stats(stc_h stc, stc_reset_rule_h rule); - - -/** - * @brief Sets the restriction for application. - * @details Sets and applies restriction for application. - * It will creates new restriction or modify existing. - * @since_tizen 4.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/network.get - * - * @param[in] stc The stc handle - * @param[in] rule The restriction rule handle - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_h - * @see #stc_restriction_rule_h - * @see stc_initialize() - * @see stc_restriction_rule_create() - * @see stc_restriction_rule_destroy() - * @see stc_restriction_rule_set_app_id() - * @see stc_restriction_rule_set_iface_name() - * @see stc_restriction_rule_set_iface_type() - * @see stc_restriction_rule_set_limit() - * @see stc_restriction_rule_set_warning_limit() - * @see stc_restriction_rule_set_roaming_type() - * @see stc_restriction_rule_set_subscriber_id() - * @see stc_restriction_rule_get_app_id() - * @see stc_restriction_rule_get_iface_type() - * @see stc_restriction_rule_get_limit() - * @see stc_restriction_rule_get_warning_limit() - * @see stc_restriction_rule_get_roaming_type() - * @see stc_restriction_rule_get_subscriber_id() - * @see stc_restriction_rule_get_process_state() - * @see stc_get_restriction() - * @see stc_foreach_restriction() - * @see stc_get_restriction_type() - * @see stc_unset_restriction() - */ -int stc_set_restriction(stc_h stc, stc_restriction_rule_h rule); - -/** - * @brief Unsets the existing restriction for application. - * @details Unsets the existing restriction for application. - * It will delete restriction rule in kernel. - * @since_tizen 4.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/network.get - * - * @param[in] stc The stc handle - * @param[in] rule The restriction rule handle - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_h - * @see #stc_restriction_rule_h - * @see stc_initialize() - * @see stc_restriction_rule_create() - * @see stc_restriction_rule_destroy() - * @see stc_restriction_rule_set_app_id() - * @see stc_restriction_rule_set_iface_name() - * @see stc_restriction_rule_set_iface_type() - * @see stc_restriction_rule_set_limit() - * @see stc_restriction_rule_set_warning_limit() - * @see stc_restriction_rule_set_roaming_type() - * @see stc_restriction_rule_set_subscriber_id() - * @see stc_restriction_rule_get_app_id() - * @see stc_restriction_rule_get_iface_type() - * @see stc_restriction_rule_get_limit() - * @see stc_restriction_rule_get_warning_limit() - * @see stc_restriction_rule_get_roaming_type() - * @see stc_restriction_rule_get_subscriber_id() - * @see stc_restriction_rule_get_process_state() - * @see stc_set_restriction() - * @see stc_get_restriction() - * @see stc_foreach_restriction() - * @see stc_get_restriction_type() - */ -int stc_unset_restriction(stc_h stc, stc_restriction_rule_h rule); - -/** - * @brief Gets the restriction rule per application. - * @details The callback is called for each application that applied restriction. - * @since_tizen 4.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/network.get - * - * @param[in] stc The stc handle - * @param[in] rule The restriction rule handle - * @param[in] rule_cb The callback is called for each application - * that applied restriction in interface specified - * @param[in] user_data User data will be passed to the callback function - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_h - * @see #stc_restriction_rule_h - * @see stc_initialize() - * @see stc_restriction_rule_create() - * @see stc_restriction_rule_destroy() - * @see stc_restriction_rule_set_app_id() - * @see stc_restriction_rule_set_iface_name() - * @see stc_restriction_rule_set_iface_type() - * @see stc_restriction_rule_set_limit() - * @see stc_restriction_rule_set_warning_limit() - * @see stc_restriction_rule_set_roaming_type() - * @see stc_restriction_rule_set_subscriber_id() - * @see stc_restriction_rule_get_app_id() - * @see stc_restriction_rule_get_iface_type() - * @see stc_restriction_rule_get_limit() - * @see stc_restriction_rule_get_warning_limit() - * @see stc_restriction_rule_get_roaming_type() - * @see stc_restriction_rule_get_subscriber_id() - * @see stc_restriction_rule_get_process_state() - * @see stc_restriction_rule_cb() - * @see stc_set_restriction() - * @see stc_foreach_restriction() - * @see stc_get_restriction_type() - * @see stc_unset_restriction() - */ -int stc_get_restriction(stc_h stc, stc_restriction_rule_h rule, - stc_restriction_rule_cb rule_cb, void *user_data); - -int stc_set_restriction_threshold_crossed_cb(stc_h stc, - stc_threshold_crossed_cb crossed_cb, void *user_data); - -int stc_unset_restriction_threshold_crossed_cb(stc_h stc); - -int stc_set_warn_threshold_crossed_cb(stc_h stc, - stc_threshold_crossed_cb crossed_cb, void *user_data); - -int stc_unset_warn_threshold_crossed_cb(stc_h stc); - -/** - * @brief Gets the restriction rule of all application. - * @details The callback is called for each application that applied restriction. - * @since_tizen 4.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/network.get - * - * @param[in] stc The stc handle - * @param[in] rule The restriction rule handle - * @param[in] rule_cb The callback is called for each application - * that applied restriction in interface specified - * @param[in] user_data User data will be passed to the callback function - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_h - * @see #stc_restriction_rule_h - * @see stc_initialize() - * @see stc_restriction_rule_create() - * @see stc_restriction_rule_destroy() - * @see stc_restriction_rule_set_app_id() - * @see stc_restriction_rule_set_iface_name() - * @see stc_restriction_rule_set_iface_type() - * @see stc_restriction_rule_set_limit() - * @see stc_restriction_rule_set_warning_limit() - * @see stc_restriction_rule_set_roaming_type() - * @see stc_restriction_rule_set_subscriber_id() - * @see stc_restriction_rule_get_app_id() - * @see stc_restriction_rule_get_iface_type() - * @see stc_restriction_rule_get_limit() - * @see stc_restriction_rule_get_warning_limit() - * @see stc_restriction_rule_get_roaming_type() - * @see stc_restriction_rule_get_subscriber_id() - * @see stc_restriction_rule_get_process_state() - * @see stc_restriction_rule_cb() - * @see stc_set_restriction() - * @see stc_get_restriction() - * @see stc_get_restriction_type() - * @see stc_unset_restriction() - */ -int stc_foreach_restriction(stc_h stc, stc_restriction_rule_h rule, - stc_restriction_rule_cb rule_cb, void *user_data); - -/** - * @brief Gets the restriction type. - * @since_tizen 4.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/network.get - * - * @param[in] stc The stc handle - * @param[in] rule The restriction rule handle - * @param[out] type The restriction type - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_h - * @see #stc_restriction_rule_h - * @see #stc_restriction_type_e - * @see stc_initialize() - * @see stc_restriction_rule_create() - * @see stc_restriction_rule_destroy() - * @see stc_restriction_rule_set_app_id() - * @see stc_restriction_rule_set_iface_name() - * @see stc_restriction_rule_set_iface_type() - * @see stc_restriction_rule_set_limit() - * @see stc_restriction_rule_set_warning_limit() - * @see stc_restriction_rule_set_roaming_type() - * @see stc_restriction_rule_set_subscriber_id() - * @see stc_restriction_rule_get_app_id() - * @see stc_restriction_rule_get_iface_type() - * @see stc_restriction_rule_get_limit() - * @see stc_restriction_rule_get_warning_limit() - * @see stc_restriction_rule_get_roaming_type() - * @see stc_restriction_rule_get_subscriber_id() - * @see stc_restriction_rule_get_process_state() - * @see stc_set_restriction() - * @see stc_get_restriction() - * @see stc_foreach_restriction() - * @see stc_unset_restriction() - */ -int stc_get_restriction_type(stc_h stc, stc_restriction_rule_h rule, - stc_restriction_type_e *type); - -/** -* @} -*/ - -/** - * @addtogroup CAPI_NETWORK_STC_STATISTICS_MODULE - * @{ - */ - -/** - * @brief Creates the reset rule handle. - * @since_tizen 4.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/network.get - * @remarks You must release @a handle using stc_reset_rule_destroy(). - * - * @param[in] stc The stc handle - * @param[out] rule The reset rule handle - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_h - * @see #stc_reset_rule_h - * @see stc_initialize() - * @see stc_reset_rule_destroy() - */ -int stc_reset_rule_create(stc_h stc, stc_reset_rule_h *rule); - -/** - * @brief Destroys the reset rule handle. - * @since_tizen 4.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/network.get - * - * @param[in] rule The reset rule handle - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_reset_rule_h - * @see stc_reset_rule_create() - */ -int stc_reset_rule_destroy(stc_reset_rule_h rule); - -/** - * @brief Sets the application ID for reset rule. - * @since_tizen 4.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/network.get - * - * @param[in] rule The reset rule handle - * @param[in] app_id The application ID - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_reset_rule_h - * @see stc_reset_rule_create() - * @see stc_reset_rule_destroy() - * @see stc_reset_rule_get_app_id() - */ -int stc_reset_rule_set_app_id(stc_reset_rule_h rule, const char *app_id); - -/** - * @brief Sets the subscriber ID for reset rule. - * @since_tizen 4.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/network.get - * - * @param[in] rule The reset rule handle - * @param[in] subscriber_id The subscriber ID - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_reset_rule_h - * @see stc_reset_rule_create() - * @see stc_reset_rule_destroy() - * @see stc_reset_rule_get_subscriber_id() - */ -int stc_reset_rule_set_subscriber_id(stc_reset_rule_h rule, const char *subscriber_id); - -/** - * @brief Sets the interface type for reset rule. - * @since_tizen 4.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/network.get - * - * @param[in] rule The reset rule handle - * @param[in] iface_type The interface type - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_reset_rule_h - * @see #stc_iface_type_e - * @see stc_reset_rule_create() - * @see stc_reset_rule_destroy() - * @see stc_reset_rule_get_iface_type() - */ -int stc_reset_rule_set_iface_type(stc_reset_rule_h rule, - stc_iface_type_e iface_type); - -/** - * @brief Sets the time interval for reset rule. - * @since_tizen 4.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/network.get - * - * @param[in] rule The reset rule handle - * @param[in] from The time interval from - * @param[in] to The time interval to - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_reset_rule_h - * @see stc_reset_rule_create() - * @see stc_reset_rule_destroy() - * @see stc_reset_rule_get_time_interval() - */ -int stc_reset_rule_set_time_interval(stc_reset_rule_h rule, - time_t from, time_t to); - -/** - * @brief Gets the application ID for reset. - * @since_tizen 4.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/network.get - * - * @param[in] rule The reset rule handle - * @param[out] app_id The application ID - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_reset_rule_h - * @see stc_reset_rule_create() - * @see stc_reset_rule_destroy() - * @see stc_reset_rule_set_app_id() - */ -int stc_reset_rule_get_app_id(stc_reset_rule_h rule, char **app_id); - -/** - * @brief Gets the subscriber ID for reset rule. - * @since_tizen 4.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/network.get - * - * @param[in] rule The reset rule handle - * @param[out] subscriber_id The subscriber ID - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_reset_rule_h - * @see stc_reset_rule_create() - * @see stc_reset_rule_destroy() - * @see stc_reset_rule_set_subscriber_id() - */ -int stc_reset_rule_get_subscriber_id(stc_reset_rule_h rule, char **subscriber_id); - -/** - * @brief Gets the interface type for reset rule. - * @since_tizen 4.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/network.get - * - * @param[in] rule The reset rule handle - * @param[out] iface_type The interface type - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_reset_rule_h - * @see #stc_iface_type_e - * @see stc_reset_rule_create() - * @see stc_reset_rule_destroy() - * @see stc_reset_rule_set_iface_type() - */ -int stc_reset_rule_get_iface_type(stc_reset_rule_h rule, - stc_iface_type_e *iface_type); - -/** - * @brief Gets the time interval for reset rule. - * @since_tizen 4.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/network.get - * - * @param[in] rule The reset rule handle - * @param[out] from The time interval from - * @param[out] to The time interval to - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_reset_rule_h - * @see stc_reset_rule_create() - * @see stc_reset_rule_destroy() - * @see stc_reset_rule_set_time_interval() - */ -int stc_reset_rule_get_time_interval(stc_reset_rule_h rule, - time_t *from, time_t *to); - -/** -* @} -*/ - -/** - * @addtogroup CAPI_NETWORK_STC_RESTRICTION_MODULE - * @{ - */ - -/** - * @brief Creates the restriction rule handle. - * @since_tizen 4.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/network.get - * @remarks You must release @a handle using stc_restriction_rule_destroy(). - * - * @param[in] stc The stc handle - * @param[out] rule The restriction rule handle - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_h - * @see #stc_restriction_rule_h - * @see stc_initialize() - * @see stc_restriction_rule_destroy() - */ -int stc_restriction_rule_create(stc_h stc, stc_restriction_rule_h *rule); - -/** - * @brief Destroys the restriction rule handle. - * @since_tizen 4.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/network.get - * - * @param[in] rule The restriction rule handle - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_restriction_rule_h - * @see stc_restriction_rule_create() - */ -int stc_restriction_rule_destroy(stc_restriction_rule_h rule); - -/** - * @brief Sets the application ID for restriction rule. - * @since_tizen 4.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/network.get - * - * @param[in] rule The restriction rule handle - * @param[in] app_id The application ID - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_restriction_rule_h - * @see stc_restriction_rule_create() - * @see stc_restriction_rule_destroy() - * @see stc_restriction_rule_get_app_id() - */ -int stc_restriction_rule_set_app_id(stc_restriction_rule_h rule, - const char *app_id); - -/** - * @brief Sets the interface name for restriction rule. - * @since_tizen 4.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/network.get - * - * @param[in] rule The restriction rule handle - * @param[in] iface_name The interface name - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_restriction_rule_h - * @see #stc_iface_type_e - * @see stc_restriction_rule_create() - * @see stc_restriction_rule_destroy() - * @see stc_restriction_rule_get_iface_name() - */ -int stc_restriction_rule_set_iface_name( stc_restriction_rule_h rule, - const char *iface_name); - -/** - * @brief Sets the interface type for restriction rule. - * @since_tizen 4.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/network.get - * - * @param[in] rule The restriction rule handle - * @param[in] iface_type The interface type - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_restriction_rule_h - * @see #stc_iface_type_e - * @see stc_restriction_rule_create() - * @see stc_restriction_rule_destroy() - * @see stc_restriction_rule_get_iface_type() - */ -int stc_restriction_rule_set_iface_type(stc_restriction_rule_h rule, - stc_iface_type_e iface_type); - -/** - * @brief Sets the type for restriction rule. - * @since_tizen 5.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/network.get - * - * @param[in] rule The restriction rule handle - * @param[in] type The restriction type - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_restriction_rule_h - * @see #stc_restriction_type_e - * @see stc_restriction_rule_create() - * @see stc_restriction_rule_destroy() - * @see stc_restriction_rule_get_type() - */ -int stc_restriction_rule_set_type(stc_restriction_rule_h rule, - stc_restriction_type_e type); - -/** - * @brief Sets the limit for restriction rule. - * @since_tizen 4.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/network.get - * - * @param[in] rule The restriction rule handle - * @param[in] data_limit The data limit - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_restriction_rule_h - * @see stc_restriction_rule_create() - * @see stc_restriction_rule_destroy() - * @see stc_restriction_rule_get_limit() - */ -int stc_restriction_rule_set_limit(stc_restriction_rule_h rule, - int64_t data_limit); - -/** - * @brief Sets the warning limit for restriction rule. - * @since_tizen 4.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/network.get - * - * @param[in] rule The restriction rule handle - * @param[in] data_warn_limit The data warning limit - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_restriction_rule_h - * @see stc_restriction_rule_create() - * @see stc_restriction_rule_destroy() - * @see stc_restriction_rule_get_warning_limit() - */ -int stc_restriction_rule_set_warning_limit(stc_restriction_rule_h rule, - int64_t data_warn_limit); - -/** - * @brief Sets the monthly data limit for restriction rule. - * @since_tizen 5.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/network.get - * - * @param[in] rule The restriction rule handle - * @param[in] limit The data limit - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_restriction_rule_h - * @see stc_restriction_rule_create() - * @see stc_restriction_rule_destroy() - * @see stc_restriction_rule_get_monthly_limit() - */ -int stc_restriction_rule_set_monthly_limit(stc_restriction_rule_h rule, - int64_t limit); - -/** - * @brief Sets the weekly data limit for restriction rule. - * @since_tizen 5.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/network.get - * - * @param[in] rule The restriction rule handle - * @param[in] limit The data limit - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_restriction_rule_h - * @see stc_restriction_rule_create() - * @see stc_restriction_rule_destroy() - * @see stc_restriction_rule_get_weekly_limit() - */ -int stc_restriction_rule_set_weekly_limit(stc_restriction_rule_h rule, - int64_t limit); - -/** - * @brief Sets the daily data limit for restriction rule. - * @since_tizen 5.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/network.get - * - * @param[in] rule The restriction rule handle - * @param[in] limit The data limit - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_restriction_rule_h - * @see stc_restriction_rule_create() - * @see stc_restriction_rule_destroy() - * @see stc_restriction_rule_get_daily_limit() - */ -int stc_restriction_rule_set_daily_limit(stc_restriction_rule_h rule, - int64_t limit); - -/** - * @brief Sets the month start date for restriction rule. - * @since_tizen 5.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/network.get - * - * @param[in] rule The restriction rule handle - * @param[in] month_start_date The month start date - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_restriction_rule_h - * @see stc_restriction_rule_create() - * @see stc_restriction_rule_destroy() - * @see stc_restriction_rule_get_month_start_date() - */ -int stc_restriction_rule_set_month_start_date(stc_restriction_rule_h rule, - int month_start_date); - -/** - * @brief Sets the roaming type for restriction rule. - * @since_tizen 4.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/network.get - * - * @param[in] rule The restriction rule handle - * @param[in] roaming_type The roaming type - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_restriction_rule_h - * @see #stc_roaming_type_e - * @see stc_restriction_rule_create() - * @see stc_restriction_rule_destroy() - * @see stc_restriction_rule_get_roaming_type() - */ -int stc_restriction_rule_set_roaming_type(stc_restriction_rule_h rule, - stc_roaming_type_e roaming_type); - -/** - * @brief Sets the subscriber ID for restriction rule. - * @since_tizen 4.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/network.get - * - * @param[in] rule The restriction rule handle - * @param[in] subscriber_id The subscriber ID - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_restriction_rule_h - * @see stc_restriction_rule_create() - * @see stc_restriction_rule_destroy() - * @see stc_restriction_rule_get_subscriber_id() - */ -int stc_restriction_rule_set_subscriber_id(stc_restriction_rule_h rule, const char *subscriber_id); - -/** - * @brief Gets the application ID for restriction rule. - * @since_tizen 4.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/network.get - * - * @param[in] rule The restriction rule handle - * @param[out] app_id The application ID - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_restriction_rule_h - * @see stc_restriction_rule_create() - * @see stc_restriction_rule_destroy() - * @see stc_restriction_rule_set_app_id() - */ -int stc_restriction_rule_get_app_id(stc_restriction_rule_h rule, char **app_id); - -/** - * @brief Gets the interface name for restriction rule. - * @since_tizen 4.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/network.get - * - * @param[in] rule The restriction rule handle - * @param[out] iface_name The interface name - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_restriction_rule_h - * @see #stc_iface_type_e - * @see stc_restriction_rule_create() - * @see stc_restriction_rule_destroy() - * @see stc_restriction_rule_set_iface_name() - */ -int stc_restriction_rule_get_iface_name(stc_restriction_rule_h rule, - char **iface_name); - -/** - * @brief Gets the interface type for restriction rule. - * @since_tizen 4.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/network.get - * - * @param[in] rule The restriction rule handle - * @param[out] iface_type The interface type - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_restriction_rule_h - * @see #stc_iface_type_e - * @see stc_restriction_rule_create() - * @see stc_restriction_rule_destroy() - * @see stc_restriction_rule_set_iface_type() - */ -int stc_restriction_rule_get_iface_type(stc_restriction_rule_h rule, - stc_iface_type_e *iface_type); - -/** - * @brief Gets the type for restriction rule. - * @since_tizen 5.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/network.get - * - * @param[in] rule The restriction rule handle - * @param[out] type The restriction type - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_restriction_rule_h - * @see #stc_restriction_type_e - * @see stc_restriction_rule_create() - * @see stc_restriction_rule_destroy() - * @see stc_restriction_rule_set_type() - */ -int stc_restriction_rule_get_type(stc_restriction_rule_h rule, - stc_restriction_type_e *type); - -/** - * @brief Gets the limit for restriction rule. - * @since_tizen 4.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/network.get - * - * @param[in] rule The restriction rule handle - * @param[out] data_limit The data limit - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_restriction_rule_h - * @see stc_restriction_rule_create() - * @see stc_restriction_rule_destroy() - * @see stc_restriction_rule_set_limit() - */ -int stc_restriction_rule_get_limit(stc_restriction_rule_h rule, - int64_t *data_limit); - -/** - * @brief Gets the warning limit for restriction rule. - * @since_tizen 4.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/network.get - * - * @param[in] rule The restriction rule handle - * @param[out] data_warn_limit The data warning limit - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_restriction_rule_h - * @see stc_restriction_rule_create() - * @see stc_restriction_rule_destroy() - * @see stc_restriction_rule_set_warning_limit() - */ -int stc_restriction_rule_get_warning_limit(stc_restriction_rule_h rule, - int64_t *data_warn_limit); - -/** - * @brief Gets the montlhy data limit for restriction rule. - * @since_tizen 5.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/network.get - * - * @param[in] rule The restriction rule handle - * @param[out] limit The data limit - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_restriction_rule_h - * @see stc_restriction_rule_create() - * @see stc_restriction_rule_destroy() - * @see stc_restriction_rule_set_monthly_limit() - */ -int stc_restriction_rule_get_monthly_limit(stc_restriction_rule_h rule, - int64_t *limit); - -/** - * @brief Gets the weekly data limit for restriction rule. - * @since_tizen 5.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/network.get - * - * @param[in] rule The restriction rule handle - * @param[out] limit The data limit - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_restriction_rule_h - * @see stc_restriction_rule_create() - * @see stc_restriction_rule_destroy() - * @see stc_restriction_rule_set_weekly_limit() - */ -int stc_restriction_rule_get_weekly_limit(stc_restriction_rule_h rule, - int64_t *limit); - -/** - * @brief Gets the daily data limit for restriction rule. - * @since_tizen 5.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/network.get - * - * @param[in] rule The restriction rule handle - * @param[out] limit The data limit - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_restriction_rule_h - * @see stc_restriction_rule_create() - * @see stc_restriction_rule_destroy() - * @see stc_restriction_rule_set_daily_limit() - */ -int stc_restriction_rule_get_daily_limit(stc_restriction_rule_h rule, - int64_t *limit); - -/** - * @brief Gets the month start date for restriction rule. - * @since_tizen 5.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/network.get - * - * @param[in] rule The restriction rule handle - * @param[out] month_start_date The month start date - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_restriction_rule_h - * @see stc_restriction_rule_create() - * @see stc_restriction_rule_destroy() - * @see stc_restriction_rule_set_month_start_date() - */ -int stc_restriction_rule_get_month_start_date(stc_restriction_rule_h rule, - int *month_start_date); - -/** - * @brief Gets the roaming type for restriction rule. - * @since_tizen 4.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/network.get - * - * @param[in] rule The restriction rule handle - * @param[out] roaming The roaming type - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_restriction_rule_h - * @see #stc_roaming_type_e - * @see stc_restriction_rule_create() - * @see stc_restriction_rule_destroy() - * @see stc_restriction_rule_set_roaming_type() - */ -int stc_restriction_rule_get_roaming_type(stc_restriction_rule_h rule, - stc_roaming_type_e *roaming_type); - -/** - * @brief Gets the subscriber ID for restriction rule. - * @since_tizen 4.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/network.get - * - * @param[in] rule The restriction rule handle - * @param[out] subscriber_id The subscriber ID - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_restriction_rule_h - * @see stc_restriction_rule_create() - * @see stc_restriction_rule_destroy() - * @see stc_restriction_rule_set_subscriber_id() - */ -int stc_restriction_rule_get_subscriber_id(stc_restriction_rule_h rule, char **subscriber_id); - -/** - * @brief Gets the subscriber ID from statistics information. - * @since_tizen 4.0 - * @remarks You must release @a subscriber ID using free(). - * - * @param[in] info The statistics information handle - * @param[out] subscriber_id The subscriber ID - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see stc_stats_info_h - * @see stc_stats_info_cb() - */ -int stc_stats_info_get_subscriber_id(stc_stats_info_h info, char **subscriber_id); - -/** -* @} -*/ - -/** - * @addtogroup CAPI_NETWORK_STC_FIREWALL_MODULE - * @{ - */ - -/** - * @brief Locks the firewall. - * @since_tizen 5.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/firewall.admin - * - * @param[in] stc The stc handle - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_h - * @see stc_initialize() - * @see stc_firewall_unlock() - * @see stc_firewall_get_lock() - */ -int stc_firewall_lock(stc_h stc); - -/** - * @brief Unlocks the firewall. - * @since_tizen 5.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/firewall.admin - * - * @param[in] stc The stc handle - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_h - * @see stc_initialize() - * @see stc_firewall_lock() - * @see stc_firewall_get_lock() - */ -int stc_firewall_unlock(stc_h stc); - -/** - * @brief Gets the firewall lock state. - * @since_tizen 5.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/firewall.admin - * - * @param[in] stc The stc handle - * @param[out] state The firewall lock state - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_h - * @see stc_initialize() - * @see stc_firewall_lock() - * @see stc_firewall_unlock() - */ -int stc_firewall_get_lock(stc_h stc, stc_firewall_lock_e *state); - -/** - * @brief Creates the firewall chain handle. - * @since_tizen 5.0 - * @remarks You must release @a handle using stc_firewall_chain_destroy(). - * - * @param[in] stc The stc handle - * @param[in] name The chain name - * @param[out] chain The firewall chain handle - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_h - * @see #stc_firewall_chain_h - * @see stc_initialize() - * @see stc_firewall_chain_destroy() - */ -int stc_firewall_chain_create(stc_h stc, const char *name, - stc_firewall_chain_h *chain_h); - -/** - * @brief Clones the firewall chain handle. - * @since_tizen 5.0 - * @remarks You must release @a handle using stc_firewall_chain_destroy(). - * - * @param[in] origin The origin firewall chain handle - * @param[out] cloned_chain The cloned firewall chain handle - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_h - * @see #stc_firewall_chain_h - * @see stc_initialize() - * @see stc_firewall_chain_create() - * @see stc_firewall_chain_destroy() - */ -int stc_firewall_chain_clone(stc_firewall_chain_h origin_h, - stc_firewall_chain_h *cloned_chain_h); - -/** - * @brief Destroys the firewall chain handle. - * @since_tizen 5.0 - * - * @param[in] chain The firewall chain handle - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_chain_h - * @see stc_firewall_chain_create() - */ -int stc_firewall_chain_destroy(stc_firewall_chain_h chain_h); - -/** - * @brief Gets the name for chain. - * @since_tizen 5.0 - * - * @param[in] chain The firewall chain handle - * @param[out] name The chain name - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_chain_h - * @see stc_firewall_chain_create() - * @see stc_firewall_chain_destroy() - */ -int stc_firewall_chain_get_name(stc_firewall_chain_h chain, char **name); - -/** - * @brief Gets the target type for chain. - * @since_tizen 5.0 - * - * @param[in] chain The firewall chain handle - * @param[out] target The target type - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_chain_h - * @see stc_firewall_chain_create() - * @see stc_firewall_chain_destroy() - */ -int stc_firewall_chain_get_target(stc_firewall_chain_h chain_h, - stc_firewall_chain_target_e *target); - -/** - * @brief Gets the priority for chain. - * @since_tizen 5.0 - * - * @param[in] chain The firewall chain handle - * @param[out] priority The priority - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_chain_h - * @see stc_firewall_chain_create() - * @see stc_firewall_chain_destroy() - */ -int stc_firewall_chain_get_priority(stc_firewall_chain_h chain_h, - unsigned int *priority); - -/** - * @brief Adds the chain. - * @since_tizen 5.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/firewall.common - * - * @param[in] chain The firewall chain handle - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_chain_h - * @see stc_firewall_chain_create() - * @see stc_firewall_chain_destroy() - */ -int stc_firewall_chain_add(stc_firewall_chain_h chain_h); - -/** - * @brief Removes the chain. - * @since_tizen 5.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/firewall.common - * - * @param[in] chain The firewall chain handle - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_chain_h - * @see stc_firewall_chain_create() - * @see stc_firewall_chain_destroy() - */ -int stc_firewall_chain_remove(stc_firewall_chain_h chain_h); - -/** - * @brief Flushs the chain. - * @since_tizen 5.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/firewall.common - * - * @param[in] chain The firewall chain handle - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_chain_h - * @see stc_firewall_chain_create() - * @see stc_firewall_chain_destroy() - */ -int stc_firewall_chain_flush(stc_firewall_chain_h chain_h); - -/** - * @brief Gets all chains. - * @since_tizen 5.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/firewall.common - * - * @param[in] stc The stc handle - * @param[in] callback The callback to be called - * @param[in] user_data The user data passed to the callback function - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_chain_h - * @see stc_firewall_chain_create() - * @see stc_firewall_chain_destroy() - */ -int stc_firewall_chain_foreach(stc_h stc, - stc_firewall_chain_info_cb callback, void *user_data); - -/** - * @brief Sets the chain to target. - * @since_tizen 5.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/firewall.common - * @remarks You should set only one chain. - * - * @param[in] chain The firewall chain handle - * @param[in] target The target type - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_chain_h - * @see stc_firewall_chain_create() - * @see stc_firewall_chain_destroy() - */ -int stc_firewall_chain_set(stc_firewall_chain_h chain_h, - stc_firewall_chain_target_e target); - -/** - * @brief Unsets the chain. - * @since_tizen 5.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/firewall.common - * - * @param[in] chain The firewall chain handle - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_chain_h - * @see stc_firewall_chain_create() - * @see stc_firewall_chain_destroy() - */ -int stc_firewall_chain_unset(stc_firewall_chain_h chain_h); - -/** - * @brief Creates the firewall rule handle. - * @since_tizen 5.0 - * @remarks You must release @a handle using stc_firewall_rule_destroy(). - * - * @param[in] stc The stc handle - * @param[out] rule The firewall rule handle - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_h - * @see #stc_firewall_rule_h - * @see stc_initialize() - * @see stc_firewall_rule_destroy() - */ -int stc_firewall_rule_create(stc_h stc, stc_firewall_rule_h *rule_h); - -/** - * @brief Clones the firewall rule handle. - * @since_tizen 5.0 - * @remarks You must release @a handle using stc_firewall_rule_destroy(). - * - * @param[in] origin The origin firewall rule handle - * @param[out] cloned_rule The cloned firewall rule handle - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_h - * @see #stc_firewall_rule_h - * @see stc_initialize() - * @see stc_firewall_rule_create() - * @see stc_firewall_rule_destroy() - */ -int stc_firewall_rule_clone(stc_firewall_rule_h origin_h, - stc_firewall_rule_h *cloned_rule_h); - -/** - * @brief Destroys the firewall rule handle. - * @since_tizen 5.0 - * - * @param[in] rule The firewall chain handle - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_rule_h - * @see stc_firewall_rule_create() - */ -int stc_firewall_rule_destroy(stc_firewall_rule_h rule_h); - -/** - * @brief Sets the chain name to rule. - * @since_tizen 5.0 - * - * @param[in] rule The firewall rule handle - * @param[in] chain The chain name - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_rule_h - * @see stc_firewall_rule_create() - * @see stc_firewall_rule_destroy() - * @see stc_firewall_rule_get_chain() - */ -int stc_firewall_rule_set_chain(stc_firewall_rule_h rule_h, char *chain); - -/** - * @brief Sets the direction to rule. - * @since_tizen 5.0 - * - * @param[in] rule The firewall rule handle - * @param[in] direction The direction - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_rule_h - * @see stc_firewall_rule_create() - * @see stc_firewall_rule_destroy() - * @see stc_firewall_rule_get_direction() - */ -int stc_firewall_rule_set_direction(stc_firewall_rule_h rule_h, - stc_firewall_direction_e direction); - -/** - * @brief Sets the source IP type to rule. - * @since_tizen 5.0 - * - * @param[in] rule The firewall rule handle - * @param[in] type The IP type - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_rule_h - * @see stc_firewall_rule_create() - * @see stc_firewall_rule_destroy() - * @see stc_firewall_rule_get_src_ip_type() - */ -int stc_firewall_rule_set_src_ip_type(stc_firewall_rule_h rule_h, - stc_firewall_ip_type_e type); - -/** - * @brief Sets the destination IP type to rule. - * @since_tizen 5.0 - * - * @param[in] rule The firewall rule handle - * @param[in] type The IP type - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_rule_h - * @see stc_firewall_rule_create() - * @see stc_firewall_rule_destroy() - * @see stc_firewall_rule_get_dst_ip_type() - */ -int stc_firewall_rule_set_dst_ip_type(stc_firewall_rule_h rule_h, - stc_firewall_ip_type_e type); - -/** - * @brief Sets the source port type to rule. - * @since_tizen 5.0 - * - * @param[in] rule The firewall rule handle - * @param[in] type The port type - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_rule_h - * @see stc_firewall_rule_create() - * @see stc_firewall_rule_destroy() - * @see stc_firewall_rule_get_src_port_type() - */ -int stc_firewall_rule_set_src_port_type(stc_firewall_rule_h rule_h, - stc_firewall_port_type_e type); - -/** - * @brief Sets the destination port type to rule. - * @since_tizen 5.0 - * - * @param[in] rule The firewall rule handle - * @param[in] type The port type - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_rule_h - * @see stc_firewall_rule_create() - * @see stc_firewall_rule_destroy() - * @see stc_firewall_rule_get_dst_port_type() - */ -int stc_firewall_rule_set_dst_port_type(stc_firewall_rule_h rule_h, - stc_firewall_port_type_e type); - -/** - * @brief Sets the protocol type to rule. - * @since_tizen 5.0 - * - * @param[in] rule The firewall rule handle - * @param[in] type The protocol type - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_rule_h - * @see stc_firewall_rule_create() - * @see stc_firewall_rule_destroy() - * @see stc_firewall_rule_get_protocol_type() - */ -int stc_firewall_rule_set_protocol_type(stc_firewall_rule_h rule_h, - stc_firewall_protocol_type_e type); - -/** - * @brief Sets the address family type to rule. - * @since_tizen 5.0 - * - * @param[in] rule The firewall rule handle - * @param[in] type The address family type - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_rule_h - * @see stc_firewall_rule_create() - * @see stc_firewall_rule_destroy() - * @see stc_firewall_rule_get_family_type() - */ -int stc_firewall_rule_set_family_type(stc_firewall_rule_h rule_h, - stc_firewall_family_type_e type); - -/** - * @brief Sets source IP addresses to rule. - * @since_tizen 5.0 - * - * @param[in] rule The firewall rule handle - * @param[in] ip1 The address 1 - * @param[in] ip2 The address 2 which will be IP address or mask - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_rule_h - * @see stc_firewall_rule_create() - * @see stc_firewall_rule_destroy() - * @see stc_firewall_rule_set_src_ip_type() - * @see stc_firewall_rule_get_src_ip() - */ -int stc_firewall_rule_set_src_ip(stc_firewall_rule_h rule_h, - char *ip1, char *ip2); - -/** - * @brief Sets destination IP addresses to rule. - * @since_tizen 5.0 - * - * @param[in] rule The firewall rule handle - * @param[in] ip1 The address 1 - * @param[in] ip2 The address 2 which will be IP address or mask - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_rule_h - * @see stc_firewall_rule_create() - * @see stc_firewall_rule_destroy() - * @see stc_firewall_rule_set_dst_ip_type() - * @see stc_firewall_rule_get_dst_ip() - */ -int stc_firewall_rule_set_dst_ip(stc_firewall_rule_h rule_h, - char *ip1, char *ip2); - -/** - * @brief Sets source ports to rule. - * @since_tizen 5.0 - * - * @param[in] rule The firewall rule handle - * @param[in] port1 The port 1 - * @param[in] port2 The port 2 - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_rule_h - * @see stc_firewall_rule_create() - * @see stc_firewall_rule_destroy() - * @see stc_firewall_rule_set_src_port_type() - * @see stc_firewall_rule_get_src_port() - */ -int stc_firewall_rule_set_src_port(stc_firewall_rule_h rule_h, - unsigned int port1, unsigned int port2); - -/** - * @brief Sets destination ports to rule. - * @since_tizen 5.0 - * - * @param[in] rule The firewall rule handle - * @param[in] port1 The port 1 - * @param[in] port2 The port 2 - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_rule_h - * @see stc_firewall_rule_create() - * @see stc_firewall_rule_destroy() - * @see stc_firewall_rule_set_dst_port_type() - * @see stc_firewall_rule_get_dst_port() - */ -int stc_firewall_rule_set_dst_port(stc_firewall_rule_h rule_h, - unsigned int port1, unsigned int port2); - -/** - * @brief Sets interface name to rule. - * @since_tizen 5.0 - * - * @param[in] rule The firewall rule handle - * @param[in] ifname The interface name - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_rule_h - * @see stc_firewall_rule_create() - * @see stc_firewall_rule_destroy() - * @see stc_firewall_rule_get_ifname() - */ -int stc_firewall_rule_set_ifname(stc_firewall_rule_h rule_h, char *ifname); - -/** - * @brief Sets target type to rule. - * @since_tizen 5.0 - * - * @param[in] rule The firewall rule handle - * @param[in] target The target type - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_rule_h - * @see stc_firewall_rule_create() - * @see stc_firewall_rule_destroy() - * @see stc_firewall_rule_get_target() - */ -int stc_firewall_rule_set_target(stc_firewall_rule_h rule_h, - stc_firewall_rule_target_e target); - -/** - * @brief Sets log level to rule. - * @since_tizen 5.0 - * - * @param[in] rule The firewall rule handle - * @param[in] level The level - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_rule_h - * @see stc_firewall_rule_create() - * @see stc_firewall_rule_destroy() - * @see stc_firewall_rule_get_log_level() - */ -int stc_firewall_rule_set_log_level(stc_firewall_rule_h rule_h, - unsigned char level); - -/** - * @brief Sets log prefix to rule. - * @since_tizen 5.0 - * - * @param[in] rule The firewall rule handle - * @param[in] prefix The prefix - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_rule_h - * @see stc_firewall_rule_create() - * @see stc_firewall_rule_destroy() - * @see stc_firewall_rule_get_log_prefix() - */ -int stc_firewall_rule_set_log_prefix(stc_firewall_rule_h rule_h, - char *prefix); - -/** - * @brief Sets nflog group to rule. - * @since_tizen 5.0 - * - * @param[in] rule The firewall rule handle - * @param[in] group The group - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_rule_h - * @see stc_firewall_rule_create() - * @see stc_firewall_rule_destroy() - * @see stc_firewall_rule_get_nflog_group() - */ -int stc_firewall_rule_set_nflog_group(stc_firewall_rule_h rule_h, - unsigned int group); - -/** - * @brief Sets nflog prefix to rule. - * @since_tizen 5.0 - * - * @param[in] rule The firewall rule handle - * @param[in] prefix The prefix - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_rule_h - * @see stc_firewall_rule_create() - * @see stc_firewall_rule_destroy() - * @see stc_firewall_rule_get_nflog_prefix() - */ -int stc_firewall_rule_set_nflog_prefix(stc_firewall_rule_h rule_h, - char *prefix); - -/** - * @brief Sets nflog range to rule. - * @since_tizen 5.0 - * - * @param[in] rule The firewall rule handle - * @param[in] range The range - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_rule_h - * @see stc_firewall_rule_create() - * @see stc_firewall_rule_destroy() - * @see stc_firewall_rule_get_nflog_range() - */ -int stc_firewall_rule_set_nflog_range(stc_firewall_rule_h rule_h, - unsigned int range); - -/** - * @brief Sets nflog threshold to rule. - * @since_tizen 5.0 - * - * @param[in] rule The firewall rule handle - * @param[in] threshold The threshold - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_rule_h - * @see stc_firewall_rule_create() - * @see stc_firewall_rule_destroy() - * @see stc_firewall_rule_get_nflog_threshold() - */ -int stc_firewall_rule_set_nflog_threshold(stc_firewall_rule_h rule_h, - unsigned int threshold); - -/** - * @brief Gets the chain name from rule. - * @since_tizen 5.0 - * - * @param[in] rule The firewall rule handle - * @param[out] chain The chain name - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_rule_h - * @see stc_firewall_rule_create() - * @see stc_firewall_rule_destroy() - * @see stc_firewall_rule_set_chain() - */ -int stc_firewall_rule_get_chain(stc_firewall_rule_h rule_h, char **chain); - -/** - * @brief Gets the direction from rule. - * @since_tizen 5.0 - * - * @param[in] rule The firewall rule handle - * @param[out] direction The direction - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_rule_h - * @see stc_firewall_rule_create() - * @see stc_firewall_rule_destroy() - * @see stc_firewall_rule_set_direction() - */ -int stc_firewall_rule_get_direction(stc_firewall_rule_h rule_h, - stc_firewall_direction_e *direction); - -/** - * @brief Gets the source IP type from rule. - * @since_tizen 5.0 - * - * @param[in] rule The firewall rule handle - * @param[out] type The IP type - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_rule_h - * @see stc_firewall_rule_create() - * @see stc_firewall_rule_destroy() - * @see stc_firewall_rule_set_src_ip_type() - */ -int stc_firewall_rule_get_src_ip_type(stc_firewall_rule_h rule_h, - stc_firewall_ip_type_e *type); - -/** - * @brief Gets the destination IP type from rule. - * @since_tizen 5.0 - * - * @param[in] rule The firewall rule handle - * @param[out] type The IP type - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_rule_h - * @see stc_firewall_rule_create() - * @see stc_firewall_rule_destroy() - * @see stc_firewall_rule_set_dst_ip_type() - */ -int stc_firewall_rule_get_dst_ip_type(stc_firewall_rule_h rule_h, - stc_firewall_ip_type_e *type); - -/** - * @brief Gets the source port type from rule. - * @since_tizen 5.0 - * - * @param[in] rule The firewall rule handle - * @param[out] type The port type - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_rule_h - * @see stc_firewall_rule_create() - * @see stc_firewall_rule_destroy() - * @see stc_firewall_rule_set_src_port_type() - */ -int stc_firewall_rule_get_src_port_type(stc_firewall_rule_h rule_h, - stc_firewall_port_type_e *type); - -/** - * @brief Gets the destination port type from rule. - * @since_tizen 5.0 - * - * @param[in] rule The firewall rule handle - * @param[out] type The port type - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_rule_h - * @see stc_firewall_rule_create() - * @see stc_firewall_rule_destroy() - * @see stc_firewall_rule_set_dst_port_type() - */ -int stc_firewall_rule_get_dst_port_type(stc_firewall_rule_h rule_h, - stc_firewall_port_type_e *type); - -/** - * @brief Gets the protocol type from rule. - * @since_tizen 5.0 - * - * @param[in] rule The firewall rule handle - * @param[out] type The protocol type - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_rule_h - * @see stc_firewall_rule_create() - * @see stc_firewall_rule_destroy() - * @see stc_firewall_rule_set_protocol_type() - */ -int stc_firewall_rule_get_protocol_type(stc_firewall_rule_h rule_h, - stc_firewall_protocol_type_e *type); - -/** - * @brief Gets the address family type from rule. - * @since_tizen 5.0 - * - * @param[in] rule The firewall rule handle - * @param[out] type The address family type - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_rule_h - * @see stc_firewall_rule_create() - * @see stc_firewall_rule_destroy() - * @see stc_firewall_rule_set_family_type() - */ -int stc_firewall_rule_get_family_type(stc_firewall_rule_h rule_h, - stc_firewall_family_type_e *type); - -/** - * @brief Gets the source IP addresses from rule. - * @since_tizen 5.0 - * - * @param[in] rule The firewall rule handle - * @param[out] ip1 The address 1 - * @param[out] ip2 The address 2 which will be IP address or mask - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_rule_h - * @see stc_firewall_rule_create() - * @see stc_firewall_rule_destroy() - * @see stc_firewall_rule_get_src_ip_type() - * @see stc_firewall_rule_set_src_ip() - */ -int stc_firewall_rule_get_src_ip(stc_firewall_rule_h rule_h, - char **ip1, char **ip2); - -/** - * @brief Gets the destination IP addresses from rule. - * @since_tizen 5.0 - * - * @param[in] rule The firewall rule handle - * @param[out] ip1 The address 1 - * @param[out] ip2 The address 2 which will be IP address or mask - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_rule_h - * @see stc_firewall_rule_create() - * @see stc_firewall_rule_destroy() - * @see stc_firewall_rule_get_dst_ip_type() - * @see stc_firewall_rule_set_dst_ip() - */ -int stc_firewall_rule_get_dst_ip(stc_firewall_rule_h rule_h, - char **ip1, char **ip2); - -/** - * @brief Gets the source ports from rule. - * @since_tizen 5.0 - * - * @param[in] rule The firewall rule handle - * @param[out] port1 The port 1 - * @param[out] port2 The port 2 - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_rule_h - * @see stc_firewall_rule_create() - * @see stc_firewall_rule_destroy() - * @see stc_firewall_rule_get_src_port_type() - * @see stc_firewall_rule_set_src_port() - */ -int stc_firewall_rule_get_src_port(stc_firewall_rule_h rule_h, - unsigned int *port1, unsigned int *port2); - -/** - * @brief Gets the destination ports from rule. - * @since_tizen 5.0 - * - * @param[in] rule The firewall rule handle - * @param[out] port1 The port 1 - * @param[out] port2 The port 2 - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_rule_h - * @see stc_firewall_rule_create() - * @see stc_firewall_rule_destroy() - * @see stc_firewall_rule_get_dst_port_type() - * @see stc_firewall_rule_set_dst_port() - */ -int stc_firewall_rule_get_dst_port(stc_firewall_rule_h rule_h, - unsigned int *port1, unsigned int *port2); - -/** - * @brief Gets the interface name from rule. - * @since_tizen 5.0 - * - * @param[in] rule The firewall rule handle - * @param[out] ifname The interface name - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_rule_h - * @see stc_firewall_rule_create() - * @see stc_firewall_rule_destroy() - * @see stc_firewall_rule_set_ifname() - */ -int stc_firewall_rule_get_ifname(stc_firewall_rule_h rule_h, char **ifname); - -/** - * @brief Gets the target type from rule. - * @since_tizen 5.0 - * - * @param[in] rule The firewall rule handle - * @param[out] target The target type - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_rule_h - * @see stc_firewall_rule_create() - * @see stc_firewall_rule_destroy() - * @see stc_firewall_rule_set_target() - */ -int stc_firewall_rule_get_target(stc_firewall_rule_h rule_h, - stc_firewall_rule_target_e *target); - -/** - * @brief Gets log level from rule. - * @since_tizen 5.0 - * - * @param[in] rule The firewall rule handle - * @param[out] level The level - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_rule_h - * @see stc_firewall_rule_create() - * @see stc_firewall_rule_destroy() - * @see stc_firewall_rule_set_log_level() - */ -int stc_firewall_rule_get_log_level(stc_firewall_rule_h rule_h, - unsigned char *level); - -int stc_firewall_rule_get_log_prefix(stc_firewall_rule_h rule_h, - char **prefix); - -/** - * @brief Gets nflog group from rule. - * @since_tizen 5.0 - * - * @param[in] rule The firewall rule handle - * @param[out] group The group - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_rule_h - * @see stc_firewall_rule_create() - * @see stc_firewall_rule_destroy() - * @see stc_firewall_rule_set_nflog_group() - */ -int stc_firewall_rule_get_nflog_group(stc_firewall_rule_h rule_h, - unsigned int *group); - -int stc_firewall_rule_get_nflog_prefix(stc_firewall_rule_h rule_h, - char **prefix); - -int stc_firewall_rule_get_nflog_range(stc_firewall_rule_h rule_h, - unsigned int *range); - -int stc_firewall_rule_get_nflog_threshold(stc_firewall_rule_h rule_h, - unsigned int *threshold); - -/** - * @brief Adds the rule. - * @since_tizen 5.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/firewall.common - * - * @param[in] rule The firewall rule handle - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_rule_h - * @see stc_firewall_rule_create() - * @see stc_firewall_rule_destroy() - */ -int stc_firewall_rule_add(stc_firewall_rule_h rule_h); - -/** - * @brief Removes the rule. - * @since_tizen 5.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/firewall.common - * - * @param[in] rule The firewall rule handle - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_rule_h - * @see stc_firewall_rule_create() - * @see stc_firewall_rule_destroy() - */ -int stc_firewall_rule_remove(stc_firewall_rule_h rule_h); - -/** - * @brief Updates the rule. - * @since_tizen 5.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/firewall.common - * - * @param[in] rule The firewall rule handle - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_rule_h - * @see stc_firewall_rule_create() - * @see stc_firewall_rule_destroy() - */ -int stc_firewall_rule_update(stc_firewall_rule_h rule_h); - -/** - * @brief Gets all rules. - * @since_tizen 5.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/firewall.common - * - * @param[in] stc The stc handle - * @param[in] callback The callback to be called - * @param[in] user_data The user data passed to the callback function - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see #stc_firewall_rule_h - * @see stc_firewall_rule_create() - * @see stc_firewall_rule_destroy() - */ -int stc_firewall_rule_foreach(stc_h stc, - stc_firewall_rule_info_cb callback, void *user_data); - -/** -* @} -*/ - -/** - * @addtogroup CAPI_NETWORK_STC_IPTABLES_MODULE - * @{ - */ - -/** - * @brief Commits iptables rule. - * @since_tizen 5.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/firewall.common - * @remarks You must release @a err_str using free(). - * - * @param[in] stc The stc handle - * @param[in] option The option of iptables rule - * @param[out] err_num The error number - * @param[out] err_str The error string - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see stc_initialize() - */ -int stc_iptables_commit(stc_h stc, const char *option, - int *err_num, char **err_str); - -/** - * @brief Commits ip6tables rule. - * @since_tizen 5.0 - * @privlevel platform - * @privilege %http://tizen.org/privilege/firewall.common - * @remarks You must release @a err_str using free(). - * - * @param[in] stc The stc handle - * @param[in] option The option of iptables rule - * @param[out] err_num The error number - * @param[out] err_str The error string - * - * @return 0 on success, otherwise a negative error value - * @retval #STC_ERROR_NONE Successful - * @retval #STC_ERROR_OPERATION_FAILED General error - * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #STC_ERROR_INVALID_OPERATION Invalid operation - * @retval #STC_ERROR_NOT_INITIALIZED Not initialized - * @retval #STC_ERROR_NOT_SUPPORTED Not supported - * @retval #STC_ERROR_PERMISSION_DENIED Permission denied - * - * @see stc_initialize() - */ -int stc_ip6tables_commit(stc_h stc, const char *option, - int *err_num, char **err_str); - -/** -* @} -*/ - #ifdef __cplusplus } #endif diff --git a/include/stc_ipt_internal.h b/include/stc_ipt_internal.h index 612afa0..3682dda 100755 --- a/include/stc_ipt_internal.h +++ b/include/stc_ipt_internal.h @@ -24,9 +24,16 @@ extern "C" { #endif +/** + * @file stc_internal.h + */ + /***************************************************************************** * Standard headers *****************************************************************************/ +#include +#include +#include /***************************************************************************** * Macros and Typedefs @@ -44,6 +51,69 @@ extern "C" { * Core API functions *****************************************************************************/ +/** + * @addtogroup CAPI_NETWORK_STC_IPTABLES_MODULE + * @{ + */ + +/** + * @brief Commits iptables rule. + * @since_tizen 5.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/firewall.common + * @remarks You must release @a err_str using free(). + * + * @param[in] stc The stc handle + * @param[in] option The option of iptables rule + * @param[out] err_num The error number + * @param[out] err_str The error string + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see stc_initialize() + */ +int stc_iptables_commit(stc_h stc, const char *option, + int *err_num, char **err_str); + +/** + * @brief Commits ip6tables rule. + * @since_tizen 5.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/firewall.common + * @remarks You must release @a err_str using free(). + * + * @param[in] stc The stc handle + * @param[in] option The option of iptables rule + * @param[out] err_num The error number + * @param[out] err_str The error string + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see stc_initialize() + */ +int stc_ip6tables_commit(stc_h stc, const char *option, + int *err_num, char **err_str); + +/** +* @} +*/ + #ifdef __cplusplus } #endif diff --git a/include/stc_mgr_internal.h b/include/stc_mgr_internal.h index 7e8a488..618d1a2 100755 --- a/include/stc_mgr_internal.h +++ b/include/stc_mgr_internal.h @@ -24,9 +24,22 @@ extern "C" { #endif +/** + * @file stc_internal.h + */ + /***************************************************************************** * Standard headers *****************************************************************************/ +#include +#include +#include + +/***************************************************************************** + * Smart Traffic Control (STC) library headers + *****************************************************************************/ +#include "stc_stat_internal.h" +#include "stc_rstn_internal.h" /***************************************************************************** * Macros and Typedefs @@ -40,10 +53,351 @@ extern "C" { * Callback functions *****************************************************************************/ +/** + * @addtogroup CAPI_NETWORK_STC_MANAGER_MODULE + * @{ + */ + +/** + * @brief Called for enumerate restriction rule. + * @since_tizen 5.0 + * + * @param[in] result The result + * @param[in] rule The restriction rule handle + * @param[in] user_data The user data passed from the callback registration function + * @return @c STC_CALLBACK_CONTINUE to continue with the next iteration of the loop, + * otherwise @c STC_CALLBACK_CANCEL to break out of the loop + * + * @pre stc_get_restriction() will invoke this callback. + * @pre stc_foreach_restriction() will invoke this callback. + * @see stc_restriction_rule_get_app_id() + * @see stc_restriction_rule_get_iface_name() + * @see stc_restriction_rule_get_subscriber_id() + * @see stc_restriction_rule_get_type() + * @see stc_restriction_rule_get_iface_type() + * @see stc_restriction_rule_get_limit() + * @see stc_restriction_rule_get_warning_limit() + * @see stc_restriction_rule_get_monthly_limit() + * @see stc_restriction_rule_get_weekly_limit() + * @see stc_restriction_rule_get_daily_limit() + * @see stc_restriction_rule_get_month_start_date() + * @see stc_restriction_rule_get_roaming_type() + * @see stc_get_restriction() + * @see stc_foreach_restriction() + */ +typedef stc_callback_ret_e (*stc_restriction_rule_cb)(stc_error_e result, + stc_restriction_rule_h rule, void *user_data); + +typedef void (*stc_threshold_crossed_cb)(stc_restriction_rule_h rule, + void *user_data); + +/** +* @} +*/ + /***************************************************************************** * Core API functions *****************************************************************************/ +/** + * @addtogroup CAPI_NETWORK_STC_MANAGER_MODULE + * @{ + */ + +/** + * @brief Resets stats information. + * @since_tizen 4.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] stc The stc handle + * @param[in] rule The reset rule handle + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_h + * @see #stc_reset_rule_h + * @see stc_initialize() + * @see stc_reset_rule_create() + * @see stc_reset_rule_destroy() + * @see stc_reset_rule_set_app_id() + * @see stc_reset_rule_set_subscriber_id() + * @see stc_reset_rule_set_iface_type() + * @see stc_reset_rule_set_time_interval() + * @see stc_reset_rule_get_app_id() + * @see stc_reset_rule_get_subscriber_id() + * @see stc_reset_rule_get_iface_type() + * @see stc_reset_rule_get_time_interval() + */ +int stc_reset_stats(stc_h stc, stc_reset_rule_h rule); + + +/** + * @brief Sets the restriction for application. + * @details Sets and applies restriction for application. + * It will creates new restriction or modify existing. + * @since_tizen 4.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] stc The stc handle + * @param[in] rule The restriction rule handle + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_h + * @see #stc_restriction_rule_h + * @see stc_initialize() + * @see stc_restriction_rule_create() + * @see stc_restriction_rule_destroy() + * @see stc_restriction_rule_set_app_id() + * @see stc_restriction_rule_set_iface_name() + * @see stc_restriction_rule_set_iface_type() + * @see stc_restriction_rule_set_limit() + * @see stc_restriction_rule_set_warning_limit() + * @see stc_restriction_rule_set_roaming_type() + * @see stc_restriction_rule_set_subscriber_id() + * @see stc_restriction_rule_get_app_id() + * @see stc_restriction_rule_get_iface_type() + * @see stc_restriction_rule_get_limit() + * @see stc_restriction_rule_get_warning_limit() + * @see stc_restriction_rule_get_roaming_type() + * @see stc_restriction_rule_get_subscriber_id() + * @see stc_restriction_rule_get_process_state() + * @see stc_get_restriction() + * @see stc_foreach_restriction() + * @see stc_get_restriction_type() + * @see stc_unset_restriction() + */ +int stc_set_restriction(stc_h stc, stc_restriction_rule_h rule); + +/** + * @brief Unsets the existing restriction for application. + * @details Unsets the existing restriction for application. + * It will delete restriction rule in kernel. + * @since_tizen 4.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] stc The stc handle + * @param[in] rule The restriction rule handle + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_h + * @see #stc_restriction_rule_h + * @see stc_initialize() + * @see stc_restriction_rule_create() + * @see stc_restriction_rule_destroy() + * @see stc_restriction_rule_set_app_id() + * @see stc_restriction_rule_set_iface_name() + * @see stc_restriction_rule_set_iface_type() + * @see stc_restriction_rule_set_limit() + * @see stc_restriction_rule_set_warning_limit() + * @see stc_restriction_rule_set_roaming_type() + * @see stc_restriction_rule_set_subscriber_id() + * @see stc_restriction_rule_get_app_id() + * @see stc_restriction_rule_get_iface_type() + * @see stc_restriction_rule_get_limit() + * @see stc_restriction_rule_get_warning_limit() + * @see stc_restriction_rule_get_roaming_type() + * @see stc_restriction_rule_get_subscriber_id() + * @see stc_restriction_rule_get_process_state() + * @see stc_set_restriction() + * @see stc_get_restriction() + * @see stc_foreach_restriction() + * @see stc_get_restriction_type() + */ +int stc_unset_restriction(stc_h stc, stc_restriction_rule_h rule); + +/** + * @brief Gets the restriction rule per application. + * @details The callback is called for each application that applied restriction. + * @since_tizen 4.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] stc The stc handle + * @param[in] rule The restriction rule handle + * @param[in] rule_cb The callback is called for each application + * that applied restriction in interface specified + * @param[in] user_data User data will be passed to the callback function + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_h + * @see #stc_restriction_rule_h + * @see stc_initialize() + * @see stc_restriction_rule_create() + * @see stc_restriction_rule_destroy() + * @see stc_restriction_rule_set_app_id() + * @see stc_restriction_rule_set_iface_name() + * @see stc_restriction_rule_set_iface_type() + * @see stc_restriction_rule_set_limit() + * @see stc_restriction_rule_set_warning_limit() + * @see stc_restriction_rule_set_roaming_type() + * @see stc_restriction_rule_set_subscriber_id() + * @see stc_restriction_rule_get_app_id() + * @see stc_restriction_rule_get_iface_type() + * @see stc_restriction_rule_get_limit() + * @see stc_restriction_rule_get_warning_limit() + * @see stc_restriction_rule_get_roaming_type() + * @see stc_restriction_rule_get_subscriber_id() + * @see stc_restriction_rule_get_process_state() + * @see stc_restriction_rule_cb() + * @see stc_set_restriction() + * @see stc_foreach_restriction() + * @see stc_get_restriction_type() + * @see stc_unset_restriction() + */ +int stc_get_restriction(stc_h stc, stc_restriction_rule_h rule, + stc_restriction_rule_cb rule_cb, void *user_data); + +int stc_set_restriction_threshold_crossed_cb(stc_h stc, + stc_threshold_crossed_cb crossed_cb, void *user_data); + +int stc_unset_restriction_threshold_crossed_cb(stc_h stc); + +int stc_set_warn_threshold_crossed_cb(stc_h stc, + stc_threshold_crossed_cb crossed_cb, void *user_data); + +int stc_unset_warn_threshold_crossed_cb(stc_h stc); + +/** + * @brief Gets the restriction rule of all application. + * @details The callback is called for each application that applied restriction. + * @since_tizen 4.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] stc The stc handle + * @param[in] rule The restriction rule handle + * @param[in] rule_cb The callback is called for each application + * that applied restriction in interface specified + * @param[in] user_data User data will be passed to the callback function + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_h + * @see #stc_restriction_rule_h + * @see stc_initialize() + * @see stc_restriction_rule_create() + * @see stc_restriction_rule_destroy() + * @see stc_restriction_rule_set_app_id() + * @see stc_restriction_rule_set_iface_name() + * @see stc_restriction_rule_set_iface_type() + * @see stc_restriction_rule_set_limit() + * @see stc_restriction_rule_set_warning_limit() + * @see stc_restriction_rule_set_roaming_type() + * @see stc_restriction_rule_set_subscriber_id() + * @see stc_restriction_rule_get_app_id() + * @see stc_restriction_rule_get_iface_type() + * @see stc_restriction_rule_get_limit() + * @see stc_restriction_rule_get_warning_limit() + * @see stc_restriction_rule_get_roaming_type() + * @see stc_restriction_rule_get_subscriber_id() + * @see stc_restriction_rule_get_process_state() + * @see stc_restriction_rule_cb() + * @see stc_set_restriction() + * @see stc_get_restriction() + * @see stc_get_restriction_type() + * @see stc_unset_restriction() + */ +int stc_foreach_restriction(stc_h stc, stc_restriction_rule_h rule, + stc_restriction_rule_cb rule_cb, void *user_data); + +/** + * @brief Gets the restriction type. + * @since_tizen 4.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] stc The stc handle + * @param[in] rule The restriction rule handle + * @param[out] type The restriction type + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_h + * @see #stc_restriction_rule_h + * @see #stc_restriction_type_e + * @see stc_initialize() + * @see stc_restriction_rule_create() + * @see stc_restriction_rule_destroy() + * @see stc_restriction_rule_set_app_id() + * @see stc_restriction_rule_set_iface_name() + * @see stc_restriction_rule_set_iface_type() + * @see stc_restriction_rule_set_limit() + * @see stc_restriction_rule_set_warning_limit() + * @see stc_restriction_rule_set_roaming_type() + * @see stc_restriction_rule_set_subscriber_id() + * @see stc_restriction_rule_get_app_id() + * @see stc_restriction_rule_get_iface_type() + * @see stc_restriction_rule_get_limit() + * @see stc_restriction_rule_get_warning_limit() + * @see stc_restriction_rule_get_roaming_type() + * @see stc_restriction_rule_get_subscriber_id() + * @see stc_restriction_rule_get_process_state() + * @see stc_set_restriction() + * @see stc_get_restriction() + * @see stc_foreach_restriction() + * @see stc_unset_restriction() + */ +int stc_get_restriction_type(stc_h stc, stc_restriction_rule_h rule, + stc_restriction_type_e *type); + +/** +* @} +*/ + #ifdef __cplusplus } #endif diff --git a/include/stc_rstn_internal.h b/include/stc_rstn_internal.h index 77ffa5f..b166614 100755 --- a/include/stc_rstn_internal.h +++ b/include/stc_rstn_internal.h @@ -24,18 +24,60 @@ extern "C" { #endif +/** + * @file stc_internal.h + */ + /***************************************************************************** * Standard headers *****************************************************************************/ +#include +#include +#include /***************************************************************************** * Macros and Typedefs *****************************************************************************/ +/** + * @addtogroup CAPI_NETWORK_STC_RESTRICTION_MODULE + * @{ + */ + +/** + * @brief The restriction rule handle. + * @since_tizen 4.0 + */ +typedef void *stc_restriction_rule_h; + +/** +* @} +*/ + /***************************************************************************** * Enumeration *****************************************************************************/ +/** + * @addtogroup CAPI_NETWORK_STC_RESTRICTION_MODULE + * @{ + */ + +/** + * @brief Enumeration for network restriction type. + * @since_tizen 5.0 + */ +typedef enum { + STC_RSTN_TYPE_UNKNOWN, + STC_RSTN_TYPE_ACCEPT, + STC_RSTN_TYPE_DROP, + STC_RSTN_TYPE_LAST_ELEM, +} stc_restriction_type_e; + +/** +* @} +*/ + /***************************************************************************** * Callback functions *****************************************************************************/ @@ -44,6 +86,718 @@ extern "C" { * Core API functions *****************************************************************************/ +/** + * @addtogroup CAPI_NETWORK_STC_RESTRICTION_MODULE + * @{ + */ + +/** + * @brief Creates the restriction rule handle. + * @since_tizen 4.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * @remarks You must release @a handle using stc_restriction_rule_destroy(). + * + * @param[in] stc The stc handle + * @param[out] rule The restriction rule handle + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_h + * @see #stc_restriction_rule_h + * @see stc_initialize() + * @see stc_restriction_rule_destroy() + */ +int stc_restriction_rule_create(stc_h stc, stc_restriction_rule_h *rule); + +/** + * @brief Destroys the restriction rule handle. + * @since_tizen 4.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] rule The restriction rule handle + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_restriction_rule_h + * @see stc_restriction_rule_create() + */ +int stc_restriction_rule_destroy(stc_restriction_rule_h rule); + +/** + * @brief Sets the application ID for restriction rule. + * @since_tizen 4.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] rule The restriction rule handle + * @param[in] app_id The application ID + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_restriction_rule_h + * @see stc_restriction_rule_create() + * @see stc_restriction_rule_destroy() + * @see stc_restriction_rule_get_app_id() + */ +int stc_restriction_rule_set_app_id(stc_restriction_rule_h rule, + const char *app_id); + +/** + * @brief Sets the interface name for restriction rule. + * @since_tizen 4.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] rule The restriction rule handle + * @param[in] iface_name The interface name + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_restriction_rule_h + * @see #stc_iface_type_e + * @see stc_restriction_rule_create() + * @see stc_restriction_rule_destroy() + * @see stc_restriction_rule_get_iface_name() + */ +int stc_restriction_rule_set_iface_name( stc_restriction_rule_h rule, + const char *iface_name); + +/** + * @brief Sets the interface type for restriction rule. + * @since_tizen 4.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] rule The restriction rule handle + * @param[in] iface_type The interface type + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_restriction_rule_h + * @see #stc_iface_type_e + * @see stc_restriction_rule_create() + * @see stc_restriction_rule_destroy() + * @see stc_restriction_rule_get_iface_type() + */ +int stc_restriction_rule_set_iface_type(stc_restriction_rule_h rule, + stc_iface_type_e iface_type); + +/** + * @brief Sets the type for restriction rule. + * @since_tizen 5.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] rule The restriction rule handle + * @param[in] type The restriction type + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_restriction_rule_h + * @see #stc_restriction_type_e + * @see stc_restriction_rule_create() + * @see stc_restriction_rule_destroy() + * @see stc_restriction_rule_get_type() + */ +int stc_restriction_rule_set_type(stc_restriction_rule_h rule, + stc_restriction_type_e type); + +/** + * @brief Sets the limit for restriction rule. + * @since_tizen 4.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] rule The restriction rule handle + * @param[in] data_limit The data limit + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_restriction_rule_h + * @see stc_restriction_rule_create() + * @see stc_restriction_rule_destroy() + * @see stc_restriction_rule_get_limit() + */ +int stc_restriction_rule_set_limit(stc_restriction_rule_h rule, + int64_t data_limit); + +/** + * @brief Sets the warning limit for restriction rule. + * @since_tizen 4.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] rule The restriction rule handle + * @param[in] data_warn_limit The data warning limit + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_restriction_rule_h + * @see stc_restriction_rule_create() + * @see stc_restriction_rule_destroy() + * @see stc_restriction_rule_get_warning_limit() + */ +int stc_restriction_rule_set_warning_limit(stc_restriction_rule_h rule, + int64_t data_warn_limit); + +/** + * @brief Sets the monthly data limit for restriction rule. + * @since_tizen 5.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] rule The restriction rule handle + * @param[in] limit The data limit + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_restriction_rule_h + * @see stc_restriction_rule_create() + * @see stc_restriction_rule_destroy() + * @see stc_restriction_rule_get_monthly_limit() + */ +int stc_restriction_rule_set_monthly_limit(stc_restriction_rule_h rule, + int64_t limit); + +/** + * @brief Sets the weekly data limit for restriction rule. + * @since_tizen 5.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] rule The restriction rule handle + * @param[in] limit The data limit + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_restriction_rule_h + * @see stc_restriction_rule_create() + * @see stc_restriction_rule_destroy() + * @see stc_restriction_rule_get_weekly_limit() + */ +int stc_restriction_rule_set_weekly_limit(stc_restriction_rule_h rule, + int64_t limit); + +/** + * @brief Sets the daily data limit for restriction rule. + * @since_tizen 5.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] rule The restriction rule handle + * @param[in] limit The data limit + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_restriction_rule_h + * @see stc_restriction_rule_create() + * @see stc_restriction_rule_destroy() + * @see stc_restriction_rule_get_daily_limit() + */ +int stc_restriction_rule_set_daily_limit(stc_restriction_rule_h rule, + int64_t limit); + +/** + * @brief Sets the month start date for restriction rule. + * @since_tizen 5.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] rule The restriction rule handle + * @param[in] month_start_date The month start date + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_restriction_rule_h + * @see stc_restriction_rule_create() + * @see stc_restriction_rule_destroy() + * @see stc_restriction_rule_get_month_start_date() + */ +int stc_restriction_rule_set_month_start_date(stc_restriction_rule_h rule, + int month_start_date); + +/** + * @brief Sets the roaming type for restriction rule. + * @since_tizen 4.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] rule The restriction rule handle + * @param[in] roaming_type The roaming type + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_restriction_rule_h + * @see #stc_roaming_type_e + * @see stc_restriction_rule_create() + * @see stc_restriction_rule_destroy() + * @see stc_restriction_rule_get_roaming_type() + */ +int stc_restriction_rule_set_roaming_type(stc_restriction_rule_h rule, + stc_roaming_type_e roaming_type); + +/** + * @brief Sets the subscriber ID for restriction rule. + * @since_tizen 4.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] rule The restriction rule handle + * @param[in] subscriber_id The subscriber ID + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_restriction_rule_h + * @see stc_restriction_rule_create() + * @see stc_restriction_rule_destroy() + * @see stc_restriction_rule_get_subscriber_id() + */ +int stc_restriction_rule_set_subscriber_id(stc_restriction_rule_h rule, const char *subscriber_id); + +/** + * @brief Gets the application ID for restriction rule. + * @since_tizen 4.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] rule The restriction rule handle + * @param[out] app_id The application ID + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_restriction_rule_h + * @see stc_restriction_rule_create() + * @see stc_restriction_rule_destroy() + * @see stc_restriction_rule_set_app_id() + */ +int stc_restriction_rule_get_app_id(stc_restriction_rule_h rule, char **app_id); + +/** + * @brief Gets the interface name for restriction rule. + * @since_tizen 4.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] rule The restriction rule handle + * @param[out] iface_name The interface name + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_restriction_rule_h + * @see #stc_iface_type_e + * @see stc_restriction_rule_create() + * @see stc_restriction_rule_destroy() + * @see stc_restriction_rule_set_iface_name() + */ +int stc_restriction_rule_get_iface_name(stc_restriction_rule_h rule, + char **iface_name); + +/** + * @brief Gets the interface type for restriction rule. + * @since_tizen 4.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] rule The restriction rule handle + * @param[out] iface_type The interface type + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_restriction_rule_h + * @see #stc_iface_type_e + * @see stc_restriction_rule_create() + * @see stc_restriction_rule_destroy() + * @see stc_restriction_rule_set_iface_type() + */ +int stc_restriction_rule_get_iface_type(stc_restriction_rule_h rule, + stc_iface_type_e *iface_type); + +/** + * @brief Gets the type for restriction rule. + * @since_tizen 5.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] rule The restriction rule handle + * @param[out] type The restriction type + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_restriction_rule_h + * @see #stc_restriction_type_e + * @see stc_restriction_rule_create() + * @see stc_restriction_rule_destroy() + * @see stc_restriction_rule_set_type() + */ +int stc_restriction_rule_get_type(stc_restriction_rule_h rule, + stc_restriction_type_e *type); + +/** + * @brief Gets the limit for restriction rule. + * @since_tizen 4.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] rule The restriction rule handle + * @param[out] data_limit The data limit + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_restriction_rule_h + * @see stc_restriction_rule_create() + * @see stc_restriction_rule_destroy() + * @see stc_restriction_rule_set_limit() + */ +int stc_restriction_rule_get_limit(stc_restriction_rule_h rule, + int64_t *data_limit); + +/** + * @brief Gets the warning limit for restriction rule. + * @since_tizen 4.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] rule The restriction rule handle + * @param[out] data_warn_limit The data warning limit + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_restriction_rule_h + * @see stc_restriction_rule_create() + * @see stc_restriction_rule_destroy() + * @see stc_restriction_rule_set_warning_limit() + */ +int stc_restriction_rule_get_warning_limit(stc_restriction_rule_h rule, + int64_t *data_warn_limit); + +/** + * @brief Gets the montlhy data limit for restriction rule. + * @since_tizen 5.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] rule The restriction rule handle + * @param[out] limit The data limit + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_restriction_rule_h + * @see stc_restriction_rule_create() + * @see stc_restriction_rule_destroy() + * @see stc_restriction_rule_set_monthly_limit() + */ +int stc_restriction_rule_get_monthly_limit(stc_restriction_rule_h rule, + int64_t *limit); + +/** + * @brief Gets the weekly data limit for restriction rule. + * @since_tizen 5.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] rule The restriction rule handle + * @param[out] limit The data limit + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_restriction_rule_h + * @see stc_restriction_rule_create() + * @see stc_restriction_rule_destroy() + * @see stc_restriction_rule_set_weekly_limit() + */ +int stc_restriction_rule_get_weekly_limit(stc_restriction_rule_h rule, + int64_t *limit); + +/** + * @brief Gets the daily data limit for restriction rule. + * @since_tizen 5.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] rule The restriction rule handle + * @param[out] limit The data limit + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_restriction_rule_h + * @see stc_restriction_rule_create() + * @see stc_restriction_rule_destroy() + * @see stc_restriction_rule_set_daily_limit() + */ +int stc_restriction_rule_get_daily_limit(stc_restriction_rule_h rule, + int64_t *limit); + +/** + * @brief Gets the month start date for restriction rule. + * @since_tizen 5.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] rule The restriction rule handle + * @param[out] month_start_date The month start date + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_restriction_rule_h + * @see stc_restriction_rule_create() + * @see stc_restriction_rule_destroy() + * @see stc_restriction_rule_set_month_start_date() + */ +int stc_restriction_rule_get_month_start_date(stc_restriction_rule_h rule, + int *month_start_date); + +/** + * @brief Gets the roaming type for restriction rule. + * @since_tizen 4.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] rule The restriction rule handle + * @param[out] roaming The roaming type + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_restriction_rule_h + * @see #stc_roaming_type_e + * @see stc_restriction_rule_create() + * @see stc_restriction_rule_destroy() + * @see stc_restriction_rule_set_roaming_type() + */ +int stc_restriction_rule_get_roaming_type(stc_restriction_rule_h rule, + stc_roaming_type_e *roaming_type); + +/** + * @brief Gets the subscriber ID for restriction rule. + * @since_tizen 4.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] rule The restriction rule handle + * @param[out] subscriber_id The subscriber ID + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_restriction_rule_h + * @see stc_restriction_rule_create() + * @see stc_restriction_rule_destroy() + * @see stc_restriction_rule_set_subscriber_id() + */ +int stc_restriction_rule_get_subscriber_id(stc_restriction_rule_h rule, char **subscriber_id); + +/** +* @} +*/ + #ifdef __cplusplus } #endif diff --git a/include/stc_stat_internal.h b/include/stc_stat_internal.h index b662025..943ca46 100755 --- a/include/stc_stat_internal.h +++ b/include/stc_stat_internal.h @@ -24,14 +24,37 @@ extern "C" { #endif +/** + * @file stc_internal.h + */ + /***************************************************************************** * Standard headers *****************************************************************************/ +#include +#include +#include /***************************************************************************** * Macros and Typedefs *****************************************************************************/ +/** + * @addtogroup CAPI_NETWORK_STC_STATISTICS_MODULE + * @{ + */ + +/** + * @brief The reset rule handle. + * @since_tizen 4.0 + */ +typedef void *stc_reset_rule_h; + + +/** +* @} +*/ + /***************************************************************************** * Enumeration *****************************************************************************/ @@ -44,6 +67,304 @@ extern "C" { * Core API functions *****************************************************************************/ +/** + * @addtogroup CAPI_NETWORK_STC_STATISTICS_MODULE + * @{ + */ + +/** + * @brief Creates the reset rule handle. + * @since_tizen 4.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * @remarks You must release @a handle using stc_reset_rule_destroy(). + * + * @param[in] stc The stc handle + * @param[out] rule The reset rule handle + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_h + * @see #stc_reset_rule_h + * @see stc_initialize() + * @see stc_reset_rule_destroy() + */ +int stc_reset_rule_create(stc_h stc, stc_reset_rule_h *rule); + +/** + * @brief Destroys the reset rule handle. + * @since_tizen 4.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] rule The reset rule handle + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_reset_rule_h + * @see stc_reset_rule_create() + */ +int stc_reset_rule_destroy(stc_reset_rule_h rule); + +/** + * @brief Sets the application ID for reset rule. + * @since_tizen 4.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] rule The reset rule handle + * @param[in] app_id The application ID + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_reset_rule_h + * @see stc_reset_rule_create() + * @see stc_reset_rule_destroy() + * @see stc_reset_rule_get_app_id() + */ +int stc_reset_rule_set_app_id(stc_reset_rule_h rule, const char *app_id); + +/** + * @brief Sets the subscriber ID for reset rule. + * @since_tizen 4.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] rule The reset rule handle + * @param[in] subscriber_id The subscriber ID + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_reset_rule_h + * @see stc_reset_rule_create() + * @see stc_reset_rule_destroy() + * @see stc_reset_rule_get_subscriber_id() + */ +int stc_reset_rule_set_subscriber_id(stc_reset_rule_h rule, const char *subscriber_id); + +/** + * @brief Sets the interface type for reset rule. + * @since_tizen 4.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] rule The reset rule handle + * @param[in] iface_type The interface type + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_reset_rule_h + * @see #stc_iface_type_e + * @see stc_reset_rule_create() + * @see stc_reset_rule_destroy() + * @see stc_reset_rule_get_iface_type() + */ +int stc_reset_rule_set_iface_type(stc_reset_rule_h rule, + stc_iface_type_e iface_type); + +/** + * @brief Sets the time interval for reset rule. + * @since_tizen 4.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] rule The reset rule handle + * @param[in] from The time interval from + * @param[in] to The time interval to + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_reset_rule_h + * @see stc_reset_rule_create() + * @see stc_reset_rule_destroy() + * @see stc_reset_rule_get_time_interval() + */ +int stc_reset_rule_set_time_interval(stc_reset_rule_h rule, + time_t from, time_t to); + +/** + * @brief Gets the application ID for reset. + * @since_tizen 4.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] rule The reset rule handle + * @param[out] app_id The application ID + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_reset_rule_h + * @see stc_reset_rule_create() + * @see stc_reset_rule_destroy() + * @see stc_reset_rule_set_app_id() + */ +int stc_reset_rule_get_app_id(stc_reset_rule_h rule, char **app_id); + +/** + * @brief Gets the subscriber ID for reset rule. + * @since_tizen 4.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] rule The reset rule handle + * @param[out] subscriber_id The subscriber ID + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_reset_rule_h + * @see stc_reset_rule_create() + * @see stc_reset_rule_destroy() + * @see stc_reset_rule_set_subscriber_id() + */ +int stc_reset_rule_get_subscriber_id(stc_reset_rule_h rule, char **subscriber_id); + +/** + * @brief Gets the interface type for reset rule. + * @since_tizen 4.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] rule The reset rule handle + * @param[out] iface_type The interface type + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_reset_rule_h + * @see #stc_iface_type_e + * @see stc_reset_rule_create() + * @see stc_reset_rule_destroy() + * @see stc_reset_rule_set_iface_type() + */ +int stc_reset_rule_get_iface_type(stc_reset_rule_h rule, + stc_iface_type_e *iface_type); + +/** + * @brief Gets the time interval for reset rule. + * @since_tizen 4.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] rule The reset rule handle + * @param[out] from The time interval from + * @param[out] to The time interval to + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_reset_rule_h + * @see stc_reset_rule_create() + * @see stc_reset_rule_destroy() + * @see stc_reset_rule_set_time_interval() + */ +int stc_reset_rule_get_time_interval(stc_reset_rule_h rule, + time_t *from, time_t *to); + +/** + * @brief Gets the subscriber ID from statistics information. + * @since_tizen 4.0 + * @remarks You must release @a subscriber ID using free(). + * + * @param[in] info The statistics information handle + * @param[out] subscriber_id The subscriber ID + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see stc_stats_info_h + * @see stc_stats_info_cb() + */ +int stc_stats_info_get_subscriber_id(stc_stats_info_h info, char **subscriber_id); + +/** +* @} +*/ + #ifdef __cplusplus } #endif