aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/netaddr.cpp4
-rw-r--r--src/network.cpp12
2 files changed, 14 insertions, 2 deletions
diff --git a/src/netaddr.cpp b/src/netaddr.cpp
index 1387b84..cb8a3d2 100644
--- a/src/netaddr.cpp
+++ b/src/netaddr.cpp
@@ -20,6 +20,10 @@ netaddr_t *netaddr_new_from_sipport(const char *ip_port_addr) {
return new netaddr_t(ip_port_addr);
}
+netaddr_t *netaddr_copy(const netaddr_t *self) {
+ return new netaddr_t(*self);
+}
+
bool netaddr_is_eq(const netaddr_t *a, const netaddr_t *b) {
return *a == *b;
}
diff --git a/src/network.cpp b/src/network.cpp
index a1666ec..0a83e39 100644
--- a/src/network.cpp
+++ b/src/network.cpp
@@ -118,6 +118,8 @@ void msgnetwork_reg_error_handler(msgnetwork_t *self,
void msgnetwork_start(msgnetwork_t *self) { self->start(); }
+void msgnetwork_stop(msgnetwork_t *self) { self->stop(); }
+
void msgnetwork_terminate(msgnetwork_t *self, const msgnetwork_conn_t *conn) {
self->terminate(*conn);
}
@@ -130,8 +132,8 @@ msgnetwork_conn_mode_t msgnetwork_conn_get_mode(const msgnetwork_conn_t *conn) {
return (msgnetwork_conn_mode_t)(*conn)->get_mode();
}
-netaddr_t *msgnetwork_conn_get_addr(const msgnetwork_conn_t *conn) {
- return new netaddr_t((*conn)->get_addr());
+const netaddr_t *msgnetwork_conn_get_addr(const msgnetwork_conn_t *conn) {
+ return &(*conn)->get_addr();
}
// PeerNetwork
@@ -160,6 +162,10 @@ void peernetwork_config_id_mode(peernetwork_config_t *self, peernetwork_id_mode_
msgnetwork_config_t *peernetwork_config_as_msgnetwork_config(peernetwork_config_t *self) { return self; }
+peernetwork_t *msgnetwork_as_peernetwork_unsafe(msgnetwork_t *self) {
+ return static_cast<peernetwork_t *>(self);
+}
+
peernetwork_t *peernetwork_new(const eventcontext_t *ec, const peernetwork_config_t *config) {
return new peernetwork_t(*ec, *config);
}
@@ -225,6 +231,8 @@ void peernetwork_listen(peernetwork_t *self, const netaddr_t *listen_addr, Salti
}
}
+void peernetwork_stop(peernetwork_t *self) { self->stop(); }
+
}
#endif