Annotation of embedaddon/trafshow/domain_resolver.h, revision 1.1

1.1     ! misho       1: /*
        !             2:  *     Copyright (c) 2003 Rinet Corp., Novosibirsk, Russia
        !             3:  *
        !             4:  * Redistribution and use in source forms, with and without modification,
        !             5:  * are permitted provided that this entire comment appears intact.
        !             6:  *
        !             7:  * THIS SOURCE CODE IS PROVIDED ``AS IS'' WITHOUT ANY WARRANTIES OF ANY KIND.
        !             8:  */
        !             9: 
        !            10: #ifndef        _DOMAIN_RESOLVER_H_
        !            11: #define        _DOMAIN_RESOLVER_H_
        !            12: 
        !            13: /*
        !            14:  * Domain Name Service support.
        !            15:  */
        !            16: 
        !            17: #include <sys/types.h>
        !            18: #include <netinet/in.h>
        !            19: 
        !            20: #define        NAMESERVER_TIMEOUT      10      /* awaiting reply in seconds */
        !            21: #define        NAMESERVER_RETRIES      3       /* max number of retries */
        !            22: 
        !            23: typedef        struct domain_data_ent {
        !            24:        u_int ttl;              /* max seconds may be cached */
        !            25:        u_int pref;             /* preference if any (for ex. in MX list) */
        !            26:        char *name;             /* domain name */
        !            27:        in_addr_t addr;         /* ip address */
        !            28: 
        !            29:        struct domain_data_ent *next;
        !            30: } DOMAIN_DATA;
        !            31: 
        !            32: struct session_ent;
        !            33: 
        !            34: /*
        !            35:  * [Re]initialize nameservers (probably using /etc/resolv.conf).
        !            36:  * Public just for nameservers to be reconfigured by outside signals.
        !            37:  */
        !            38: int domain_resolver_init();
        !            39: 
        !            40: /*
        !            41:  * Get IP address at the domain asynchronously.
        !            42:  * If return -1 (an error) requester of this function will not be notified.
        !            43:  */
        !            44: int domain_resolve_addr(const char *domain,
        !            45:                        struct session_ent *sd,
        !            46:                        void (*notify)(struct session_ent *sd, DOMAIN_DATA *dd));
        !            47: /*
        !            48:  * Get MX list at the domain asynchronously.
        !            49:  * If return -1 (an error) requester of this function will not be notified.
        !            50:  */
        !            51: int domain_resolve_mxlist(const char *domain,
        !            52:                          struct session_ent *sd,
        !            53:                          void (*notify)(struct session_ent *sd, DOMAIN_DATA *dd));
        !            54: /*
        !            55:  * Get domain name at the IP address asynchronously.
        !            56:  * If return -1 (an error) requester of this function will not be notified.
        !            57:  */
        !            58: int domain_resolve_name(in_addr_t ipaddr, /* Network Byte Order */
        !            59:                        struct session_ent *sd,
        !            60:                        void (*notify)(struct session_ent *sd, DOMAIN_DATA *dd));
        !            61: 
        !            62: /*
        !            63:  * Domain data container utilities.
        !            64:  */
        !            65: DOMAIN_DATA *domain_data_add(DOMAIN_DATA **list, const char *name, int pref);
        !            66: DOMAIN_DATA *domain_data_find(DOMAIN_DATA **list, const char *name);
        !            67: void domain_data_free(DOMAIN_DATA **list, const char *name); /* null to all */
        !            68: 
        !            69: #endif /* !_DOMAIN_RESOLVER_H_ */
        !            70: 

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