WARNING: The online documentation has moved to https://docs.pjsip.org.

Visit the new documentation at https://docs.pjsip.org:

BLOG | DOCUMENTATION | GITHUB

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

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)
 

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.

Typedef Documentation

◆ pj_dns_server

typedef struct pj_dns_server pj_dns_server

Opaque structure to hold DNS server instance.

Function Documentation

◆ pj_dns_server_add_rec()

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
srvThe DNS server instance.
countNumber of records to be added.
rrArray of records to be added.
Returns
PJ_SUCCESS on success or the appropriate error code.

◆ pj_dns_server_create()

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
pfThe pool factory to create memory pools.
ioqueueIoqueue instance where the server socket will be registered to.
afAddress family of the server socket (valid values are pj_AF_INET() for IPv4 and pj_AF_INET6() for IPv6).
portThe UDP port to listen.
flagsFlags, currently must be zero.
p_srvPointer 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_dns_server_del_rec()

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
srvThe DNS server instance.
dns_classThe resource's DNS class. Valid value is PJ_DNS_CLASS_IN.
typeThe resource type.
nameThe resource name to be removed.
Returns
PJ_SUCCESS on success or the appropriate error code.

References PJ_END_DECL.

◆ pj_dns_server_destroy()

pj_status_t pj_dns_server_destroy ( pj_dns_server srv)

Destroy DNS server instance.

Parameters
srvThe 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
Copyright (C) 2006-2009 Teluu Inc.