2 * Smart Traffic Control (STC)
4 * Copyright (c) 2017 Samsung Electronics Co., Ltd. All rights reserved.
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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
20 #ifndef __TIZEN_STC_FW_INTERNAL_H__
21 #define __TIZEN_STC_FW_INTERNAL_H__
28 * @file stc_fw_internal.h
31 /*****************************************************************************
33 *****************************************************************************/
38 /*****************************************************************************
40 *****************************************************************************/
43 * @addtogroup CAPI_NETWORK_STC_FIREWALL_MODULE
48 * @brief The firewall chain handle.
51 typedef void *stc_firewall_chain_h;
54 * @brief The firewall rule handle.
57 typedef void *stc_firewall_rule_h;
63 /*****************************************************************************
65 *****************************************************************************/
68 * @addtogroup CAPI_NETWORK_STC_FIREWALL_MODULE
74 STC_FIREWALL_UNLOCKED,
76 } stc_firewall_lock_e;
79 * @brief Enumeration for firewall direction.
83 STC_FIREWALL_DIRECTION_NONE,
84 STC_FIREWALL_DIRECTION_IN,
85 STC_FIREWALL_DIRECTION_OUT
86 } stc_firewall_direction_e;
89 * @brief Enumeration for firewall IP type.
94 STC_FIREWALL_IP_SINGLE,
97 } stc_firewall_ip_type_e;
100 * @brief Enumeration for firewall port type.
104 STC_FIREWALL_PORT_NONE,
105 STC_FIREWALL_PORT_SINGLE,
106 STC_FIREWALL_PORT_RANGE
107 } stc_firewall_port_type_e;
110 * @brief Enumeration for firewall protocol type.
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;
122 * @brief Enumeration for firewall family type.
126 STC_FIREWALL_FAMILY_NONE,
127 STC_FIREWALL_FAMILY_V4,
128 STC_FIREWALL_FAMILY_V6
129 } stc_firewall_family_type_e;
132 * @brief Enumeration for firewall chain target.
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;
143 * @brief Enumeration for firewall rule target.
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;
160 /*****************************************************************************
162 *****************************************************************************/
165 * @addtogroup CAPI_NETWORK_STC_FIREWALL_MODULE
170 * @brief Called for enumerate firewall chain information.
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
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()
184 typedef stc_callback_ret_e (*stc_firewall_chain_info_cb)(stc_firewall_chain_h info_h,
188 * @brief Called for enumerate firewall rule information.
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
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()
213 typedef stc_callback_ret_e (*stc_firewall_rule_info_cb)(stc_firewall_rule_h info,
220 /*****************************************************************************
222 *****************************************************************************/
225 * @addtogroup CAPI_NETWORK_STC_FIREWALL_MODULE
230 * @brief Locks the firewall.
232 * @privlevel platform
233 * @privilege %http://tizen.org/privilege/firewall.admin
235 * @param[in] stc The stc handle
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
248 * @see stc_initialize()
249 * @see stc_firewall_unlock()
250 * @see stc_firewall_get_lock()
252 int stc_firewall_lock(stc_h stc);
255 * @brief Unlocks the firewall.
257 * @privlevel platform
258 * @privilege %http://tizen.org/privilege/firewall.admin
260 * @param[in] stc The stc handle
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
273 * @see stc_initialize()
274 * @see stc_firewall_lock()
275 * @see stc_firewall_get_lock()
277 int stc_firewall_unlock(stc_h stc);
280 * @brief Gets the firewall lock state.
282 * @privlevel platform
283 * @privilege %http://tizen.org/privilege/firewall.admin
285 * @param[in] stc The stc handle
286 * @param[out] state The firewall lock state
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
299 * @see stc_initialize()
300 * @see stc_firewall_lock()
301 * @see stc_firewall_unlock()
303 int stc_firewall_get_lock(stc_h stc, stc_firewall_lock_e *state);
306 * @brief Creates the firewall chain handle.
308 * @remarks You must release @a handle using stc_firewall_chain_destroy().
310 * @param[in] stc The stc handle
311 * @param[in] name The chain name
312 * @param[out] chain The firewall chain handle
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
325 * @see #stc_firewall_chain_h
326 * @see stc_initialize()
327 * @see stc_firewall_chain_destroy()
329 int stc_firewall_chain_create(stc_h stc, const char *name,
330 stc_firewall_chain_h *chain_h);
333 * @brief Clones the firewall chain handle.
335 * @remarks You must release @a handle using stc_firewall_chain_destroy().
337 * @param[in] origin The origin firewall chain handle
338 * @param[out] cloned_chain The cloned firewall chain handle
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
351 * @see #stc_firewall_chain_h
352 * @see stc_initialize()
353 * @see stc_firewall_chain_create()
354 * @see stc_firewall_chain_destroy()
356 int stc_firewall_chain_clone(stc_firewall_chain_h origin_h,
357 stc_firewall_chain_h *cloned_chain_h);
360 * @brief Destroys the firewall chain handle.
363 * @param[in] chain The firewall chain handle
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
375 * @see #stc_firewall_chain_h
376 * @see stc_firewall_chain_create()
378 int stc_firewall_chain_destroy(stc_firewall_chain_h chain_h);
381 * @brief Gets the name for chain.
384 * @param[in] chain The firewall chain handle
385 * @param[out] name The chain name
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
397 * @see #stc_firewall_chain_h
398 * @see stc_firewall_chain_create()
399 * @see stc_firewall_chain_destroy()
401 int stc_firewall_chain_get_name(stc_firewall_chain_h chain, char **name);
404 * @brief Gets the target type for chain.
407 * @param[in] chain The firewall chain handle
408 * @param[out] target The target type
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
420 * @see #stc_firewall_chain_h
421 * @see stc_firewall_chain_create()
422 * @see stc_firewall_chain_destroy()
424 int stc_firewall_chain_get_target(stc_firewall_chain_h chain_h,
425 stc_firewall_chain_target_e *target);
428 * @brief Gets the priority for chain.
431 * @param[in] chain The firewall chain handle
432 * @param[out] priority The priority
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
444 * @see #stc_firewall_chain_h
445 * @see stc_firewall_chain_create()
446 * @see stc_firewall_chain_destroy()
448 int stc_firewall_chain_get_priority(stc_firewall_chain_h chain_h,
449 unsigned int *priority);
452 * @brief Adds the chain.
454 * @privlevel platform
455 * @privilege %http://tizen.org/privilege/firewall.common
457 * @param[in] chain The firewall chain handle
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
469 * @see #stc_firewall_chain_h
470 * @see stc_firewall_chain_create()
471 * @see stc_firewall_chain_destroy()
473 int stc_firewall_chain_add(stc_firewall_chain_h chain_h);
476 * @brief Removes the chain.
478 * @privlevel platform
479 * @privilege %http://tizen.org/privilege/firewall.common
481 * @param[in] chain The firewall chain handle
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
493 * @see #stc_firewall_chain_h
494 * @see stc_firewall_chain_create()
495 * @see stc_firewall_chain_destroy()
497 int stc_firewall_chain_remove(stc_firewall_chain_h chain_h);
500 * @brief Flushs the chain.
502 * @privlevel platform
503 * @privilege %http://tizen.org/privilege/firewall.common
505 * @param[in] chain The firewall chain handle
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
517 * @see #stc_firewall_chain_h
518 * @see stc_firewall_chain_create()
519 * @see stc_firewall_chain_destroy()
521 int stc_firewall_chain_flush(stc_firewall_chain_h chain_h);
524 * @brief Gets all chains.
526 * @privlevel platform
527 * @privilege %http://tizen.org/privilege/firewall.common
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
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
543 * @see #stc_firewall_chain_h
544 * @see stc_firewall_chain_create()
545 * @see stc_firewall_chain_destroy()
547 int stc_firewall_chain_foreach(stc_h stc,
548 stc_firewall_chain_info_cb callback, void *user_data);
551 * @brief Sets the chain to target.
553 * @privlevel platform
554 * @privilege %http://tizen.org/privilege/firewall.common
555 * @remarks You should set only one chain.
557 * @param[in] chain The firewall chain handle
558 * @param[in] target The target type
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
570 * @see #stc_firewall_chain_h
571 * @see stc_firewall_chain_create()
572 * @see stc_firewall_chain_destroy()
574 int stc_firewall_chain_set(stc_firewall_chain_h chain_h,
575 stc_firewall_chain_target_e target);
578 * @brief Unsets the chain.
580 * @privlevel platform
581 * @privilege %http://tizen.org/privilege/firewall.common
583 * @param[in] chain The firewall chain handle
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
595 * @see #stc_firewall_chain_h
596 * @see stc_firewall_chain_create()
597 * @see stc_firewall_chain_destroy()
599 int stc_firewall_chain_unset(stc_firewall_chain_h chain_h);
602 * @brief Creates the firewall rule handle.
604 * @remarks You must release @a handle using stc_firewall_rule_destroy().
606 * @param[in] stc The stc handle
607 * @param[out] rule The firewall rule handle
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
620 * @see #stc_firewall_rule_h
621 * @see stc_initialize()
622 * @see stc_firewall_rule_destroy()
624 int stc_firewall_rule_create(stc_h stc, stc_firewall_rule_h *rule_h);
627 * @brief Clones the firewall rule handle.
629 * @remarks You must release @a handle using stc_firewall_rule_destroy().
631 * @param[in] origin The origin firewall rule handle
632 * @param[out] cloned_rule The cloned firewall rule handle
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
645 * @see #stc_firewall_rule_h
646 * @see stc_initialize()
647 * @see stc_firewall_rule_create()
648 * @see stc_firewall_rule_destroy()
650 int stc_firewall_rule_clone(stc_firewall_rule_h origin_h,
651 stc_firewall_rule_h *cloned_rule_h);
654 * @brief Destroys the firewall rule handle.
657 * @param[in] rule The firewall chain handle
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
669 * @see #stc_firewall_rule_h
670 * @see stc_firewall_rule_create()
672 int stc_firewall_rule_destroy(stc_firewall_rule_h rule_h);
675 * @brief Sets the chain name to rule.
678 * @param[in] rule The firewall rule handle
679 * @param[in] chain The chain name
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
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()
696 int stc_firewall_rule_set_chain(stc_firewall_rule_h rule_h, char *chain);
699 * @brief Sets the direction to rule.
702 * @param[in] rule The firewall rule handle
703 * @param[in] direction The direction
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
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()
720 int stc_firewall_rule_set_direction(stc_firewall_rule_h rule_h,
721 stc_firewall_direction_e direction);
724 * @brief Sets the source IP type to rule.
727 * @param[in] rule The firewall rule handle
728 * @param[in] type The IP type
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
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()
745 int stc_firewall_rule_set_src_ip_type(stc_firewall_rule_h rule_h,
746 stc_firewall_ip_type_e type);
749 * @brief Sets the destination IP type to rule.
752 * @param[in] rule The firewall rule handle
753 * @param[in] type The IP type
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
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()
770 int stc_firewall_rule_set_dst_ip_type(stc_firewall_rule_h rule_h,
771 stc_firewall_ip_type_e type);
774 * @brief Sets the source port type to rule.
777 * @param[in] rule The firewall rule handle
778 * @param[in] type The port type
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
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()
795 int stc_firewall_rule_set_src_port_type(stc_firewall_rule_h rule_h,
796 stc_firewall_port_type_e type);
799 * @brief Sets the destination port type to rule.
802 * @param[in] rule The firewall rule handle
803 * @param[in] type The port type
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
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()
820 int stc_firewall_rule_set_dst_port_type(stc_firewall_rule_h rule_h,
821 stc_firewall_port_type_e type);
824 * @brief Sets the protocol type to rule.
827 * @param[in] rule The firewall rule handle
828 * @param[in] type The protocol type
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
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()
845 int stc_firewall_rule_set_protocol_type(stc_firewall_rule_h rule_h,
846 stc_firewall_protocol_type_e type);
849 * @brief Sets the address family type to rule.
852 * @param[in] rule The firewall rule handle
853 * @param[in] type The address family type
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
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()
870 int stc_firewall_rule_set_family_type(stc_firewall_rule_h rule_h,
871 stc_firewall_family_type_e type);
874 * @brief Sets source IP addresses to rule.
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
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
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()
897 int stc_firewall_rule_set_src_ip(stc_firewall_rule_h rule_h,
898 char *ip1, char *ip2);
901 * @brief Sets destination IP addresses to rule.
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
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
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()
924 int stc_firewall_rule_set_dst_ip(stc_firewall_rule_h rule_h,
925 char *ip1, char *ip2);
928 * @brief Sets source ports to rule.
931 * @param[in] rule The firewall rule handle
932 * @param[in] port1 The port 1
933 * @param[in] port2 The port 2
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
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()
951 int stc_firewall_rule_set_src_port(stc_firewall_rule_h rule_h,
952 unsigned int port1, unsigned int port2);
955 * @brief Sets destination ports to rule.
958 * @param[in] rule The firewall rule handle
959 * @param[in] port1 The port 1
960 * @param[in] port2 The port 2
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
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()
978 int stc_firewall_rule_set_dst_port(stc_firewall_rule_h rule_h,
979 unsigned int port1, unsigned int port2);
982 * @brief Sets interface name to rule.
985 * @param[in] rule The firewall rule handle
986 * @param[in] ifname The interface name
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
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()
1003 int stc_firewall_rule_set_ifname(stc_firewall_rule_h rule_h, char *ifname);
1006 * @brief Sets target type to rule.
1009 * @param[in] rule The firewall rule handle
1010 * @param[in] target The target type
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
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()
1027 int stc_firewall_rule_set_target(stc_firewall_rule_h rule_h,
1028 stc_firewall_rule_target_e target);
1031 * @brief Sets log level to rule.
1034 * @param[in] rule The firewall rule handle
1035 * @param[in] level The level
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
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()
1052 int stc_firewall_rule_set_log_level(stc_firewall_rule_h rule_h,
1053 unsigned char level);
1056 * @brief Sets log prefix to rule.
1059 * @param[in] rule The firewall rule handle
1060 * @param[in] prefix The prefix
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
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()
1077 int stc_firewall_rule_set_log_prefix(stc_firewall_rule_h rule_h,
1081 * @brief Sets nflog group to rule.
1084 * @param[in] rule The firewall rule handle
1085 * @param[in] group The group
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
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()
1102 int stc_firewall_rule_set_nflog_group(stc_firewall_rule_h rule_h,
1103 unsigned int group);
1106 * @brief Sets nflog prefix to rule.
1109 * @param[in] rule The firewall rule handle
1110 * @param[in] prefix The prefix
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
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()
1127 int stc_firewall_rule_set_nflog_prefix(stc_firewall_rule_h rule_h,
1131 * @brief Sets nflog range to rule.
1134 * @param[in] rule The firewall rule handle
1135 * @param[in] range The range
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
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()
1152 int stc_firewall_rule_set_nflog_range(stc_firewall_rule_h rule_h,
1153 unsigned int range);
1156 * @brief Sets nflog threshold to rule.
1159 * @param[in] rule The firewall rule handle
1160 * @param[in] threshold The threshold
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
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()
1177 int stc_firewall_rule_set_nflog_threshold(stc_firewall_rule_h rule_h,
1178 unsigned int threshold);
1181 * @brief Gets the chain name from rule.
1184 * @param[in] rule The firewall rule handle
1185 * @param[out] chain The chain name
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
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()
1202 int stc_firewall_rule_get_chain(stc_firewall_rule_h rule_h, char **chain);
1205 * @brief Gets the direction from rule.
1208 * @param[in] rule The firewall rule handle
1209 * @param[out] direction The direction
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
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()
1226 int stc_firewall_rule_get_direction(stc_firewall_rule_h rule_h,
1227 stc_firewall_direction_e *direction);
1230 * @brief Gets the source IP type from rule.
1233 * @param[in] rule The firewall rule handle
1234 * @param[out] type The IP type
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
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()
1251 int stc_firewall_rule_get_src_ip_type(stc_firewall_rule_h rule_h,
1252 stc_firewall_ip_type_e *type);
1255 * @brief Gets the destination IP type from rule.
1258 * @param[in] rule The firewall rule handle
1259 * @param[out] type The IP type
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
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()
1276 int stc_firewall_rule_get_dst_ip_type(stc_firewall_rule_h rule_h,
1277 stc_firewall_ip_type_e *type);
1280 * @brief Gets the source port type from rule.
1283 * @param[in] rule The firewall rule handle
1284 * @param[out] type The port type
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
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()
1301 int stc_firewall_rule_get_src_port_type(stc_firewall_rule_h rule_h,
1302 stc_firewall_port_type_e *type);
1305 * @brief Gets the destination port type from rule.
1308 * @param[in] rule The firewall rule handle
1309 * @param[out] type The port type
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
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()
1326 int stc_firewall_rule_get_dst_port_type(stc_firewall_rule_h rule_h,
1327 stc_firewall_port_type_e *type);
1330 * @brief Gets the protocol type from rule.
1333 * @param[in] rule The firewall rule handle
1334 * @param[out] type The protocol type
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
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()
1351 int stc_firewall_rule_get_protocol_type(stc_firewall_rule_h rule_h,
1352 stc_firewall_protocol_type_e *type);
1355 * @brief Gets the address family type from rule.
1358 * @param[in] rule The firewall rule handle
1359 * @param[out] type The address family type
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
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()
1376 int stc_firewall_rule_get_family_type(stc_firewall_rule_h rule_h,
1377 stc_firewall_family_type_e *type);
1380 * @brief Gets the source IP addresses from rule.
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
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
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()
1403 int stc_firewall_rule_get_src_ip(stc_firewall_rule_h rule_h,
1404 char **ip1, char **ip2);
1407 * @brief Gets the destination IP addresses from rule.
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
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
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()
1430 int stc_firewall_rule_get_dst_ip(stc_firewall_rule_h rule_h,
1431 char **ip1, char **ip2);
1434 * @brief Gets the source ports from rule.
1437 * @param[in] rule The firewall rule handle
1438 * @param[out] port1 The port 1
1439 * @param[out] port2 The port 2
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
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()
1457 int stc_firewall_rule_get_src_port(stc_firewall_rule_h rule_h,
1458 unsigned int *port1, unsigned int *port2);
1461 * @brief Gets the destination ports from rule.
1464 * @param[in] rule The firewall rule handle
1465 * @param[out] port1 The port 1
1466 * @param[out] port2 The port 2
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
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()
1484 int stc_firewall_rule_get_dst_port(stc_firewall_rule_h rule_h,
1485 unsigned int *port1, unsigned int *port2);
1488 * @brief Gets the interface name from rule.
1491 * @param[in] rule The firewall rule handle
1492 * @param[out] ifname The interface name
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
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()
1509 int stc_firewall_rule_get_ifname(stc_firewall_rule_h rule_h, char **ifname);
1512 * @brief Gets the target type from rule.
1515 * @param[in] rule The firewall rule handle
1516 * @param[out] target The target type
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
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()
1533 int stc_firewall_rule_get_target(stc_firewall_rule_h rule_h,
1534 stc_firewall_rule_target_e *target);
1537 * @brief Gets log level from rule.
1540 * @param[in] rule The firewall rule handle
1541 * @param[out] level The level
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
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()
1558 int stc_firewall_rule_get_log_level(stc_firewall_rule_h rule_h,
1559 unsigned char *level);
1561 int stc_firewall_rule_get_log_prefix(stc_firewall_rule_h rule_h,
1565 * @brief Gets nflog group from rule.
1568 * @param[in] rule The firewall rule handle
1569 * @param[out] group The group
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
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()
1586 int stc_firewall_rule_get_nflog_group(stc_firewall_rule_h rule_h,
1587 unsigned int *group);
1589 int stc_firewall_rule_get_nflog_prefix(stc_firewall_rule_h rule_h,
1592 int stc_firewall_rule_get_nflog_range(stc_firewall_rule_h rule_h,
1593 unsigned int *range);
1595 int stc_firewall_rule_get_nflog_threshold(stc_firewall_rule_h rule_h,
1596 unsigned int *threshold);
1599 * @brief Adds the rule.
1601 * @privlevel platform
1602 * @privilege %http://tizen.org/privilege/firewall.common
1604 * @param[in] rule The firewall rule handle
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
1616 * @see #stc_firewall_rule_h
1617 * @see stc_firewall_rule_create()
1618 * @see stc_firewall_rule_destroy()
1620 int stc_firewall_rule_add(stc_firewall_rule_h rule_h);
1623 * @brief Removes the rule.
1625 * @privlevel platform
1626 * @privilege %http://tizen.org/privilege/firewall.common
1628 * @param[in] rule The firewall rule handle
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
1640 * @see #stc_firewall_rule_h
1641 * @see stc_firewall_rule_create()
1642 * @see stc_firewall_rule_destroy()
1644 int stc_firewall_rule_remove(stc_firewall_rule_h rule_h);
1647 * @brief Updates the rule.
1649 * @privlevel platform
1650 * @privilege %http://tizen.org/privilege/firewall.common
1652 * @param[in] rule The firewall rule handle
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
1664 * @see #stc_firewall_rule_h
1665 * @see stc_firewall_rule_create()
1666 * @see stc_firewall_rule_destroy()
1668 int stc_firewall_rule_update(stc_firewall_rule_h rule_h);
1671 * @brief Gets all rules.
1673 * @privlevel platform
1674 * @privilege %http://tizen.org/privilege/firewall.common
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
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
1690 * @see #stc_firewall_rule_h
1691 * @see stc_firewall_rule_create()
1692 * @see stc_firewall_rule_destroy()
1694 int stc_firewall_rule_foreach(stc_h stc,
1695 stc_firewall_rule_info_cb callback, void *user_data);
1705 #endif /* __TIZEN_STC_FW_INTERNAL_H__ */