diff options
Diffstat (limited to 'src/netaddr.cpp')
-rw-r--r-- | src/netaddr.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/netaddr.cpp b/src/netaddr.cpp index cb8a3d2..736d606 100644 --- a/src/netaddr.cpp +++ b/src/netaddr.cpp @@ -2,22 +2,33 @@ #ifdef SALTICIDAE_CBINDINGS #include "salticidae/netaddr.h" +using namespace salticidae; + 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) { +netaddr_t *netaddr_new_from_ip_port(uint32_t ip, uint16_t port, SalticidaeCError *cerror) { + SALTICIDAE_CERROR_TRY(cerror) return new netaddr_t(ip, port); + SALTICIDAE_CERROR_CATCH(cerror) + return nullptr; } -netaddr_t *netaddr_new_from_sip_port(const char *ip, uint16_t port) { +netaddr_t *netaddr_new_from_sip_port(const char *ip, uint16_t port, SalticidaeCError *cerror) { + SALTICIDAE_CERROR_TRY(cerror) return new netaddr_t(ip, port); + SALTICIDAE_CERROR_CATCH(cerror) + return nullptr; } -netaddr_t *netaddr_new_from_sipport(const char *ip_port_addr) { +netaddr_t *netaddr_new_from_sipport(const char *ip_port_addr, SalticidaeCError *cerror) { + SALTICIDAE_CERROR_TRY(cerror) return new netaddr_t(ip_port_addr); + SALTICIDAE_CERROR_CATCH(cerror) + return nullptr; } netaddr_t *netaddr_copy(const netaddr_t *self) { |