Commit bf5dbebf authored by Kenton Varda's avatar Kenton Varda

Define additional type aliases AnswerId and ImportId. In the RPC protocol,…

Define additional type aliases AnswerId and ImportId.  In the RPC protocol, always use the type corresponding to the sender's point of view.  In the implementation, always use the type corresponding to the local point of view.
parent b15789d8
...@@ -39,6 +39,9 @@ namespace { ...@@ -39,6 +39,9 @@ namespace {
class RpcDumper { class RpcDumper {
// Class which stringifies RPC messages for debugging purposes, including decoding params and // Class which stringifies RPC messages for debugging purposes, including decoding params and
// results based on the call's interface and method IDs and extracting cap descriptors. // results based on the call's interface and method IDs and extracting cap descriptors.
//
// TODO(cleanup): Clean this code up and move it to someplace reusable, so it can be used as
// a packet inspector / debugging tool for Cap'n Proto network traffic.
public: public:
void addSchema(InterfaceSchema schema) { void addSchema(InterfaceSchema schema) {
...@@ -103,7 +106,7 @@ public: ...@@ -103,7 +106,7 @@ public:
auto ret = message.getReturn(); auto ret = message.getReturn();
auto iter = returnTypes.find( auto iter = returnTypes.find(
std::make_pair(sender == CLIENT ? SERVER : CLIENT, ret.getQuestionId())); std::make_pair(sender == CLIENT ? SERVER : CLIENT, ret.getAnswerId()));
if (iter == returnTypes.end()) { if (iter == returnTypes.end()) {
break; break;
} }
...@@ -129,11 +132,11 @@ public: ...@@ -129,11 +132,11 @@ public:
if (schema.getProto().isStruct()) { if (schema.getProto().isStruct()) {
auto results = kj::str(imbued.getAs<DynamicStruct>(schema.asStruct())); auto results = kj::str(imbued.getAs<DynamicStruct>(schema.asStruct()));
return kj::str(senderName, "(", ret.getQuestionId(), "): return ", results, return kj::str(senderName, "(", ret.getAnswerId(), "): return ", results,
" caps:[", kj::strArray(payload.getCapTable(), ", "), "]"); " caps:[", kj::strArray(payload.getCapTable(), ", "), "]");
} else if (schema.getProto().isInterface()) { } else if (schema.getProto().isInterface()) {
imbued.getAs<DynamicCapability>(schema.asInterface()); imbued.getAs<DynamicCapability>(schema.asInterface());
return kj::str(senderName, "(", ret.getQuestionId(), "): return cap ", return kj::str(senderName, "(", ret.getAnswerId(), "): return cap ",
kj::strArray(payload.getCapTable(), ", ")); kj::strArray(payload.getCapTable(), ", "));
} else { } else {
break; break;
......
This diff is collapsed.
This diff is collapsed.
...@@ -462,7 +462,7 @@ static const ::capnp::_::AlignedData<139> b_9e19b28d3db3573a = { ...@@ -462,7 +462,7 @@ static const ::capnp::_::AlignedData<139> b_9e19b28d3db3573a = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
209, 0, 0, 0, 90, 0, 0, 0, 209, 0, 0, 0, 74, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
208, 0, 0, 0, 2, 0, 1, 0, 208, 0, 0, 0, 2, 0, 1, 0,
216, 0, 0, 0, 2, 0, 1, 0, 216, 0, 0, 0, 2, 0, 1, 0,
...@@ -504,7 +504,7 @@ static const ::capnp::_::AlignedData<139> b_9e19b28d3db3573a = { ...@@ -504,7 +504,7 @@ static const ::capnp::_::AlignedData<139> b_9e19b28d3db3573a = {
6, 0, 251, 255, 2, 0, 0, 0, 6, 0, 251, 255, 2, 0, 0, 0,
0, 0, 1, 0, 6, 0, 0, 0, 0, 0, 1, 0, 6, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
237, 0, 0, 0, 162, 0, 0, 0, 237, 0, 0, 0, 178, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
240, 0, 0, 0, 2, 0, 1, 0, 240, 0, 0, 0, 2, 0, 1, 0,
248, 0, 0, 0, 2, 0, 1, 0, 248, 0, 0, 0, 2, 0, 1, 0,
...@@ -515,8 +515,8 @@ static const ::capnp::_::AlignedData<139> b_9e19b28d3db3573a = { ...@@ -515,8 +515,8 @@ static const ::capnp::_::AlignedData<139> b_9e19b28d3db3573a = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
248, 0, 0, 0, 2, 0, 1, 0, 248, 0, 0, 0, 2, 0, 1, 0,
0, 1, 0, 0, 2, 0, 1, 0, 0, 1, 0, 0, 2, 0, 1, 0,
113, 117, 101, 115, 116, 105, 111, 110, 97, 110, 115, 119, 101, 114, 73, 100,
73, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
8, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
...@@ -565,8 +565,8 @@ static const ::capnp::_::AlignedData<139> b_9e19b28d3db3573a = { ...@@ -565,8 +565,8 @@ static const ::capnp::_::AlignedData<139> b_9e19b28d3db3573a = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
116, 97, 107, 101, 70, 114, 111, 109, 116, 97, 107, 101, 70, 114, 111, 109,
79, 116, 104, 101, 114, 65, 110, 115, 79, 116, 104, 101, 114, 81, 117, 101,
119, 101, 114, 0, 0, 0, 0, 0, 115, 116, 105, 111, 110, 0, 0, 0,
8, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
...@@ -587,7 +587,7 @@ static const ::capnp::_::RawSchema* const d_9e19b28d3db3573a[] = { ...@@ -587,7 +587,7 @@ static const ::capnp::_::RawSchema* const d_9e19b28d3db3573a[] = {
&s_9a0e61223d96743b, &s_9a0e61223d96743b,
&s_d625b7063acf691a, &s_d625b7063acf691a,
}; };
static const uint16_t m_9e19b28d3db3573a[] = {7, 4, 3, 0, 1, 2, 5, 6}; static const uint16_t m_9e19b28d3db3573a[] = {7, 0, 4, 3, 1, 2, 5, 6};
static const uint16_t i_9e19b28d3db3573a[] = {2, 3, 4, 5, 6, 7, 0, 1}; static const uint16_t i_9e19b28d3db3573a[] = {2, 3, 4, 5, 6, 7, 0, 1};
const ::capnp::_::RawSchema s_9e19b28d3db3573a = { const ::capnp::_::RawSchema s_9e19b28d3db3573a = {
0x9e19b28d3db3573a, b_9e19b28d3db3573a.words, 139, d_9e19b28d3db3573a, m_9e19b28d3db3573a, 0x9e19b28d3db3573a, b_9e19b28d3db3573a.words, 139, d_9e19b28d3db3573a, m_9e19b28d3db3573a,
...@@ -1219,7 +1219,7 @@ static const ::capnp::_::AlignedData<59> b_fbe1980490e001af = { ...@@ -1219,7 +1219,7 @@ static const ::capnp::_::AlignedData<59> b_fbe1980490e001af = {
175, 1, 224, 144, 4, 152, 225, 251, 175, 1, 224, 144, 4, 152, 225, 251,
0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0,
80, 162, 82, 37, 27, 152, 18, 179, 80, 162, 82, 37, 27, 152, 18, 179,
1, 0, 7, 0, 0, 0, 0, 0, 2, 0, 7, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
17, 0, 0, 0, 170, 0, 0, 0, 17, 0, 0, 0, 170, 0, 0, 0,
25, 0, 0, 0, 7, 0, 0, 0, 25, 0, 0, 0, 7, 0, 0, 0,
...@@ -1238,14 +1238,14 @@ static const ::capnp::_::AlignedData<59> b_fbe1980490e001af = { ...@@ -1238,14 +1238,14 @@ static const ::capnp::_::AlignedData<59> b_fbe1980490e001af = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
68, 0, 0, 0, 2, 0, 1, 0, 68, 0, 0, 0, 2, 0, 1, 0,
76, 0, 0, 0, 2, 0, 1, 0, 76, 0, 0, 0, 2, 0, 1, 0,
1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
73, 0, 0, 0, 50, 0, 0, 0, 73, 0, 0, 0, 58, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
68, 0, 0, 0, 2, 0, 1, 0, 68, 0, 0, 0, 2, 0, 1, 0,
76, 0, 0, 0, 2, 0, 1, 0, 76, 0, 0, 0, 2, 0, 1, 0,
2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0,
0, 0, 1, 0, 2, 0, 0, 0, 0, 0, 1, 0, 2, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
73, 0, 0, 0, 66, 0, 0, 0, 73, 0, 0, 0, 66, 0, 0, 0,
...@@ -1260,11 +1260,11 @@ static const ::capnp::_::AlignedData<59> b_fbe1980490e001af = { ...@@ -1260,11 +1260,11 @@ static const ::capnp::_::AlignedData<59> b_fbe1980490e001af = {
8, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
99, 97, 112, 73, 100, 0, 0, 0, 116, 97, 114, 103, 101, 116, 0, 0,
8, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 193, 251, 19, 88, 84, 20, 188, 149,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
8, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
107, 101, 121, 80, 97, 114, 116, 0, 107, 101, 121, 80, 97, 114, 116, 0,
...@@ -1275,11 +1275,14 @@ static const ::capnp::_::AlignedData<59> b_fbe1980490e001af = { ...@@ -1275,11 +1275,14 @@ static const ::capnp::_::AlignedData<59> b_fbe1980490e001af = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, } 0, 0, 0, 0, 0, 0, 0, 0, }
}; };
static const uint16_t m_fbe1980490e001af[] = {1, 2, 0}; static const ::capnp::_::RawSchema* const d_fbe1980490e001af[] = {
&s_95bc14545813fbc1,
};
static const uint16_t m_fbe1980490e001af[] = {2, 0, 1};
static const uint16_t i_fbe1980490e001af[] = {0, 1, 2}; static const uint16_t i_fbe1980490e001af[] = {0, 1, 2};
const ::capnp::_::RawSchema s_fbe1980490e001af = { const ::capnp::_::RawSchema s_fbe1980490e001af = {
0xfbe1980490e001af, b_fbe1980490e001af.words, 59, nullptr, m_fbe1980490e001af, 0xfbe1980490e001af, b_fbe1980490e001af.words, 59, d_fbe1980490e001af, m_fbe1980490e001af,
0, 3, i_fbe1980490e001af, nullptr, nullptr 1, 3, i_fbe1980490e001af, nullptr, nullptr
}; };
static const ::capnp::_::AlignedData<47> b_95bc14545813fbc1 = { static const ::capnp::_::AlignedData<47> b_95bc14545813fbc1 = {
{ 0, 0, 0, 0, 5, 0, 5, 0, { 0, 0, 0, 0, 5, 0, 5, 0,
...@@ -1313,7 +1316,7 @@ static const ::capnp::_::AlignedData<47> b_95bc14545813fbc1 = { ...@@ -1313,7 +1316,7 @@ static const ::capnp::_::AlignedData<47> b_95bc14545813fbc1 = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
44, 0, 0, 0, 2, 0, 1, 0, 44, 0, 0, 0, 2, 0, 1, 0,
52, 0, 0, 0, 2, 0, 1, 0, 52, 0, 0, 0, 2, 0, 1, 0,
101, 120, 112, 111, 114, 116, 101, 100, 105, 109, 112, 111, 114, 116, 101, 100,
67, 97, 112, 0, 0, 0, 0, 0, 67, 97, 112, 0, 0, 0, 0, 0,
8, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
......
This diff is collapsed.
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