Separate source code from internal header
[platform/core/api/smart-traffic-control.git] / include / stc_fw_internal.h
1 /*
2  * Smart Traffic Control (STC)
3  *
4  * Copyright (c) 2017 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 #ifndef __TIZEN_STC_FW_INTERNAL_H__
21 #define __TIZEN_STC_FW_INTERNAL_H__
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 /**
28  * @file stc_fw_internal.h
29  */
30
31 /*****************************************************************************
32  *  Standard headers
33  *****************************************************************************/
34 #include <tizen.h>
35 #include <time.h>
36 #include <inttypes.h>
37
38 /*****************************************************************************
39  *  Macros and Typedefs
40  *****************************************************************************/
41
42 /**
43  * @addtogroup CAPI_NETWORK_STC_FIREWALL_MODULE
44  * @{
45  */
46
47 /**
48  * @brief The firewall chain handle.
49  * @since_tizen 5.0
50  */
51 typedef void *stc_firewall_chain_h;
52
53 /**
54  * @brief The firewall rule handle.
55  * @since_tizen 5.0
56  */
57 typedef void *stc_firewall_rule_h;
58
59 /**
60 * @}
61 */
62
63 /*****************************************************************************
64  *  Enumeration
65  *****************************************************************************/
66
67 /**
68  * @addtogroup CAPI_NETWORK_STC_FIREWALL_MODULE
69  * @{
70  */
71
72 typedef enum {
73         STC_FIREWALL_UNKNOWN,
74         STC_FIREWALL_UNLOCKED,
75         STC_FIREWALL_LOCKED
76 } stc_firewall_lock_e;
77
78 /**
79  * @brief Enumeration for firewall direction.
80  * @since_tizen 5.0
81  */
82 typedef enum {
83         STC_FIREWALL_DIRECTION_NONE,
84         STC_FIREWALL_DIRECTION_IN,
85         STC_FIREWALL_DIRECTION_OUT
86 } stc_firewall_direction_e;
87
88 /**
89  * @brief Enumeration for firewall IP type.
90  * @since_tizen 5.0
91  */
92 typedef enum {
93         STC_FIREWALL_IP_NONE,
94         STC_FIREWALL_IP_SINGLE,
95         STC_FIREWALL_IP_MASK,
96         STC_FIREWALL_IP_RANGE
97 } stc_firewall_ip_type_e;
98
99 /**
100  * @brief Enumeration for firewall port type.
101  * @since_tizen 5.0
102  */
103 typedef enum {
104         STC_FIREWALL_PORT_NONE,
105         STC_FIREWALL_PORT_SINGLE,
106         STC_FIREWALL_PORT_RANGE
107 } stc_firewall_port_type_e;
108
109 /**
110  * @brief Enumeration for firewall protocol type.
111  * @since_tizen 5.0
112  */
113 typedef enum {
114         STC_FIREWALL_PROTOCOL_NONE,
115         STC_FIREWALL_PROTOCOL_TCP,
116         STC_FIREWALL_PROTOCOL_UDP,
117         STC_FIREWALL_PROTOCOL_ICMP,
118         STC_FIREWALL_PROTOCOL_ALL,
119 } stc_firewall_protocol_type_e;
120
121 /**
122  * @brief Enumeration for firewall family type.
123  * @since_tizen 5.0
124  */
125 typedef enum {
126         STC_FIREWALL_FAMILY_NONE,
127         STC_FIREWALL_FAMILY_V4,
128         STC_FIREWALL_FAMILY_V6
129 } stc_firewall_family_type_e;
130
131 /**
132  * @brief Enumeration for firewall chain target.
133  * @since_tizen 5.0
134  */
135 typedef enum {
136         STC_FIREWALL_CHAIN_TARGET_NONE,
137         STC_FIREWALL_CHAIN_TARGET_INPUT,
138         STC_FIREWALL_CHAIN_TARGET_OUTPUT,
139         STC_FIREWALL_CHAIN_TARGET_MAX
140 } stc_firewall_chain_target_e;
141
142 /**
143  * @brief Enumeration for firewall rule target.
144  * @since_tizen 5.0
145  */
146 typedef enum {
147         STC_FIREWALL_RULE_TARGET_NONE,
148         STC_FIREWALL_RULE_TARGET_ACCEPT,
149         STC_FIREWALL_RULE_TARGET_DROP,
150         STC_FIREWALL_RULE_TARGET_LOG,
151         STC_FIREWALL_RULE_TARGET_NFLOG,
152         STC_FIREWALL_RULE_TARGET_MAX,
153 } stc_firewall_rule_target_e;
154
155 /**
156 * @}
157 */
158
159
160 /*****************************************************************************
161  *  Callback functions
162  *****************************************************************************/
163
164 /**
165  * @addtogroup CAPI_NETWORK_STC_FIREWALL_MODULE
166  * @{
167  */
168
169 /**
170  * @brief Called for enumerate firewall chain information.
171  * @since_tizen 5.0
172  *
173  * @param[in] info          The firewall chain handle
174  * @param[in] user_data         The user data passed from the callback firewall chain function
175  * @return      @c STC_CALLBACK_CONTINUE to continue with the next iteration of the loop,
176  *                      otherwise @c STC_CALLBACK_CANCEL to break out of the loop
177  *
178  * @pre stc_firewall_chain_foreach() will invoke this callback.
179  * @see stc_firewall_chain_get_name()
180  * @see stc_firewall_chain_get_target()
181  * @see stc_firewall_chain_get_priority()
182  * @see stc_firewall_chain_foreach()
183  */
184 typedef stc_callback_ret_e (*stc_firewall_chain_info_cb)(stc_firewall_chain_h info_h,
185                         void *user_data);
186
187 /**
188  * @brief Called for enumerate firewall rule information.
189  * @since_tizen 5.0
190  *
191  * @param[in] info          The firewall rule handle
192  * @param[in] user_data         The user data passed from the callback firewall rule function
193  * @return      @c STC_CALLBACK_CONTINUE to continue with the next iteration of the loop,
194  *                      otherwise @c STC_CALLBACK_CANCEL to break out of the loop
195  *
196  * @pre stc_firewall_rule_foreach() will invoke this callback.
197  * @see stc_firewall_rule_get_chain()
198  * @see stc_firewall_rule_get_direction()
199  * @see stc_firewall_rule_get_src_ip_type()
200  * @see stc_firewall_rule_get_dst_ip_type()
201  * @see stc_firewall_rule_get_src_port_type()
202  * @see stc_firewall_rule_get_dst_port_type()
203  * @see stc_firewall_rule_get_protocol_type()
204  * @see stc_firewall_rule_get_family_type()
205  * @see stc_firewall_rule_get_src_ip()
206  * @see stc_firewall_rule_get_dst_ip()
207  * @see stc_firewall_rule_get_src_port()
208  * @see stc_firewall_rule_get_dst_port()
209  * @see stc_firewall_rule_get_ifname()
210  * @see stc_firewall_rule_get_target()
211  * @see stc_firewall_rule_foreach()
212  */
213 typedef stc_callback_ret_e (*stc_firewall_rule_info_cb)(stc_firewall_rule_h info,
214                         void *user_data);
215
216 /**
217 * @}
218 */
219
220 /*****************************************************************************
221  *  Core API functions
222  *****************************************************************************/
223
224 /**
225  * @addtogroup CAPI_NETWORK_STC_FIREWALL_MODULE
226  * @{
227  */
228
229 /**
230  * @brief Locks the firewall.
231  * @since_tizen 5.0
232  * @privlevel platform
233  * @privilege %http://tizen.org/privilege/firewall.admin
234  *
235  * @param[in] stc        The stc handle
236  *
237  * @return 0 on success, otherwise a negative error value
238  * @retval #STC_ERROR_NONE Successful
239  * @retval #STC_ERROR_OPERATION_FAILED General error
240  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
241  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
242  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
243  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
244  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
245  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
246  *
247  * @see #stc_h
248  * @see stc_initialize()
249  * @see stc_firewall_unlock()
250  * @see stc_firewall_get_lock()
251  */
252 int stc_firewall_lock(stc_h stc);
253
254 /**
255  * @brief Unlocks the firewall.
256  * @since_tizen 5.0
257  * @privlevel platform
258  * @privilege %http://tizen.org/privilege/firewall.admin
259  *
260  * @param[in] stc        The stc handle
261  *
262  * @return 0 on success, otherwise a negative error value
263  * @retval #STC_ERROR_NONE Successful
264  * @retval #STC_ERROR_OPERATION_FAILED General error
265  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
266  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
267  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
268  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
269  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
270  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
271  *
272  * @see #stc_h
273  * @see stc_initialize()
274  * @see stc_firewall_lock()
275  * @see stc_firewall_get_lock()
276  */
277 int stc_firewall_unlock(stc_h stc);
278
279 /**
280  * @brief Gets the firewall lock state.
281  * @since_tizen 5.0
282  * @privlevel platform
283  * @privilege %http://tizen.org/privilege/firewall.admin
284  *
285  * @param[in] stc        The stc handle
286  * @param[out] state     The firewall lock state
287  *
288  * @return 0 on success, otherwise a negative error value
289  * @retval #STC_ERROR_NONE Successful
290  * @retval #STC_ERROR_OPERATION_FAILED General error
291  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
292  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
293  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
294  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
295  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
296  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
297  *
298  * @see #stc_h
299  * @see stc_initialize()
300  * @see stc_firewall_lock()
301  * @see stc_firewall_unlock()
302  */
303 int stc_firewall_get_lock(stc_h stc, stc_firewall_lock_e *state);
304
305 /**
306  * @brief Creates the firewall chain handle.
307  * @since_tizen 5.0
308  * @remarks You must release @a handle using stc_firewall_chain_destroy().
309  *
310  * @param[in] stc        The stc handle
311  * @param[in] name       The chain name
312  * @param[out] chain     The firewall chain handle
313  *
314  * @return 0 on success, otherwise a negative error value
315  * @retval #STC_ERROR_NONE Successful
316  * @retval #STC_ERROR_OPERATION_FAILED General error
317  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
318  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
319  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
320  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
321  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
322  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
323  *
324  * @see #stc_h
325  * @see #stc_firewall_chain_h
326  * @see stc_initialize()
327  * @see stc_firewall_chain_destroy()
328  */
329 int stc_firewall_chain_create(stc_h stc, const char *name,
330                                 stc_firewall_chain_h *chain_h);
331
332 /**
333  * @brief Clones the firewall chain handle.
334  * @since_tizen 5.0
335  * @remarks You must release @a handle using stc_firewall_chain_destroy().
336  *
337  * @param[in] origin        The origin firewall chain handle
338  * @param[out] cloned_chain The cloned firewall chain handle
339  *
340  * @return 0 on success, otherwise a negative error value
341  * @retval #STC_ERROR_NONE Successful
342  * @retval #STC_ERROR_OPERATION_FAILED General error
343  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
344  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
345  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
346  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
347  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
348  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
349  *
350  * @see #stc_h
351  * @see #stc_firewall_chain_h
352  * @see stc_initialize()
353  * @see stc_firewall_chain_create()
354  * @see stc_firewall_chain_destroy()
355  */
356 int stc_firewall_chain_clone(stc_firewall_chain_h origin_h,
357                         stc_firewall_chain_h *cloned_chain_h);
358
359 /**
360  * @brief Destroys the firewall chain handle.
361  * @since_tizen 5.0
362  *
363  * @param[in] chain      The firewall chain handle
364  *
365  * @return 0 on success, otherwise a negative error value
366  * @retval #STC_ERROR_NONE Successful
367  * @retval #STC_ERROR_OPERATION_FAILED General error
368  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
369  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
370  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
371  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
372  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
373  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
374  *
375  * @see #stc_firewall_chain_h
376  * @see stc_firewall_chain_create()
377  */
378 int stc_firewall_chain_destroy(stc_firewall_chain_h chain_h);
379
380 /**
381  * @brief Gets the name for chain.
382  * @since_tizen 5.0
383  *
384  * @param[in] chain      The firewall chain handle
385  * @param[out] name      The chain name
386  *
387  * @return 0 on success, otherwise a negative error value
388  * @retval #STC_ERROR_NONE Successful
389  * @retval #STC_ERROR_OPERATION_FAILED General error
390  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
391  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
392  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
393  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
394  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
395  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
396  *
397  * @see #stc_firewall_chain_h
398  * @see stc_firewall_chain_create()
399  * @see stc_firewall_chain_destroy()
400  */
401 int stc_firewall_chain_get_name(stc_firewall_chain_h chain, char **name);
402
403 /**
404  * @brief Gets the target type for chain.
405  * @since_tizen 5.0
406  *
407  * @param[in] chain      The firewall chain handle
408  * @param[out] target    The target type
409  *
410  * @return 0 on success, otherwise a negative error value
411  * @retval #STC_ERROR_NONE Successful
412  * @retval #STC_ERROR_OPERATION_FAILED General error
413  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
414  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
415  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
416  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
417  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
418  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
419  *
420  * @see #stc_firewall_chain_h
421  * @see stc_firewall_chain_create()
422  * @see stc_firewall_chain_destroy()
423  */
424 int stc_firewall_chain_get_target(stc_firewall_chain_h chain_h,
425                         stc_firewall_chain_target_e *target);
426
427 /**
428  * @brief Gets the priority for chain.
429  * @since_tizen 5.0
430  *
431  * @param[in] chain      The firewall chain handle
432  * @param[out] priority  The priority
433  *
434  * @return 0 on success, otherwise a negative error value
435  * @retval #STC_ERROR_NONE Successful
436  * @retval #STC_ERROR_OPERATION_FAILED General error
437  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
438  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
439  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
440  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
441  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
442  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
443  *
444  * @see #stc_firewall_chain_h
445  * @see stc_firewall_chain_create()
446  * @see stc_firewall_chain_destroy()
447  */
448 int stc_firewall_chain_get_priority(stc_firewall_chain_h chain_h,
449                         unsigned int *priority);
450
451 /**
452  * @brief Adds the chain.
453  * @since_tizen 5.0
454  * @privlevel platform
455  * @privilege %http://tizen.org/privilege/firewall.common
456  *
457  * @param[in] chain      The firewall chain handle
458  *
459  * @return 0 on success, otherwise a negative error value
460  * @retval #STC_ERROR_NONE Successful
461  * @retval #STC_ERROR_OPERATION_FAILED General error
462  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
463  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
464  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
465  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
466  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
467  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
468  *
469  * @see #stc_firewall_chain_h
470  * @see stc_firewall_chain_create()
471  * @see stc_firewall_chain_destroy()
472  */
473 int stc_firewall_chain_add(stc_firewall_chain_h chain_h);
474
475 /**
476  * @brief Removes the chain.
477  * @since_tizen 5.0
478  * @privlevel platform
479  * @privilege %http://tizen.org/privilege/firewall.common
480  *
481  * @param[in] chain      The firewall chain handle
482  *
483  * @return 0 on success, otherwise a negative error value
484  * @retval #STC_ERROR_NONE Successful
485  * @retval #STC_ERROR_OPERATION_FAILED General error
486  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
487  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
488  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
489  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
490  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
491  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
492  *
493  * @see #stc_firewall_chain_h
494  * @see stc_firewall_chain_create()
495  * @see stc_firewall_chain_destroy()
496  */
497 int stc_firewall_chain_remove(stc_firewall_chain_h chain_h);
498
499 /**
500  * @brief Flushs the chain.
501  * @since_tizen 5.0
502  * @privlevel platform
503  * @privilege %http://tizen.org/privilege/firewall.common
504  *
505  * @param[in] chain      The firewall chain handle
506  *
507  * @return 0 on success, otherwise a negative error value
508  * @retval #STC_ERROR_NONE Successful
509  * @retval #STC_ERROR_OPERATION_FAILED General error
510  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
511  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
512  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
513  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
514  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
515  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
516  *
517  * @see #stc_firewall_chain_h
518  * @see stc_firewall_chain_create()
519  * @see stc_firewall_chain_destroy()
520  */
521 int stc_firewall_chain_flush(stc_firewall_chain_h chain_h);
522
523 /**
524  * @brief Gets all chains.
525  * @since_tizen 5.0
526  * @privlevel platform
527  * @privilege %http://tizen.org/privilege/firewall.common
528  *
529  * @param[in] stc        The stc handle
530  * @param[in] callback   The callback to be called
531  * @param[in] user_data  The user data passed to the callback function
532  *
533  * @return 0 on success, otherwise a negative error value
534  * @retval #STC_ERROR_NONE Successful
535  * @retval #STC_ERROR_OPERATION_FAILED General error
536  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
537  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
538  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
539  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
540  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
541  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
542  *
543  * @see #stc_firewall_chain_h
544  * @see stc_firewall_chain_create()
545  * @see stc_firewall_chain_destroy()
546  */
547 int stc_firewall_chain_foreach(stc_h stc,
548                         stc_firewall_chain_info_cb callback, void *user_data);
549
550 /**
551  * @brief Sets the chain to target.
552  * @since_tizen 5.0
553  * @privlevel platform
554  * @privilege %http://tizen.org/privilege/firewall.common
555  * @remarks You should set only one chain.
556  *
557  * @param[in] chain      The firewall chain handle
558  * @param[in] target     The target type
559  *
560  * @return 0 on success, otherwise a negative error value
561  * @retval #STC_ERROR_NONE Successful
562  * @retval #STC_ERROR_OPERATION_FAILED General error
563  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
564  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
565  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
566  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
567  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
568  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
569  *
570  * @see #stc_firewall_chain_h
571  * @see stc_firewall_chain_create()
572  * @see stc_firewall_chain_destroy()
573  */
574 int stc_firewall_chain_set(stc_firewall_chain_h chain_h,
575                         stc_firewall_chain_target_e target);
576
577 /**
578  * @brief Unsets the chain.
579  * @since_tizen 5.0
580  * @privlevel platform
581  * @privilege %http://tizen.org/privilege/firewall.common
582  *
583  * @param[in] chain      The firewall chain handle
584  *
585  * @return 0 on success, otherwise a negative error value
586  * @retval #STC_ERROR_NONE Successful
587  * @retval #STC_ERROR_OPERATION_FAILED General error
588  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
589  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
590  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
591  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
592  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
593  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
594  *
595  * @see #stc_firewall_chain_h
596  * @see stc_firewall_chain_create()
597  * @see stc_firewall_chain_destroy()
598  */
599 int stc_firewall_chain_unset(stc_firewall_chain_h chain_h);
600
601 /**
602  * @brief Creates the firewall rule handle.
603  * @since_tizen 5.0
604  * @remarks You must release @a handle using stc_firewall_rule_destroy().
605  *
606  * @param[in] stc        The stc handle
607  * @param[out] rule      The firewall rule handle
608  *
609  * @return 0 on success, otherwise a negative error value
610  * @retval #STC_ERROR_NONE Successful
611  * @retval #STC_ERROR_OPERATION_FAILED General error
612  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
613  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
614  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
615  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
616  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
617  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
618  *
619  * @see #stc_h
620  * @see #stc_firewall_rule_h
621  * @see stc_initialize()
622  * @see stc_firewall_rule_destroy()
623  */
624 int stc_firewall_rule_create(stc_h stc, stc_firewall_rule_h *rule_h);
625
626 /**
627  * @brief Clones the firewall rule handle.
628  * @since_tizen 5.0
629  * @remarks You must release @a handle using stc_firewall_rule_destroy().
630  *
631  * @param[in] origin        The origin firewall rule handle
632  * @param[out] cloned_rule  The cloned firewall rule handle
633  *
634  * @return 0 on success, otherwise a negative error value
635  * @retval #STC_ERROR_NONE Successful
636  * @retval #STC_ERROR_OPERATION_FAILED General error
637  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
638  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
639  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
640  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
641  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
642  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
643  *
644  * @see #stc_h
645  * @see #stc_firewall_rule_h
646  * @see stc_initialize()
647  * @see stc_firewall_rule_create()
648  * @see stc_firewall_rule_destroy()
649  */
650 int stc_firewall_rule_clone(stc_firewall_rule_h origin_h,
651                         stc_firewall_rule_h *cloned_rule_h);
652
653 /**
654  * @brief Destroys the firewall rule handle.
655  * @since_tizen 5.0
656  *
657  * @param[in] rule       The firewall chain handle
658  *
659  * @return 0 on success, otherwise a negative error value
660  * @retval #STC_ERROR_NONE Successful
661  * @retval #STC_ERROR_OPERATION_FAILED General error
662  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
663  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
664  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
665  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
666  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
667  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
668  *
669  * @see #stc_firewall_rule_h
670  * @see stc_firewall_rule_create()
671  */
672 int stc_firewall_rule_destroy(stc_firewall_rule_h rule_h);
673
674 /**
675  * @brief Sets the chain name to rule.
676  * @since_tizen 5.0
677  *
678  * @param[in] rule       The firewall rule handle
679  * @param[in] chain      The chain name
680  *
681  * @return 0 on success, otherwise a negative error value
682  * @retval #STC_ERROR_NONE Successful
683  * @retval #STC_ERROR_OPERATION_FAILED General error
684  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
685  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
686  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
687  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
688  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
689  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
690  *
691  * @see #stc_firewall_rule_h
692  * @see stc_firewall_rule_create()
693  * @see stc_firewall_rule_destroy()
694  * @see stc_firewall_rule_get_chain()
695  */
696 int stc_firewall_rule_set_chain(stc_firewall_rule_h rule_h, char *chain);
697
698 /**
699  * @brief Sets the direction to rule.
700  * @since_tizen 5.0
701  *
702  * @param[in] rule       The firewall rule handle
703  * @param[in] direction  The direction
704  *
705  * @return 0 on success, otherwise a negative error value
706  * @retval #STC_ERROR_NONE Successful
707  * @retval #STC_ERROR_OPERATION_FAILED General error
708  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
709  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
710  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
711  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
712  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
713  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
714  *
715  * @see #stc_firewall_rule_h
716  * @see stc_firewall_rule_create()
717  * @see stc_firewall_rule_destroy()
718  * @see stc_firewall_rule_get_direction()
719  */
720 int stc_firewall_rule_set_direction(stc_firewall_rule_h rule_h,
721                                 stc_firewall_direction_e direction);
722
723 /**
724  * @brief Sets the source IP type to rule.
725  * @since_tizen 5.0
726  *
727  * @param[in] rule       The firewall rule handle
728  * @param[in] type       The IP type
729  *
730  * @return 0 on success, otherwise a negative error value
731  * @retval #STC_ERROR_NONE Successful
732  * @retval #STC_ERROR_OPERATION_FAILED General error
733  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
734  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
735  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
736  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
737  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
738  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
739  *
740  * @see #stc_firewall_rule_h
741  * @see stc_firewall_rule_create()
742  * @see stc_firewall_rule_destroy()
743  * @see stc_firewall_rule_get_src_ip_type()
744  */
745 int stc_firewall_rule_set_src_ip_type(stc_firewall_rule_h rule_h,
746                                 stc_firewall_ip_type_e type);
747
748 /**
749  * @brief Sets the destination IP type to rule.
750  * @since_tizen 5.0
751  *
752  * @param[in] rule       The firewall rule handle
753  * @param[in] type       The IP type
754  *
755  * @return 0 on success, otherwise a negative error value
756  * @retval #STC_ERROR_NONE Successful
757  * @retval #STC_ERROR_OPERATION_FAILED General error
758  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
759  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
760  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
761  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
762  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
763  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
764  *
765  * @see #stc_firewall_rule_h
766  * @see stc_firewall_rule_create()
767  * @see stc_firewall_rule_destroy()
768  * @see stc_firewall_rule_get_dst_ip_type()
769  */
770 int stc_firewall_rule_set_dst_ip_type(stc_firewall_rule_h rule_h,
771                                 stc_firewall_ip_type_e type);
772
773 /**
774  * @brief Sets the source port type to rule.
775  * @since_tizen 5.0
776  *
777  * @param[in] rule       The firewall rule handle
778  * @param[in] type       The port type
779  *
780  * @return 0 on success, otherwise a negative error value
781  * @retval #STC_ERROR_NONE Successful
782  * @retval #STC_ERROR_OPERATION_FAILED General error
783  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
784  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
785  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
786  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
787  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
788  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
789  *
790  * @see #stc_firewall_rule_h
791  * @see stc_firewall_rule_create()
792  * @see stc_firewall_rule_destroy()
793  * @see stc_firewall_rule_get_src_port_type()
794  */
795 int stc_firewall_rule_set_src_port_type(stc_firewall_rule_h rule_h,
796                                 stc_firewall_port_type_e type);
797
798 /**
799  * @brief Sets the destination port type to rule.
800  * @since_tizen 5.0
801  *
802  * @param[in] rule       The firewall rule handle
803  * @param[in] type       The port type
804  *
805  * @return 0 on success, otherwise a negative error value
806  * @retval #STC_ERROR_NONE Successful
807  * @retval #STC_ERROR_OPERATION_FAILED General error
808  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
809  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
810  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
811  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
812  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
813  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
814  *
815  * @see #stc_firewall_rule_h
816  * @see stc_firewall_rule_create()
817  * @see stc_firewall_rule_destroy()
818  * @see stc_firewall_rule_get_dst_port_type()
819  */
820 int stc_firewall_rule_set_dst_port_type(stc_firewall_rule_h rule_h,
821                                 stc_firewall_port_type_e type);
822
823 /**
824  * @brief Sets the protocol type to rule.
825  * @since_tizen 5.0
826  *
827  * @param[in] rule       The firewall rule handle
828  * @param[in] type       The protocol type
829  *
830  * @return 0 on success, otherwise a negative error value
831  * @retval #STC_ERROR_NONE Successful
832  * @retval #STC_ERROR_OPERATION_FAILED General error
833  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
834  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
835  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
836  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
837  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
838  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
839  *
840  * @see #stc_firewall_rule_h
841  * @see stc_firewall_rule_create()
842  * @see stc_firewall_rule_destroy()
843  * @see stc_firewall_rule_get_protocol_type()
844  */
845 int stc_firewall_rule_set_protocol_type(stc_firewall_rule_h rule_h,
846                                 stc_firewall_protocol_type_e type);
847
848 /**
849  * @brief Sets the address family type to rule.
850  * @since_tizen 5.0
851  *
852  * @param[in] rule       The firewall rule handle
853  * @param[in] type       The address family type
854  *
855  * @return 0 on success, otherwise a negative error value
856  * @retval #STC_ERROR_NONE Successful
857  * @retval #STC_ERROR_OPERATION_FAILED General error
858  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
859  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
860  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
861  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
862  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
863  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
864  *
865  * @see #stc_firewall_rule_h
866  * @see stc_firewall_rule_create()
867  * @see stc_firewall_rule_destroy()
868  * @see stc_firewall_rule_get_family_type()
869  */
870 int stc_firewall_rule_set_family_type(stc_firewall_rule_h rule_h,
871                                 stc_firewall_family_type_e type);
872
873 /**
874  * @brief Sets source IP addresses to rule.
875  * @since_tizen 5.0
876  *
877  * @param[in] rule       The firewall rule handle
878  * @param[in] ip1        The address 1
879  * @param[in] ip2        The address 2 which will be IP address or mask
880  *
881  * @return 0 on success, otherwise a negative error value
882  * @retval #STC_ERROR_NONE Successful
883  * @retval #STC_ERROR_OPERATION_FAILED General error
884  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
885  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
886  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
887  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
888  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
889  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
890  *
891  * @see #stc_firewall_rule_h
892  * @see stc_firewall_rule_create()
893  * @see stc_firewall_rule_destroy()
894  * @see stc_firewall_rule_set_src_ip_type()
895  * @see stc_firewall_rule_get_src_ip()
896  */
897 int stc_firewall_rule_set_src_ip(stc_firewall_rule_h rule_h,
898                         char *ip1, char *ip2);
899
900 /**
901  * @brief Sets destination IP addresses to rule.
902  * @since_tizen 5.0
903  *
904  * @param[in] rule       The firewall rule handle
905  * @param[in] ip1        The address 1
906  * @param[in] ip2        The address 2 which will be IP address or mask
907  *
908  * @return 0 on success, otherwise a negative error value
909  * @retval #STC_ERROR_NONE Successful
910  * @retval #STC_ERROR_OPERATION_FAILED General error
911  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
912  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
913  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
914  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
915  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
916  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
917  *
918  * @see #stc_firewall_rule_h
919  * @see stc_firewall_rule_create()
920  * @see stc_firewall_rule_destroy()
921  * @see stc_firewall_rule_set_dst_ip_type()
922  * @see stc_firewall_rule_get_dst_ip()
923  */
924 int stc_firewall_rule_set_dst_ip(stc_firewall_rule_h rule_h,
925                         char *ip1, char *ip2);
926
927 /**
928  * @brief Sets source ports to rule.
929  * @since_tizen 5.0
930  *
931  * @param[in] rule       The firewall rule handle
932  * @param[in] port1      The port 1
933  * @param[in] port2      The port 2
934  *
935  * @return 0 on success, otherwise a negative error value
936  * @retval #STC_ERROR_NONE Successful
937  * @retval #STC_ERROR_OPERATION_FAILED General error
938  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
939  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
940  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
941  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
942  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
943  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
944  *
945  * @see #stc_firewall_rule_h
946  * @see stc_firewall_rule_create()
947  * @see stc_firewall_rule_destroy()
948  * @see stc_firewall_rule_set_src_port_type()
949  * @see stc_firewall_rule_get_src_port()
950  */
951 int stc_firewall_rule_set_src_port(stc_firewall_rule_h rule_h,
952                         unsigned int port1, unsigned int port2);
953
954 /**
955  * @brief Sets destination ports to rule.
956  * @since_tizen 5.0
957  *
958  * @param[in] rule       The firewall rule handle
959  * @param[in] port1      The port 1
960  * @param[in] port2      The port 2
961  *
962  * @return 0 on success, otherwise a negative error value
963  * @retval #STC_ERROR_NONE Successful
964  * @retval #STC_ERROR_OPERATION_FAILED General error
965  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
966  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
967  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
968  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
969  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
970  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
971  *
972  * @see #stc_firewall_rule_h
973  * @see stc_firewall_rule_create()
974  * @see stc_firewall_rule_destroy()
975  * @see stc_firewall_rule_set_dst_port_type()
976  * @see stc_firewall_rule_get_dst_port()
977  */
978 int stc_firewall_rule_set_dst_port(stc_firewall_rule_h rule_h,
979                         unsigned int port1, unsigned int port2);
980
981 /**
982  * @brief Sets interface name to rule.
983  * @since_tizen 5.0
984  *
985  * @param[in] rule       The firewall rule handle
986  * @param[in] ifname     The interface name
987  *
988  * @return 0 on success, otherwise a negative error value
989  * @retval #STC_ERROR_NONE Successful
990  * @retval #STC_ERROR_OPERATION_FAILED General error
991  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
992  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
993  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
994  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
995  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
996  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
997  *
998  * @see #stc_firewall_rule_h
999  * @see stc_firewall_rule_create()
1000  * @see stc_firewall_rule_destroy()
1001  * @see stc_firewall_rule_get_ifname()
1002  */
1003 int stc_firewall_rule_set_ifname(stc_firewall_rule_h rule_h, char *ifname);
1004
1005 /**
1006  * @brief Sets target type to rule.
1007  * @since_tizen 5.0
1008  *
1009  * @param[in] rule       The firewall rule handle
1010  * @param[in] target     The target type
1011  *
1012  * @return 0 on success, otherwise a negative error value
1013  * @retval #STC_ERROR_NONE Successful
1014  * @retval #STC_ERROR_OPERATION_FAILED General error
1015  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
1016  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
1017  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
1018  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
1019  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
1020  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
1021  *
1022  * @see #stc_firewall_rule_h
1023  * @see stc_firewall_rule_create()
1024  * @see stc_firewall_rule_destroy()
1025  * @see stc_firewall_rule_get_target()
1026  */
1027 int stc_firewall_rule_set_target(stc_firewall_rule_h rule_h,
1028                         stc_firewall_rule_target_e target);
1029
1030 /**
1031  * @brief Sets log level to rule.
1032  * @since_tizen 5.0
1033  *
1034  * @param[in] rule       The firewall rule handle
1035  * @param[in] level      The level
1036  *
1037  * @return 0 on success, otherwise a negative error value
1038  * @retval #STC_ERROR_NONE Successful
1039  * @retval #STC_ERROR_OPERATION_FAILED General error
1040  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
1041  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
1042  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
1043  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
1044  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
1045  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
1046  *
1047  * @see #stc_firewall_rule_h
1048  * @see stc_firewall_rule_create()
1049  * @see stc_firewall_rule_destroy()
1050  * @see stc_firewall_rule_get_log_level()
1051  */
1052 int stc_firewall_rule_set_log_level(stc_firewall_rule_h rule_h,
1053                         unsigned char level);
1054
1055 /**
1056  * @brief Sets log prefix to rule.
1057  * @since_tizen 5.0
1058  *
1059  * @param[in] rule       The firewall rule handle
1060  * @param[in] prefix     The prefix
1061  *
1062  * @return 0 on success, otherwise a negative error value
1063  * @retval #STC_ERROR_NONE Successful
1064  * @retval #STC_ERROR_OPERATION_FAILED General error
1065  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
1066  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
1067  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
1068  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
1069  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
1070  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
1071  *
1072  * @see #stc_firewall_rule_h
1073  * @see stc_firewall_rule_create()
1074  * @see stc_firewall_rule_destroy()
1075  * @see stc_firewall_rule_get_log_prefix()
1076  */
1077 int stc_firewall_rule_set_log_prefix(stc_firewall_rule_h rule_h,
1078                         char *prefix);
1079
1080 /**
1081  * @brief Sets nflog group to rule.
1082  * @since_tizen 5.0
1083  *
1084  * @param[in] rule       The firewall rule handle
1085  * @param[in] group      The group
1086  *
1087  * @return 0 on success, otherwise a negative error value
1088  * @retval #STC_ERROR_NONE Successful
1089  * @retval #STC_ERROR_OPERATION_FAILED General error
1090  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
1091  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
1092  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
1093  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
1094  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
1095  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
1096  *
1097  * @see #stc_firewall_rule_h
1098  * @see stc_firewall_rule_create()
1099  * @see stc_firewall_rule_destroy()
1100  * @see stc_firewall_rule_get_nflog_group()
1101  */
1102 int stc_firewall_rule_set_nflog_group(stc_firewall_rule_h rule_h,
1103                         unsigned int group);
1104
1105 /**
1106  * @brief Sets nflog prefix to rule.
1107  * @since_tizen 5.0
1108  *
1109  * @param[in] rule       The firewall rule handle
1110  * @param[in] prefix     The prefix
1111  *
1112  * @return 0 on success, otherwise a negative error value
1113  * @retval #STC_ERROR_NONE Successful
1114  * @retval #STC_ERROR_OPERATION_FAILED General error
1115  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
1116  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
1117  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
1118  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
1119  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
1120  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
1121  *
1122  * @see #stc_firewall_rule_h
1123  * @see stc_firewall_rule_create()
1124  * @see stc_firewall_rule_destroy()
1125  * @see stc_firewall_rule_get_nflog_prefix()
1126  */
1127 int stc_firewall_rule_set_nflog_prefix(stc_firewall_rule_h rule_h,
1128                         char *prefix);
1129
1130 /**
1131  * @brief Sets nflog range to rule.
1132  * @since_tizen 5.0
1133  *
1134  * @param[in] rule       The firewall rule handle
1135  * @param[in] range      The range
1136  *
1137  * @return 0 on success, otherwise a negative error value
1138  * @retval #STC_ERROR_NONE Successful
1139  * @retval #STC_ERROR_OPERATION_FAILED General error
1140  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
1141  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
1142  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
1143  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
1144  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
1145  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
1146  *
1147  * @see #stc_firewall_rule_h
1148  * @see stc_firewall_rule_create()
1149  * @see stc_firewall_rule_destroy()
1150  * @see stc_firewall_rule_get_nflog_range()
1151  */
1152 int stc_firewall_rule_set_nflog_range(stc_firewall_rule_h rule_h,
1153                         unsigned int range);
1154
1155 /**
1156  * @brief Sets nflog threshold to rule.
1157  * @since_tizen 5.0
1158  *
1159  * @param[in] rule       The firewall rule handle
1160  * @param[in] threshold  The threshold
1161  *
1162  * @return 0 on success, otherwise a negative error value
1163  * @retval #STC_ERROR_NONE Successful
1164  * @retval #STC_ERROR_OPERATION_FAILED General error
1165  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
1166  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
1167  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
1168  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
1169  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
1170  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
1171  *
1172  * @see #stc_firewall_rule_h
1173  * @see stc_firewall_rule_create()
1174  * @see stc_firewall_rule_destroy()
1175  * @see stc_firewall_rule_get_nflog_threshold()
1176  */
1177 int stc_firewall_rule_set_nflog_threshold(stc_firewall_rule_h rule_h,
1178                         unsigned int threshold);
1179
1180 /**
1181  * @brief Gets the chain name from rule.
1182  * @since_tizen 5.0
1183  *
1184  * @param[in] rule       The firewall rule handle
1185  * @param[out] chain     The chain name
1186  *
1187  * @return 0 on success, otherwise a negative error value
1188  * @retval #STC_ERROR_NONE Successful
1189  * @retval #STC_ERROR_OPERATION_FAILED General error
1190  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
1191  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
1192  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
1193  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
1194  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
1195  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
1196  *
1197  * @see #stc_firewall_rule_h
1198  * @see stc_firewall_rule_create()
1199  * @see stc_firewall_rule_destroy()
1200  * @see stc_firewall_rule_set_chain()
1201  */
1202 int stc_firewall_rule_get_chain(stc_firewall_rule_h rule_h, char **chain);
1203
1204 /**
1205  * @brief Gets the direction from rule.
1206  * @since_tizen 5.0
1207  *
1208  * @param[in] rule       The firewall rule handle
1209  * @param[out] direction The direction
1210  *
1211  * @return 0 on success, otherwise a negative error value
1212  * @retval #STC_ERROR_NONE Successful
1213  * @retval #STC_ERROR_OPERATION_FAILED General error
1214  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
1215  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
1216  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
1217  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
1218  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
1219  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
1220  *
1221  * @see #stc_firewall_rule_h
1222  * @see stc_firewall_rule_create()
1223  * @see stc_firewall_rule_destroy()
1224  * @see stc_firewall_rule_set_direction()
1225  */
1226 int stc_firewall_rule_get_direction(stc_firewall_rule_h rule_h,
1227                                 stc_firewall_direction_e *direction);
1228
1229 /**
1230  * @brief Gets the source IP type from rule.
1231  * @since_tizen 5.0
1232  *
1233  * @param[in] rule       The firewall rule handle
1234  * @param[out] type      The IP type
1235  *
1236  * @return 0 on success, otherwise a negative error value
1237  * @retval #STC_ERROR_NONE Successful
1238  * @retval #STC_ERROR_OPERATION_FAILED General error
1239  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
1240  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
1241  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
1242  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
1243  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
1244  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
1245  *
1246  * @see #stc_firewall_rule_h
1247  * @see stc_firewall_rule_create()
1248  * @see stc_firewall_rule_destroy()
1249  * @see stc_firewall_rule_set_src_ip_type()
1250  */
1251 int stc_firewall_rule_get_src_ip_type(stc_firewall_rule_h rule_h,
1252                                 stc_firewall_ip_type_e *type);
1253
1254 /**
1255  * @brief Gets the destination IP type from rule.
1256  * @since_tizen 5.0
1257  *
1258  * @param[in] rule       The firewall rule handle
1259  * @param[out] type      The IP type
1260  *
1261  * @return 0 on success, otherwise a negative error value
1262  * @retval #STC_ERROR_NONE Successful
1263  * @retval #STC_ERROR_OPERATION_FAILED General error
1264  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
1265  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
1266  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
1267  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
1268  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
1269  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
1270  *
1271  * @see #stc_firewall_rule_h
1272  * @see stc_firewall_rule_create()
1273  * @see stc_firewall_rule_destroy()
1274  * @see stc_firewall_rule_set_dst_ip_type()
1275  */
1276 int stc_firewall_rule_get_dst_ip_type(stc_firewall_rule_h rule_h,
1277                                 stc_firewall_ip_type_e *type);
1278
1279 /**
1280  * @brief Gets the source port type from rule.
1281  * @since_tizen 5.0
1282  *
1283  * @param[in] rule       The firewall rule handle
1284  * @param[out] type      The port type
1285  *
1286  * @return 0 on success, otherwise a negative error value
1287  * @retval #STC_ERROR_NONE Successful
1288  * @retval #STC_ERROR_OPERATION_FAILED General error
1289  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
1290  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
1291  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
1292  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
1293  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
1294  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
1295  *
1296  * @see #stc_firewall_rule_h
1297  * @see stc_firewall_rule_create()
1298  * @see stc_firewall_rule_destroy()
1299  * @see stc_firewall_rule_set_src_port_type()
1300  */
1301 int stc_firewall_rule_get_src_port_type(stc_firewall_rule_h rule_h,
1302                                 stc_firewall_port_type_e *type);
1303
1304 /**
1305  * @brief Gets the destination port type from rule.
1306  * @since_tizen 5.0
1307  *
1308  * @param[in] rule       The firewall rule handle
1309  * @param[out] type      The port type
1310  *
1311  * @return 0 on success, otherwise a negative error value
1312  * @retval #STC_ERROR_NONE Successful
1313  * @retval #STC_ERROR_OPERATION_FAILED General error
1314  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
1315  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
1316  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
1317  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
1318  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
1319  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
1320  *
1321  * @see #stc_firewall_rule_h
1322  * @see stc_firewall_rule_create()
1323  * @see stc_firewall_rule_destroy()
1324  * @see stc_firewall_rule_set_dst_port_type()
1325  */
1326 int stc_firewall_rule_get_dst_port_type(stc_firewall_rule_h rule_h,
1327                                 stc_firewall_port_type_e *type);
1328
1329 /**
1330  * @brief Gets the protocol type from rule.
1331  * @since_tizen 5.0
1332  *
1333  * @param[in] rule       The firewall rule handle
1334  * @param[out] type      The protocol type
1335  *
1336  * @return 0 on success, otherwise a negative error value
1337  * @retval #STC_ERROR_NONE Successful
1338  * @retval #STC_ERROR_OPERATION_FAILED General error
1339  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
1340  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
1341  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
1342  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
1343  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
1344  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
1345  *
1346  * @see #stc_firewall_rule_h
1347  * @see stc_firewall_rule_create()
1348  * @see stc_firewall_rule_destroy()
1349  * @see stc_firewall_rule_set_protocol_type()
1350  */
1351 int stc_firewall_rule_get_protocol_type(stc_firewall_rule_h rule_h,
1352                                 stc_firewall_protocol_type_e *type);
1353
1354 /**
1355  * @brief Gets the address family type from rule.
1356  * @since_tizen 5.0
1357  *
1358  * @param[in] rule       The firewall rule handle
1359  * @param[out] type      The address family type
1360  *
1361  * @return 0 on success, otherwise a negative error value
1362  * @retval #STC_ERROR_NONE Successful
1363  * @retval #STC_ERROR_OPERATION_FAILED General error
1364  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
1365  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
1366  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
1367  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
1368  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
1369  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
1370  *
1371  * @see #stc_firewall_rule_h
1372  * @see stc_firewall_rule_create()
1373  * @see stc_firewall_rule_destroy()
1374  * @see stc_firewall_rule_set_family_type()
1375  */
1376 int stc_firewall_rule_get_family_type(stc_firewall_rule_h rule_h,
1377                                 stc_firewall_family_type_e *type);
1378
1379 /**
1380  * @brief Gets the source IP addresses from rule.
1381  * @since_tizen 5.0
1382  *
1383  * @param[in] rule       The firewall rule handle
1384  * @param[out] ip1       The address 1
1385  * @param[out] ip2       The address 2 which will be IP address or mask
1386  *
1387  * @return 0 on success, otherwise a negative error value
1388  * @retval #STC_ERROR_NONE Successful
1389  * @retval #STC_ERROR_OPERATION_FAILED General error
1390  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
1391  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
1392  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
1393  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
1394  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
1395  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
1396  *
1397  * @see #stc_firewall_rule_h
1398  * @see stc_firewall_rule_create()
1399  * @see stc_firewall_rule_destroy()
1400  * @see stc_firewall_rule_get_src_ip_type()
1401  * @see stc_firewall_rule_set_src_ip()
1402  */
1403 int stc_firewall_rule_get_src_ip(stc_firewall_rule_h rule_h,
1404                         char **ip1, char **ip2);
1405
1406 /**
1407  * @brief Gets the destination IP addresses from rule.
1408  * @since_tizen 5.0
1409  *
1410  * @param[in] rule       The firewall rule handle
1411  * @param[out] ip1       The address 1
1412  * @param[out] ip2       The address 2 which will be IP address or mask
1413  *
1414  * @return 0 on success, otherwise a negative error value
1415  * @retval #STC_ERROR_NONE Successful
1416  * @retval #STC_ERROR_OPERATION_FAILED General error
1417  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
1418  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
1419  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
1420  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
1421  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
1422  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
1423  *
1424  * @see #stc_firewall_rule_h
1425  * @see stc_firewall_rule_create()
1426  * @see stc_firewall_rule_destroy()
1427  * @see stc_firewall_rule_get_dst_ip_type()
1428  * @see stc_firewall_rule_set_dst_ip()
1429  */
1430 int stc_firewall_rule_get_dst_ip(stc_firewall_rule_h rule_h,
1431                         char **ip1, char **ip2);
1432
1433 /**
1434  * @brief Gets the source ports from rule.
1435  * @since_tizen 5.0
1436  *
1437  * @param[in] rule       The firewall rule handle
1438  * @param[out] port1     The port 1
1439  * @param[out] port2     The port 2
1440  *
1441  * @return 0 on success, otherwise a negative error value
1442  * @retval #STC_ERROR_NONE Successful
1443  * @retval #STC_ERROR_OPERATION_FAILED General error
1444  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
1445  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
1446  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
1447  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
1448  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
1449  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
1450  *
1451  * @see #stc_firewall_rule_h
1452  * @see stc_firewall_rule_create()
1453  * @see stc_firewall_rule_destroy()
1454  * @see stc_firewall_rule_get_src_port_type()
1455  * @see stc_firewall_rule_set_src_port()
1456  */
1457 int stc_firewall_rule_get_src_port(stc_firewall_rule_h rule_h,
1458                                 unsigned int *port1, unsigned int *port2);
1459
1460 /**
1461  * @brief Gets the destination ports from rule.
1462  * @since_tizen 5.0
1463  *
1464  * @param[in] rule       The firewall rule handle
1465  * @param[out] port1     The port 1
1466  * @param[out] port2     The port 2
1467  *
1468  * @return 0 on success, otherwise a negative error value
1469  * @retval #STC_ERROR_NONE Successful
1470  * @retval #STC_ERROR_OPERATION_FAILED General error
1471  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
1472  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
1473  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
1474  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
1475  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
1476  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
1477  *
1478  * @see #stc_firewall_rule_h
1479  * @see stc_firewall_rule_create()
1480  * @see stc_firewall_rule_destroy()
1481  * @see stc_firewall_rule_get_dst_port_type()
1482  * @see stc_firewall_rule_set_dst_port()
1483  */
1484 int stc_firewall_rule_get_dst_port(stc_firewall_rule_h rule_h,
1485                                 unsigned int *port1, unsigned int *port2);
1486
1487 /**
1488  * @brief Gets the interface name from rule.
1489  * @since_tizen 5.0
1490  *
1491  * @param[in] rule       The firewall rule handle
1492  * @param[out] ifname    The interface name
1493  *
1494  * @return 0 on success, otherwise a negative error value
1495  * @retval #STC_ERROR_NONE Successful
1496  * @retval #STC_ERROR_OPERATION_FAILED General error
1497  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
1498  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
1499  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
1500  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
1501  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
1502  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
1503  *
1504  * @see #stc_firewall_rule_h
1505  * @see stc_firewall_rule_create()
1506  * @see stc_firewall_rule_destroy()
1507  * @see stc_firewall_rule_set_ifname()
1508  */
1509 int stc_firewall_rule_get_ifname(stc_firewall_rule_h rule_h, char **ifname);
1510
1511 /**
1512  * @brief Gets the target type from rule.
1513  * @since_tizen 5.0
1514  *
1515  * @param[in] rule       The firewall rule handle
1516  * @param[out] target    The target type
1517  *
1518  * @return 0 on success, otherwise a negative error value
1519  * @retval #STC_ERROR_NONE Successful
1520  * @retval #STC_ERROR_OPERATION_FAILED General error
1521  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
1522  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
1523  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
1524  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
1525  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
1526  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
1527  *
1528  * @see #stc_firewall_rule_h
1529  * @see stc_firewall_rule_create()
1530  * @see stc_firewall_rule_destroy()
1531  * @see stc_firewall_rule_set_target()
1532  */
1533 int stc_firewall_rule_get_target(stc_firewall_rule_h rule_h,
1534                         stc_firewall_rule_target_e *target);
1535
1536 /**
1537  * @brief Gets log level from rule.
1538  * @since_tizen 5.0
1539  *
1540  * @param[in] rule       The firewall rule handle
1541  * @param[out] level     The level
1542  *
1543  * @return 0 on success, otherwise a negative error value
1544  * @retval #STC_ERROR_NONE Successful
1545  * @retval #STC_ERROR_OPERATION_FAILED General error
1546  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
1547  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
1548  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
1549  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
1550  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
1551  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
1552  *
1553  * @see #stc_firewall_rule_h
1554  * @see stc_firewall_rule_create()
1555  * @see stc_firewall_rule_destroy()
1556  * @see stc_firewall_rule_set_log_level()
1557  */
1558 int stc_firewall_rule_get_log_level(stc_firewall_rule_h rule_h,
1559                         unsigned char *level);
1560
1561 int stc_firewall_rule_get_log_prefix(stc_firewall_rule_h rule_h,
1562                         char **prefix);
1563
1564 /**
1565  * @brief Gets nflog group from rule.
1566  * @since_tizen 5.0
1567  *
1568  * @param[in] rule       The firewall rule handle
1569  * @param[out] group     The group
1570  *
1571  * @return 0 on success, otherwise a negative error value
1572  * @retval #STC_ERROR_NONE Successful
1573  * @retval #STC_ERROR_OPERATION_FAILED General error
1574  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
1575  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
1576  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
1577  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
1578  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
1579  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
1580  *
1581  * @see #stc_firewall_rule_h
1582  * @see stc_firewall_rule_create()
1583  * @see stc_firewall_rule_destroy()
1584  * @see stc_firewall_rule_set_nflog_group()
1585  */
1586 int stc_firewall_rule_get_nflog_group(stc_firewall_rule_h rule_h,
1587                         unsigned int *group);
1588
1589 int stc_firewall_rule_get_nflog_prefix(stc_firewall_rule_h rule_h,
1590                         char **prefix);
1591
1592 int stc_firewall_rule_get_nflog_range(stc_firewall_rule_h rule_h,
1593                         unsigned int *range);
1594
1595 int stc_firewall_rule_get_nflog_threshold(stc_firewall_rule_h rule_h,
1596                         unsigned int *threshold);
1597
1598 /**
1599  * @brief Adds the rule.
1600  * @since_tizen 5.0
1601  * @privlevel platform
1602  * @privilege %http://tizen.org/privilege/firewall.common
1603  *
1604  * @param[in] rule       The firewall rule handle
1605  *
1606  * @return 0 on success, otherwise a negative error value
1607  * @retval #STC_ERROR_NONE Successful
1608  * @retval #STC_ERROR_OPERATION_FAILED General error
1609  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
1610  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
1611  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
1612  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
1613  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
1614  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
1615  *
1616  * @see #stc_firewall_rule_h
1617  * @see stc_firewall_rule_create()
1618  * @see stc_firewall_rule_destroy()
1619  */
1620 int stc_firewall_rule_add(stc_firewall_rule_h rule_h);
1621
1622 /**
1623  * @brief Removes the rule.
1624  * @since_tizen 5.0
1625  * @privlevel platform
1626  * @privilege %http://tizen.org/privilege/firewall.common
1627  *
1628  * @param[in] rule       The firewall rule handle
1629  *
1630  * @return 0 on success, otherwise a negative error value
1631  * @retval #STC_ERROR_NONE Successful
1632  * @retval #STC_ERROR_OPERATION_FAILED General error
1633  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
1634  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
1635  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
1636  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
1637  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
1638  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
1639  *
1640  * @see #stc_firewall_rule_h
1641  * @see stc_firewall_rule_create()
1642  * @see stc_firewall_rule_destroy()
1643  */
1644 int stc_firewall_rule_remove(stc_firewall_rule_h rule_h);
1645
1646 /**
1647  * @brief Updates the rule.
1648  * @since_tizen 5.0
1649  * @privlevel platform
1650  * @privilege %http://tizen.org/privilege/firewall.common
1651  *
1652  * @param[in] rule       The firewall rule handle
1653  *
1654  * @return 0 on success, otherwise a negative error value
1655  * @retval #STC_ERROR_NONE Successful
1656  * @retval #STC_ERROR_OPERATION_FAILED General error
1657  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
1658  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
1659  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
1660  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
1661  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
1662  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
1663  *
1664  * @see #stc_firewall_rule_h
1665  * @see stc_firewall_rule_create()
1666  * @see stc_firewall_rule_destroy()
1667  */
1668 int stc_firewall_rule_update(stc_firewall_rule_h rule_h);
1669
1670 /**
1671  * @brief Gets all rules.
1672  * @since_tizen 5.0
1673  * @privlevel platform
1674  * @privilege %http://tizen.org/privilege/firewall.common
1675  *
1676  * @param[in] stc        The stc handle
1677  * @param[in] callback   The callback to be called
1678  * @param[in] user_data  The user data passed to the callback function
1679  *
1680  * @return 0 on success, otherwise a negative error value
1681  * @retval #STC_ERROR_NONE Successful
1682  * @retval #STC_ERROR_OPERATION_FAILED General error
1683  * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
1684  * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
1685  * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
1686  * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
1687  * @retval #STC_ERROR_NOT_SUPPORTED Not supported
1688  * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
1689  *
1690  * @see #stc_firewall_rule_h
1691  * @see stc_firewall_rule_create()
1692  * @see stc_firewall_rule_destroy()
1693  */
1694 int stc_firewall_rule_foreach(stc_h stc,
1695                         stc_firewall_rule_info_cb callback, void *user_data);
1696
1697 /**
1698 * @}
1699 */
1700
1701 #ifdef __cplusplus
1702 }
1703 #endif
1704
1705 #endif /* __TIZEN_STC_FW_INTERNAL_H__ */