aboutsummaryrefslogtreecommitdiff
path: root/src/netaddr.cpp
blob: 3c2618a107ff0816fa5ada6bd9b8c0febb557f0a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "salticidae/config.h"
#ifdef SALTICIDAE_CBINDINGS
#include "salticidae/netaddr.h"

extern "C" {

netaddr_t *netaddr_new() { return new netaddr_t(); }

void netaddr_free(const netaddr_t *self) { delete self; }

netaddr_t *netaddr_new_from_ip_port(uint32_t ip, uint16_t port) {
    return new netaddr_t(ip, port);
}

netaddr_t *netaddr_new_from_sip_port(const char *ip, uint16_t port) {
    return new netaddr_t(ip, port);
}

netaddr_t *netaddr_new_from_sipport(const char *ip_port_addr) {
    return new netaddr_t(ip_port_addr);
}

bool netaddr_is_eq(const netaddr_t *a, const netaddr_t *b) {
    return *a == *b;
}

bool netaddr_is_null(const netaddr_t *self) { return self->is_null(); }

}

#endif