O2 2.0
A communication protocol for interactive music and media applications.
stun.h
1// stun.h -- get public IP address using stun server
2//
3// Roger B. Dannenberg
4// August 2020
5
6#ifdef O2_NO_DEBUG
7#define TO_STUN_CLIENT(node) ((stun_client_ptr) (node))
8#else
9#define TO_STUN_CLIENT(node) (assert(ISA_STUN_CLIENT(node)), \
10 ((stun_client_ptr) (node)))
11#endif
12
13class Stun_info : public Proxy_info {
14 public:
15 Stun_info(Fds_info *fds_info_) : Proxy_info(NULL, O2TAG_STUN) {
16 fds_info = fds_info_;
17 fds_info->owner = this;
18 }
19 ~Stun_info();
20
21 // Implement the Net_interface
22 O2err accepted(Fds_info *conn) { return O2_FAIL; }; // not TCP
23 O2err connected() { return O2_FAIL; } // not a TCP client
24 O2err deliver(O2netmsg_ptr msg);
25};
26
27
28// used to detect duplicate calls to o2_get_public_ip():
29extern bool o2_stun_query_running;
30
31O2err o2_get_public_ip();
32
33void o2_stun_query(o2_msg_data_ptr msgdata, const char *types,
34 O2arg_ptr *argv, int argc, const void *user_data);
35
36void o2_stun_reply_handler(void *info);
Definition: o2network.h:147
Definition: o2node.h:291
Definition: stun.h:13
O2err
return values used generally by O2 functions
Definition: o2.h:329
@ O2_FAIL
a non-specific error occurred.
Definition: o2.h:339
data part of an O2 message
Definition: o2.h:638
Definition: o2network.h:57
union of all O2 parameter types
Definition: o2.h:764