plumb file+line through _to_wire/_from_wire
This commit is contained in:
+1
-1
@@ -580,7 +580,7 @@ void procSearchReply(ContextImpl& self, const SockAddr& src, Buffer& M, bool ist
|
||||
uint16_t port = 0;
|
||||
uint8_t found = 0u;
|
||||
|
||||
_from_wire<12>(M, &guid[0], false);
|
||||
_from_wire<12>(M, &guid[0], false, __FILE__, __LINE__);
|
||||
// searchSequenceID
|
||||
// we don't use this and instead rely on ID for individual PVs
|
||||
M.skip(4u, __FILE__, __LINE__);
|
||||
|
||||
+6
-6
@@ -160,10 +160,10 @@ public:
|
||||
|
||||
// assumes prior buf.ensure(M) where M>=N
|
||||
template<unsigned N>
|
||||
inline void _to_wire(Buffer& buf, const uint8_t *mem, bool reverse)
|
||||
inline void _to_wire(Buffer& buf, const uint8_t *mem, bool reverse, const char *fname, int lineno)
|
||||
{
|
||||
if(!buf.ensure(N)) {
|
||||
buf.fault(__FILE__, __LINE__);
|
||||
buf.fault(fname, lineno);
|
||||
return;
|
||||
|
||||
} else if(reverse) {
|
||||
@@ -180,10 +180,10 @@ inline void _to_wire(Buffer& buf, const uint8_t *mem, bool reverse)
|
||||
}
|
||||
|
||||
template <unsigned N>
|
||||
inline void _from_wire(Buffer& buf, uint8_t *mem, bool reverse)
|
||||
inline void _from_wire(Buffer& buf, uint8_t *mem, bool reverse, const char *fname, int lineno)
|
||||
{
|
||||
if(!buf.ensure(N)) {
|
||||
buf.fault(__FILE__, __LINE__);
|
||||
buf.fault(fname, lineno);
|
||||
return;
|
||||
|
||||
} else if(reverse) {
|
||||
@@ -212,7 +212,7 @@ inline void to_wire(Buffer& buf, const T& val)
|
||||
uint8_t b[sizeof(T)];
|
||||
} pun;
|
||||
pun.v = val;
|
||||
_to_wire<sizeof(T)>(buf, pun.b, buf.be ^ hostBE);
|
||||
_to_wire<sizeof(T)>(buf, pun.b, buf.be ^ hostBE, __FILE__, __LINE__);
|
||||
}
|
||||
|
||||
template<typename T, typename std::enable_if<sizeof(T)==1 && std::is_scalar<T>::value, int>::type =0>
|
||||
@@ -238,7 +238,7 @@ inline void from_wire(Buffer& buf, T& val)
|
||||
T v;
|
||||
uint8_t b[sizeof(T)];
|
||||
} pun;
|
||||
_from_wire<sizeof(T)>(buf, pun.b, buf.be ^ hostBE);
|
||||
_from_wire<sizeof(T)>(buf, pun.b, buf.be ^ hostBE, __FILE__, __LINE__);
|
||||
if(buf.good())
|
||||
val = pun.v;
|
||||
}
|
||||
|
||||
+2
-2
@@ -628,7 +628,7 @@ void Server::Pvt::onSearch(const UDPManager::Search& msg)
|
||||
|
||||
M.skip(8, __FILE__, __LINE__); // fill in header after body length known
|
||||
|
||||
_to_wire<12>(M, effective.guid.data(), false);
|
||||
_to_wire<12>(M, effective.guid.data(), false, __FILE__, __LINE__);
|
||||
to_wire(M, msg.searchID);
|
||||
to_wire(M, SockAddr::any(AF_INET));
|
||||
to_wire(M, uint16_t(effective.tcp_port));
|
||||
@@ -661,7 +661,7 @@ void Server::Pvt::doBeacons(short evt)
|
||||
VectorOutBuf M(true, beaconMsg);
|
||||
M.skip(8, __FILE__, __LINE__); // fill in header after body length known
|
||||
|
||||
_to_wire<12>(M, effective.guid.data(), false);
|
||||
_to_wire<12>(M, effective.guid.data(), false, __FILE__, __LINE__);
|
||||
to_wire(M, uint8_t(0u)); // flags (aka. QoS, aka. undefined)
|
||||
to_wire(M, uint8_t(beaconSeq++)); // sequence
|
||||
to_wire(M, uint16_t(beaconChange));// change count
|
||||
|
||||
+1
-1
@@ -237,7 +237,7 @@ void ServerConn::handle_SEARCH()
|
||||
|
||||
EvOutBuf R(hostBE, txBody.get());
|
||||
|
||||
_to_wire<12>(R, iface->server->effective.guid.data(), false);
|
||||
_to_wire<12>(R, iface->server->effective.guid.data(), false, __FILE__, __LINE__);
|
||||
to_wire(R, searchID);
|
||||
to_wire(R, SockAddr::any(AF_INET));
|
||||
to_wire(R, iface->bind_addr.port());
|
||||
|
||||
@@ -187,7 +187,7 @@ struct UDPCollector : public UDPManager::Search,
|
||||
case CMD_BEACON: {
|
||||
uint16_t port = 0;
|
||||
|
||||
_from_wire<12>(M, &beaconMsg.guid[0], false);
|
||||
_from_wire<12>(M, &beaconMsg.guid[0], false, __FILE__, __LINE__);
|
||||
M.skip(4, __FILE__, __LINE__); // skip flags, seq, and change count. unused
|
||||
from_wire(M, beaconMsg.server);
|
||||
from_wire(M, port);
|
||||
|
||||
Reference in New Issue
Block a user