Asterisk - The Open Source Telephony Project GIT-master-f36a736
Functions
dns_srv.h File Reference

DNS SRV Record Parsing API. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

const char * ast_dns_srv_get_host (const struct ast_dns_record *record)
 Get the hostname from an SRV record. More...
 
unsigned short ast_dns_srv_get_port (const struct ast_dns_record *record)
 Get the port from an SRV record. More...
 
unsigned short ast_dns_srv_get_priority (const struct ast_dns_record *record)
 Get the priority from an SRV record. More...
 
unsigned short ast_dns_srv_get_weight (const struct ast_dns_record *record)
 Get the weight from an SRV record. More...
 

Detailed Description

DNS SRV Record Parsing API.

Author
Joshua Colp jcolp.nosp@m.@dig.nosp@m.ium.c.nosp@m.om

Definition in file dns_srv.h.

Function Documentation

◆ ast_dns_srv_get_host()

const char * ast_dns_srv_get_host ( const struct ast_dns_record record)

Get the hostname from an SRV record.

Parameters
recordThe DNS record
Returns
the hostname

Definition at line 188 of file dns_srv.c.

189{
190 struct ast_dns_srv_record *srv = (struct ast_dns_srv_record *) record;
191
192 ast_assert(ast_dns_record_get_rr_type(record) == T_SRV);
193 return srv->host;
194}
int ast_dns_record_get_rr_type(const struct ast_dns_record *record)
Get the resource record type of a DNS record.
Definition: dns_core.c:145
An SRV record.
Definition: dns_internal.h:74
const char * host
The hostname in the SRV record.
Definition: dns_internal.h:78
#define ast_assert(a)
Definition: utils.h:739

References ast_assert, ast_dns_record_get_rr_type(), and ast_dns_srv_record::host.

Referenced by AST_TEST_DEFINE(), and nominal_test().

◆ ast_dns_srv_get_port()

unsigned short ast_dns_srv_get_port ( const struct ast_dns_record record)

Get the port from an SRV record.

Parameters
recordThe DNS record
Returns
the port

Definition at line 212 of file dns_srv.c.

213{
214 struct ast_dns_srv_record *srv = (struct ast_dns_srv_record *) record;
215
216 ast_assert(ast_dns_record_get_rr_type(record) == T_SRV);
217 return srv->port;
218}
unsigned short port
The port in the SRV record.
Definition: dns_internal.h:84

References ast_assert, ast_dns_record_get_rr_type(), and ast_dns_srv_record::port.

Referenced by AST_TEST_DEFINE(), and nominal_test().

◆ ast_dns_srv_get_priority()

unsigned short ast_dns_srv_get_priority ( const struct ast_dns_record record)

Get the priority from an SRV record.

Parameters
recordThe DNS record
Returns
the priority

Definition at line 196 of file dns_srv.c.

197{
198 struct ast_dns_srv_record *srv = (struct ast_dns_srv_record *) record;
199
200 ast_assert(ast_dns_record_get_rr_type(record) == T_SRV);
201 return srv->priority;
202}
unsigned short priority
The priority of the SRV record.
Definition: dns_internal.h:80

References ast_assert, ast_dns_record_get_rr_type(), and ast_dns_srv_record::priority.

Referenced by AST_TEST_DEFINE(), and nominal_test().

◆ ast_dns_srv_get_weight()

unsigned short ast_dns_srv_get_weight ( const struct ast_dns_record record)

Get the weight from an SRV record.

Parameters
recordThe DNS record
Returns
the weight

Definition at line 204 of file dns_srv.c.

205{
206 struct ast_dns_srv_record *srv = (struct ast_dns_srv_record *) record;
207
208 ast_assert(ast_dns_record_get_rr_type(record) == T_SRV);
209 return srv->weight;
210}
unsigned short weight
The weight of the SRV record.
Definition: dns_internal.h:82

References ast_assert, ast_dns_record_get_rr_type(), and ast_dns_srv_record::weight.

Referenced by AST_TEST_DEFINE(), and nominal_test().