pjsip logo pjsip.org
Open source SIP stack and media stack for presence, im/instant messaging, and multimedia communication

HOME

SIP/media Features
High Performance SIP
Small Footprint SIP
Symbian Port

FAQ

Documentation

Licensing

Download

Development (Trac)

Projects using pjsip

Mailing List

Open Source Links


About: PJLIB, PJLIB-UTIL, PJSIP, and PJMEDIA are created by: Benny Prijono
<bennylp@pjsip.org>


 

Home --> Documentations --> PJLIB-UTIL Reference

Simple DNS Server
[DNS and Asynchronous DNS Resolver]


Detailed Description

This contains a simple but fully working DNS server implementation, mostly for testing purposes. It supports serving various DNS resource records such as SRV, CNAME, A, and AAAA.


Typedefs

typedef struct pj_dns_server pj_dns_server

Functions

pj_status_t pj_dns_server_create (pj_pool_factory *pf, pj_ioqueue_t *ioqueue, int af, unsigned port, unsigned flags, pj_dns_server **p_srv)
pj_status_t pj_dns_server_destroy (pj_dns_server *srv)
pj_status_t pj_dns_server_add_rec (pj_dns_server *srv, unsigned count, const pj_dns_parsed_rr rr[])
pj_status_t pj_dns_server_del_rec (pj_dns_server *srv, int dns_class, pj_dns_type type, const pj_str_t *name)


Typedef Documentation

typedef struct pj_dns_server pj_dns_server

Opaque structure to hold DNS server instance.


Function Documentation

pj_status_t pj_dns_server_add_rec ( pj_dns_server srv,
unsigned  count,
const pj_dns_parsed_rr  rr[] 
)

Add generic resource record entries to the server.

Parameters:
srv The DNS server instance.
count Number of records to be added.
rr Array of records to be added.
Returns:
PJ_SUCCESS on success or the appropriate error code.

pj_status_t pj_dns_server_create ( pj_pool_factory pf,
pj_ioqueue_t ioqueue,
int  af,
unsigned  port,
unsigned  flags,
pj_dns_server **  p_srv 
)

Create the DNS server instance. The instance will run immediately.

Parameters:
pf The pool factory to create memory pools.
ioqueue Ioqueue instance where the server socket will be registered to.
af Address family of the server socket (valid values are pj_AF_INET() for IPv4 and pj_AF_INET6() for IPv6).
port The UDP port to listen.
flags Flags, currently must be zero.
p_srv Pointer to receive the DNS server instance.
Returns:
PJ_SUCCESS if server has been created successfully, otherwise the function will return the appropriate error code.

pj_status_t pj_dns_server_del_rec ( pj_dns_server srv,
int  dns_class,
pj_dns_type  type,
const pj_str_t name 
)

Remove the specified record from the server.

Parameters:
srv The DNS server instance.
dns_class The resource's DNS class. Valid value is PJ_DNS_CLASS_IN.
type The resource type.
name The resource name to be removed.
Returns:
PJ_SUCCESS on success or the appropriate error code.

pj_status_t pj_dns_server_destroy ( pj_dns_server srv  ) 

Destroy DNS server instance.

Parameters:
srv The DNS server instance.
Returns:
PJ_SUCCESS on success or the appropriate error code.

 


PJLIB-UTIL Open Source, small footprint, and portable asynchronous/caching DNS resolver, text scanner, STUN client, and XML library
(C)2001-2008 Benny Prijono