Rename error code for no membership certificate.

This commit is contained in:
Adam Ierymenko 2013-10-07 15:21:40 -04:00
parent 430882327e
commit dcbc9c8ddd
4 changed files with 8 additions and 20 deletions

View File

@ -135,11 +135,7 @@ public:
COM_RESERVED_ID_NETWORK_ID = 1 // network ID, max delta always 0
};
CertificateOfMembership()
{
memset(_signature.data,0,_signature.size());
}
CertificateOfMembership() { memset(_signature.data,0,_signature.size()); }
CertificateOfMembership(const char *s) { fromString(s); }
CertificateOfMembership(const std::string &s) { fromString(s.c_str()); }
@ -205,20 +201,12 @@ public:
/**
* @return True if signed
*/
inline bool isSigned() const
throw()
{
return (_signedBy);
}
inline bool isSigned() const throw() { return (_signedBy); }
/**
* @return Address that signed this certificate or null address if none
*/
inline const Address &signedBy() const
throw()
{
return _signedBy;
}
inline const Address &signedBy() const throw() { return _signedBy; }
private:
struct _Qualifier

View File

@ -62,7 +62,7 @@ const char *Packet::errorString(ErrorCode e)
case ERROR_OBJ_NOT_FOUND: return "OBJECT_NOT_FOUND";
case ERROR_IDENTITY_COLLISION: return "IDENTITY_COLLISION";
case ERROR_UNSUPPORTED_OPERATION: return "UNSUPPORTED_OPERATION";
case ERROR_NO_MEMBER_CERTIFICATE: return "NO_MEMBER_CERTIFICATE";
case ERROR_NEED_MEMBERSHIP_CERTIFICATE: return "NEED_MEMBERSHIP_CERTIFICATE";
}
return "(unknown)";
}

View File

@ -626,7 +626,7 @@ public:
ERROR_UNSUPPORTED_OPERATION = 5,
/* Message to private network rejected -- no unexpired certificate on file */
ERROR_NO_MEMBER_CERTIFICATE = 6
ERROR_NEED_MEMBERSHIP_CERTIFICATE = 6
};
/**

View File

@ -140,7 +140,7 @@ bool PacketDecoder::_doERROR(const RuntimeEnvironment *_r,const SharedPtr<Peer>
case Packet::ERROR_IDENTITY_COLLISION:
// TODO: if it comes from a supernode, regenerate a new identity
break;
case Packet::ERROR_NO_MEMBER_CERTIFICATE:
case Packet::ERROR_NEED_MEMBERSHIP_CERTIFICATE:
// TODO: send member certificate
break;
default:
@ -358,7 +358,7 @@ bool PacketDecoder::_doFRAME(const RuntimeEnvironment *_r,const SharedPtr<Peer>
Packet outp(source(),_r->identity.address(),Packet::VERB_ERROR);
outp.append((unsigned char)Packet::VERB_FRAME);
outp.append(packetId());
outp.append((unsigned char)Packet::ERROR_NO_MEMBER_CERTIFICATE);
outp.append((unsigned char)Packet::ERROR_NEED_MEMBERSHIP_CERTIFICATE);
outp.append(network->id());
outp.armor(peer->key(),true);
_r->demarc->send(_localPort,_remoteAddress,outp.data(),outp.size(),-1);
@ -466,7 +466,7 @@ bool PacketDecoder::_doMULTICAST_FRAME(const RuntimeEnvironment *_r,const Shared
Packet outp(source(),_r->identity.address(),Packet::VERB_ERROR);
outp.append((unsigned char)Packet::VERB_FRAME);
outp.append(packetId());
outp.append((unsigned char)Packet::ERROR_NO_MEMBER_CERTIFICATE);
outp.append((unsigned char)Packet::ERROR_NEED_MEMBERSHIP_CERTIFICATE);
outp.append(nwid);
outp.armor(peer->key(),true);
_r->demarc->send(_localPort,_remoteAddress,outp.data(),outp.size(),-1);