stun/dtls: adding stun_transp_name() and dtls_udp_sock() functions
This commit is contained in:
parent
6c99fc36f0
commit
7c2d0d03d2
4 changed files with 34 additions and 0 deletions
|
@ -225,6 +225,7 @@ void stun_msg_dump(const struct stun_msg *msg);
|
||||||
const char *stun_class_name(uint16_t cls);
|
const char *stun_class_name(uint16_t cls);
|
||||||
const char *stun_method_name(uint16_t method);
|
const char *stun_method_name(uint16_t method);
|
||||||
const char *stun_attr_name(uint16_t type);
|
const char *stun_attr_name(uint16_t type);
|
||||||
|
const char *stun_transp_name(enum stun_transp tp);
|
||||||
|
|
||||||
|
|
||||||
/* DNS Discovery of a STUN Server */
|
/* DNS Discovery of a STUN Server */
|
||||||
|
|
|
@ -60,6 +60,7 @@ struct dtls_sock;
|
||||||
int dtls_listen(struct dtls_sock **sockp, const struct sa *laddr,
|
int dtls_listen(struct dtls_sock **sockp, const struct sa *laddr,
|
||||||
struct udp_sock *us, uint32_t htsize, int layer,
|
struct udp_sock *us, uint32_t htsize, int layer,
|
||||||
dtls_conn_h *connh, void *arg);
|
dtls_conn_h *connh, void *arg);
|
||||||
|
struct udp_sock *dtls_udp_sock(struct dtls_sock *sock);
|
||||||
int dtls_connect(struct tls_conn **ptc, struct tls *tls,
|
int dtls_connect(struct tls_conn **ptc, struct tls *tls,
|
||||||
struct dtls_sock *sock, const struct sa *peer,
|
struct dtls_sock *sock, const struct sa *peer,
|
||||||
dtls_estab_h *estabh, dtls_recv_h *recvh,
|
dtls_estab_h *estabh, dtls_recv_h *recvh,
|
||||||
|
|
|
@ -25,3 +25,22 @@ const char *stun_reason_443 = "Peer Address Family Mismatch";
|
||||||
const char *stun_reason_486 = "Allocation Quota Reached";
|
const char *stun_reason_486 = "Allocation Quota Reached";
|
||||||
const char *stun_reason_500 = "Server Error";
|
const char *stun_reason_500 = "Server Error";
|
||||||
const char *stun_reason_508 = "Insufficient Capacity";
|
const char *stun_reason_508 = "Insufficient Capacity";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the name of a given STUN Transport
|
||||||
|
*
|
||||||
|
* @param tp STUN Transport
|
||||||
|
*
|
||||||
|
* @return Name of the corresponding STUN Transport
|
||||||
|
*/
|
||||||
|
const char *stun_transp_name(enum stun_transp tp)
|
||||||
|
{
|
||||||
|
switch (tp) {
|
||||||
|
|
||||||
|
case STUN_TRANSP_UDP: return "UDP";
|
||||||
|
case STUN_TRANSP_TCP: return "TCP";
|
||||||
|
case STUN_TRANSP_DTLS: return "DTLS";
|
||||||
|
default: return "???";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -715,3 +715,16 @@ int dtls_listen(struct dtls_sock **sockp, const struct sa *laddr,
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the underlying UDP socket of a DTLS Socket
|
||||||
|
*
|
||||||
|
* @param sock DTLS Socket
|
||||||
|
*
|
||||||
|
* @return UDP Socket
|
||||||
|
*/
|
||||||
|
struct udp_sock *dtls_udp_sock(struct dtls_sock *sock)
|
||||||
|
{
|
||||||
|
return sock ? sock->us : NULL;
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue