summaryrefslogtreecommitdiff
path: root/node/Node.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <[email protected]>2021-05-24 22:58:17 -0400
committerAdam Ierymenko <[email protected]>2021-05-24 22:58:17 -0400
commitb270d527f4ad7dbdba520def574201a0cb26f2ed (patch)
treea38690f59de7b7539d190376f98798fc8eb16f64 /node/Node.cpp
parent9c58308e6ac59390c0e1cd2be123e9e7a6fc2e73 (diff)
Basic plumbing for authentication requirement and piping through of URL information.
Diffstat (limited to 'node/Node.cpp')
-rw-r--r--node/Node.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/node/Node.cpp b/node/Node.cpp
index 05f5a247..3e4c65c0 100644
--- a/node/Node.cpp
+++ b/node/Node.cpp
@@ -731,7 +731,7 @@ void Node::ncSendRevocation(const Address &destination,const Revocation &rev)
}
}
-void Node::ncSendError(uint64_t nwid,uint64_t requestPacketId,const Address &destination,NetworkController::ErrorCode errorCode)
+void Node::ncSendError(uint64_t nwid,uint64_t requestPacketId,const Address &destination,NetworkController::ErrorCode errorCode, const void *errorData, unsigned int errorDataSize)
{
if (destination == RR->identity.address()) {
SharedPtr<Network> n(network(nwid));
@@ -744,6 +744,9 @@ void Node::ncSendError(uint64_t nwid,uint64_t requestPacketId,const Address &des
case NetworkController::NC_ERROR_ACCESS_DENIED:
n->setAccessDenied();
break;
+ case NetworkController::NC_ERROR_AUTHENTICATION_REQUIRED: {
+ }
+ break;
default: break;
}
@@ -760,8 +763,16 @@ void Node::ncSendError(uint64_t nwid,uint64_t requestPacketId,const Address &des
case NetworkController::NC_ERROR_ACCESS_DENIED:
outp.append((unsigned char)Packet::ERROR_NETWORK_ACCESS_DENIED_);
break;
+ case NetworkController::NC_ERROR_AUTHENTICATION_REQUIRED:
+ outp.append((unsigned char)Packet::ERROR_NETWORK_AUTHENTICATION_REQUIRED);
+ break;
}
+
outp.append(nwid);
+
+ if ((errorData)&&(errorDataSize > 0))
+ outp.append(errorData, errorDataSize);
+
RR->sw->send((void *)0,outp,true);
} // else we can't send an ERROR() in response to nothing, so discard
}