/** * @file ind.c STUN Indication * * Copyright (C) 2010 Creytiv.com */ #include #include #include #include #include #include #include #include "stun.h" int stun_indication(int proto, void *sock, const struct sa *dst, size_t presz, uint16_t method, const uint8_t *key, size_t keylen, bool fp, uint32_t attrc, ...) { uint8_t tid[STUN_TID_SIZE]; struct mbuf *mb; va_list ap; uint32_t i; int err; if (!sock) return EINVAL; mb = mbuf_alloc(2048); if (!mb) return ENOMEM; for (i=0; ipos = presz; err = stun_msg_vencode(mb, method, STUN_CLASS_INDICATION, tid, NULL, key, keylen, fp, 0x00, attrc, ap); va_end(ap); if (err) goto out; mb->pos = presz; err = stun_send(proto, sock, dst, mb); out: mem_deref(mb); return err; }