Commit f731098f authored by rna's avatar rna

Remove wrappers for sockaddr conversion and return IPv4Address.

parent bdbe1ac2
Pipeline #2577 failed with stages
in 59 seconds
......@@ -151,9 +151,6 @@ cdef extern from "proto/socket.h":
bint PrrtSocket_get_app_limited(PrrtSocket *socket)
bint PrrtSocket_enable_thread_pinning(PrrtSocket *socket)
char *PrrtSocket_inet_ntoa(in_addr*)
uint16_t PrrtSocket_ntohs(uint16_t v)
cdef extern from "proto/stores/packetDeliveryStore.h":
ctypedef struct PrrtPacketDeliveryStore:
pass
......
......@@ -549,11 +549,3 @@ PrrtCoder *PrrtSocket_get_matching_coder(PrrtSocket *s, PrrtCodingConfiguration
}
return PrrtCoder_copy(s->coder);
};
char *PrrtSocket_inet_ntoa(struct in_addr* in) {
return inet_ntoa(*in);
}
uint16_t PrrtSocket_ntohs(uint16_t v) {
return ntohs(v);
}
\ No newline at end of file
......@@ -133,7 +133,4 @@ prrtDeliveryRate_t PrrtSocket_get_btlbw_fwd(PrrtSocket *s);
prrtDeliveryRate_t PrrtSocket_get_btlbw_back(PrrtSocket *s);
bool PrrtSocket_get_app_limited(PrrtSocket *s);
char *PrrtSocket_inet_ntoa(struct in_addr* in);
uint16_t PrrtSocket_ntohs(uint16_t v);
#endif // PRRT_SOCKET_H
......@@ -7,6 +7,8 @@ cimport cython
cimport cprrt
import datetime
import socket
import ipaddress
include "sockets.pxd"
......@@ -99,7 +101,7 @@ cdef extern from "util/mpsc_queue.c":
pass
cdef sockaddr_to_addr_and_port(sockaddr_in addr):
return (cprrt.PrrtSocket_inet_ntoa(&addr.sin_addr).decode("utf8"), cprrt.PrrtSocket_ntohs(addr.sin_port))
return (ipaddress.ip_address(socket.ntohl(addr.sin_addr.s_addr)), socket.ntohs(addr.sin_port))
class PayloadTooBigException(Exception):
pass
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment