Annotation of embedaddon/miniupnpd/upnpredirect.h, revision 1.1.1.3

1.1.1.3 ! misho       1: /* $Id: upnpredirect.h,v 1.35 2012/09/27 15:47:15 nanard Exp $ */
1.1       misho       2: /* MiniUPnP project
                      3:  * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
1.1.1.3 ! misho       4:  * (c) 2006-2012 Thomas Bernard
1.1       misho       5:  * This software is subject to the conditions detailed
                      6:  * in the LICENCE file provided within the distribution */
                      7: 
1.1.1.3 ! misho       8: #ifndef UPNPREDIRECT_H_INCLUDED
        !             9: #define UPNPREDIRECT_H_INCLUDED
1.1       misho      10: 
1.1.1.2   misho      11: /* for u_int64_t */
                     12: #include <sys/types.h>
                     13: 
1.1       misho      14: #include "config.h"
                     15: 
                     16: #ifdef ENABLE_LEASEFILE
1.1.1.2   misho      17: int reload_from_lease_file(void);
1.1       misho      18: #endif
                     19: 
1.1.1.3 ! misho      20: /* upnp_redirect()
1.1       misho      21:  * calls OS/fw dependant implementation of the redirection.
                     22:  * protocol should be the string "TCP" or "UDP"
                     23:  * returns: 0 on success
                     24:  *          -1 failed to redirect
                     25:  *          -2 already redirected
                     26:  *          -3 permission check failed
                     27:  */
                     28: int
1.1.1.3 ! misho      29: upnp_redirect(const char * rhost, unsigned short eport,
1.1       misho      30:               const char * iaddr, unsigned short iport,
1.1.1.2   misho      31:               const char * protocol, const char * desc,
                     32:               unsigned int leaseduration);
1.1       misho      33: 
                     34: /* upnp_redirect_internal()
                     35:  * same as upnp_redirect() without any check */
                     36: int
1.1.1.2   misho      37: upnp_redirect_internal(const char * rhost, unsigned short eport,
1.1       misho      38:                        const char * iaddr, unsigned short iport,
1.1.1.2   misho      39:                        int proto, const char * desc,
                     40:                        unsigned int timestamp);
1.1       misho      41: 
1.1.1.2   misho      42: /* upnp_get_redirection_infos()
                     43:  * returns : 0 on success
                     44:  *           -1 failed to get the port mapping entry or no entry exists */
1.1       misho      45: int
                     46: upnp_get_redirection_infos(unsigned short eport, const char * protocol,
                     47:                            unsigned short * iport, char * iaddr, int iaddrlen,
1.1.1.2   misho      48:                            char * desc, int desclen,
                     49:                            char * rhost, int rhostlen,
                     50:                            unsigned int * leaseduration);
                     51: 
                     52: /* upnp_get_redirection_infos_by_index()
                     53:  * returns : 0 on success
                     54:  *           -1 failed to get the port mapping or index out of range */
1.1       misho      55: int
                     56: upnp_get_redirection_infos_by_index(int index,
                     57:                                     unsigned short * eport, char * protocol,
1.1.1.3 ! misho      58:                                     unsigned short * iport,
1.1       misho      59:                                     char * iaddr, int iaddrlen,
1.1.1.2   misho      60:                                     char * desc, int desclen,
                     61:                                     char * rhost, int rhostlen,
                     62:                                     unsigned int * leaseduration);
1.1       misho      63: 
                     64: /* upnp_delete_redirection()
                     65:  * returns: 0 on success
                     66:  *          -1 on failure*/
                     67: int
                     68: upnp_delete_redirection(unsigned short eport, const char * protocol);
                     69: 
                     70: /* _upnp_delete_redir()
                     71:  * same as above */
                     72: int
                     73: _upnp_delete_redir(unsigned short eport, int proto);
                     74: 
                     75: /* Periodic cleanup functions
                     76:  */
                     77: struct rule_state
                     78: {
                     79:        u_int64_t packets;
                     80:        u_int64_t bytes;
                     81:        struct rule_state * next;
                     82:        unsigned short eport;
1.1.1.2   misho      83:        unsigned char proto;
1.1.1.3 ! misho      84:        unsigned char to_remove;
1.1       misho      85: };
                     86: 
1.1.1.2   misho      87: /* return a linked list of all rules
                     88:  * or an empty list if there are not enough
                     89:  * As a "side effect", delete rules which are expired */
1.1       misho      90: struct rule_state *
                     91: get_upnp_rules_state_list(int max_rules_number_target);
                     92: 
1.1.1.2   misho      93: /* return the number of port mapping entries */
1.1       misho      94: int
1.1.1.2   misho      95: upnp_get_portmapping_number_of_entries(void);
1.1       misho      96: 
                     97: /* remove_unused_rules() :
                     98:  * also free the list */
                     99: void
                    100: remove_unused_rules(struct rule_state * list);
                    101: 
1.1.1.2   misho     102: /* upnp_get_portmappings_in_range()
                    103:  * return a list of all "external" ports for which a port
                    104:  * mapping exists */
                    105: unsigned short *
                    106: upnp_get_portmappings_in_range(unsigned short startport,
                    107:                                unsigned short endport,
                    108:                                const char * protocol,
                    109:                                unsigned int * number);
                    110: 
1.1       misho     111: /* stuff for responding to miniupnpdctl */
                    112: #ifdef USE_MINIUPNPDCTL
                    113: void
                    114: write_ruleset_details(int s);
                    115: #endif
                    116: 
                    117: #endif
                    118: 
                    119: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>