Code style: Put function return type on a line by itself.
diff --git a/ndn-cpp/common.cpp b/ndn-cpp/common.cpp
index 498abe1..d1c55f3 100644
--- a/ndn-cpp/common.cpp
+++ b/ndn-cpp/common.cpp
@@ -11,7 +11,8 @@
namespace ndn {
-string toHex(const vector<unsigned char>& array)
+string
+toHex(const vector<unsigned char>& array)
{
if (!&array)
return "";
diff --git a/ndn-cpp/common.hpp b/ndn-cpp/common.hpp
index ebf6992..4e451a9 100644
--- a/ndn-cpp/common.hpp
+++ b/ndn-cpp/common.hpp
@@ -56,7 +56,8 @@
* @param array The array of bytes.
* @return Hex string.
*/
-std::string toHex(const std::vector<unsigned char>& array);
+std::string
+toHex(const std::vector<unsigned char>& array);
}
diff --git a/ndn-cpp/data.cpp b/ndn-cpp/data.cpp
index ea726c1..684a061 100644
--- a/ndn-cpp/data.cpp
+++ b/ndn-cpp/data.cpp
@@ -16,7 +16,8 @@
{
}
-void MetaInfo::get(struct ndn_MetaInfo& metaInfoStruct) const
+void
+MetaInfo::get(struct ndn_MetaInfo& metaInfoStruct) const
{
metaInfoStruct.timestampMilliseconds = timestampMilliseconds_;
metaInfoStruct.type = type_;
@@ -24,7 +25,8 @@
finalBlockID_.get(metaInfoStruct.finalBlockID);
}
-void MetaInfo::set(const struct ndn_MetaInfo& metaInfoStruct)
+void
+MetaInfo::set(const struct ndn_MetaInfo& metaInfoStruct)
{
timestampMilliseconds_ = metaInfoStruct.timestampMilliseconds;
type_ = metaInfoStruct.type;
@@ -42,7 +44,8 @@
{
}
-void Data::get(struct ndn_Data& dataStruct) const
+void
+Data::get(struct ndn_Data& dataStruct) const
{
signature_->get(dataStruct.signature);
name_.get(dataStruct.name);
@@ -55,7 +58,8 @@
dataStruct.content = 0;
}
-void Data::set(const struct ndn_Data& dataStruct)
+void
+Data::set(const struct ndn_Data& dataStruct)
{
signature_->set(dataStruct.signature);
name_.set(dataStruct.name);
@@ -65,7 +69,8 @@
onChanged();
}
-SignedBlob Data::wireEncode(WireFormat& wireFormat)
+SignedBlob
+Data::wireEncode(WireFormat& wireFormat)
{
unsigned int signedPortionBeginOffset, signedPortionEndOffset;
Blob encoding = wireFormat.encodeData(*this, &signedPortionBeginOffset, &signedPortionEndOffset);
@@ -74,7 +79,8 @@
return wireEncoding_;
}
-void Data::wireDecode(const unsigned char* input, unsigned int inputLength, WireFormat& wireFormat)
+void
+Data::wireDecode(const unsigned char* input, unsigned int inputLength, WireFormat& wireFormat)
{
unsigned int signedPortionBeginOffset, signedPortionEndOffset;
wireFormat.decodeData(*this, input, inputLength, &signedPortionBeginOffset, &signedPortionEndOffset);
@@ -82,7 +88,8 @@
wireEncoding_ = SignedBlob(input, inputLength, signedPortionBeginOffset, signedPortionEndOffset);
}
-void Data::onChanged()
+void
+Data::onChanged()
{
wireEncoding_ = SignedBlob();
}
diff --git a/ndn-cpp/data.hpp b/ndn-cpp/data.hpp
index 0afaf81..cde7302 100644
--- a/ndn-cpp/data.hpp
+++ b/ndn-cpp/data.hpp
@@ -24,12 +24,14 @@
* Return a pointer to a new Signature which is a copy of this signature.
* This is pure virtual, the subclass must implement it.
*/
- virtual ptr_lib::shared_ptr<Signature> clone() const = 0;
+ virtual ptr_lib::shared_ptr<Signature>
+ clone() const = 0;
/**
* The virtual destructor.
*/
- virtual ~Signature();
+ virtual
+ ~Signature();
/**
* Set the signatureStruct to point to the values in this signature object, without copying any memory.
@@ -37,14 +39,16 @@
* This is pure virtual, the subclass must implement it.
* @param signatureStruct a C ndn_Signature struct where the name components array is already allocated.
*/
- virtual void get(struct ndn_Signature& signatureStruct) const = 0;
+ virtual void
+ get(struct ndn_Signature& signatureStruct) const = 0;
/**
* Clear this signature, and set the values by copying from the ndn_Signature struct.
* This is pure virtual, the subclass must implement it.
* @param signatureStruct a C ndn_Signature struct
*/
- virtual void set(const struct ndn_Signature& signatureStruct) = 0;
+ virtual void
+ set(const struct ndn_Signature& signatureStruct) = 0;
};
/**
@@ -63,30 +67,42 @@
* WARNING: The resulting pointers in metaInfoStruct are invalid after a further use of this object which could reallocate memory.
* @param metaInfoStruct a C ndn_MetaInfo struct where the name components array is already allocated.
*/
- void get(struct ndn_MetaInfo& metaInfoStruct) const;
+ void
+ get(struct ndn_MetaInfo& metaInfoStruct) const;
/**
* Clear this meta info, and set the values by copying from the ndn_MetaInfo struct.
* @param metaInfoStruct a C ndn_MetaInfo struct
*/
- void set(const struct ndn_MetaInfo& metaInfoStruct);
+ void
+ set(const struct ndn_MetaInfo& metaInfoStruct);
- double getTimestampMilliseconds() const { return timestampMilliseconds_; }
+ double
+ getTimestampMilliseconds() const { return timestampMilliseconds_; }
- ndn_ContentType getType() const { return type_; }
+ ndn_ContentType
+ getType() const { return type_; }
- int getFreshnessSeconds() const { return freshnessSeconds_; }
+ int
+ getFreshnessSeconds() const { return freshnessSeconds_; }
- const Name::Component& getFinalBlockID() const { return finalBlockID_; }
+ const Name::Component&
+ getFinalBlockID() const { return finalBlockID_; }
- void setTimestampMilliseconds(double timestampMilliseconds) { timestampMilliseconds_ = timestampMilliseconds; }
+ void
+ setTimestampMilliseconds(double timestampMilliseconds) { timestampMilliseconds_ = timestampMilliseconds; }
- void setType(ndn_ContentType type) { type_ = type; }
+ void
+ setType(ndn_ContentType type) { type_ = type; }
- void setFreshnessSeconds(int freshnessSeconds) { freshnessSeconds_ = freshnessSeconds; }
+ void
+ setFreshnessSeconds(int freshnessSeconds) { freshnessSeconds_ = freshnessSeconds; }
- void setFinalBlockID(const std::vector<unsigned char>& finalBlockID) { finalBlockID_ = Name::Component(finalBlockID); }
- void setFinalBlockID(const unsigned char* finalBlockID, unsigned int finalBlockIdLength)
+ void
+ setFinalBlockID(const std::vector<unsigned char>& finalBlockID) { finalBlockID_ = Name::Component(finalBlockID); }
+
+ void
+ setFinalBlockID(const unsigned char* finalBlockID, unsigned int finalBlockIdLength)
{
finalBlockID_ = Name::Component(finalBlockID, finalBlockIdLength);
}
@@ -117,7 +133,8 @@
* @param wireFormat A WireFormat object used to encode the input. If omitted, use WireFormat getDefaultWireFormat().
* @return The encoded byte array.
*/
- SignedBlob wireEncode(WireFormat& wireFormat = *WireFormat::getDefaultWireFormat());
+ SignedBlob
+ wireEncode(WireFormat& wireFormat = *WireFormat::getDefaultWireFormat());
/**
* Decode the input using a particular wire format and update this Data. Also, set the wireEncoding field to the input.
@@ -125,14 +142,16 @@
* @param inputLength The length of input.
* @param wireFormat A WireFormat object used to decode the input. If omitted, use WireFormat getDefaultWireFormat().
*/
- void wireDecode(const unsigned char* input, unsigned int inputLength, WireFormat& wireFormat = *WireFormat::getDefaultWireFormat());
+ void
+ wireDecode(const unsigned char* input, unsigned int inputLength, WireFormat& wireFormat = *WireFormat::getDefaultWireFormat());
/**
* Decode the input using a particular wire format and update this Data. Also, set the wireEncoding field to the input.
* @param input The input byte array to be decoded.
* @param wireFormat A WireFormat object used to decode the input. If omitted, use WireFormat getDefaultWireFormat().
*/
- void wireDecode(const std::vector<unsigned char>& input, WireFormat& wireFormat = *WireFormat::getDefaultWireFormat())
+ void
+ wireDecode(const std::vector<unsigned char>& input, WireFormat& wireFormat = *WireFormat::getDefaultWireFormat())
{
wireDecode(&input[0], input.size(), wireFormat);
}
@@ -142,45 +161,58 @@
* WARNING: The resulting pointers in dataStruct are invalid after a further use of this object which could reallocate memory.
* @param dataStruct a C ndn_Data struct where the name components array is already allocated.
*/
- void get(struct ndn_Data& dataStruct) const;
+ void
+ get(struct ndn_Data& dataStruct) const;
/**
* Clear this data object, and set the values by copying from the ndn_Data struct.
* @param dataStruct a C ndn_Data struct
*/
- void set(const struct ndn_Data& dataStruct);
+ void
+ set(const struct ndn_Data& dataStruct);
- const Signature* getSignature() const { return signature_.get(); }
- Signature* getSignature()
+ const Signature*
+ getSignature() const { return signature_.get(); }
+
+ Signature*
+ getSignature()
{
// TODO: Should add an OnChanged listener instead of always calling onChanged.
onChanged();
return signature_.get();
}
- const Name& getName() const { return name_; }
- Name& getName()
+ const Name&
+ getName() const { return name_; }
+
+ Name&
+ getName()
{
// TODO: Should add an OnChanged listener instead of always calling onChanged.
onChanged();
return name_;
}
- const MetaInfo& getMetaInfo() const { return metaInfo_; }
- MetaInfo& getMetaInfo()
+ const MetaInfo&
+ getMetaInfo() const { return metaInfo_; }
+
+ MetaInfo&
+ getMetaInfo()
{
// TODO: Should add an OnChanged listener instead of always calling onChanged.
onChanged();
return metaInfo_;
}
- const Blob& getContent() const { return content_; }
+ const Blob&
+ getContent() const { return content_; }
/**
* Set the signature to a copy of the given signature.
* @param signature The signature object which is cloned.
*/
- void setSignature(const Signature& signature)
+ void
+ setSignature(const Signature& signature)
{
signature_ = signature.clone();
onChanged();
@@ -190,7 +222,8 @@
* Set name to a copy of the given Name.
* @param name The Name which is copied.
*/
- void setName(const Name& name)
+ void
+ setName(const Name& name)
{
name_ = name;
onChanged();
@@ -200,7 +233,8 @@
* Set metaInfo to a copy of the given MetaInfo.
* @param metaInfo The MetaInfo which is copied.
*/
- void setMetainfo(const MetaInfo& metaInfo)
+ void
+ setMetainfo(const MetaInfo& metaInfo)
{
metaInfo_ = metaInfo;
onChanged();
@@ -210,12 +244,14 @@
* Set the content to a copy of the data in the vector.
* @param content A vector whose contents are copied.
*/
- void setContent(const std::vector<unsigned char>& content)
+ void
+ setContent(const std::vector<unsigned char>& content)
{
content_ = content;
onChanged();
}
- void setContent(const unsigned char* content, unsigned int contentLength)
+ void
+ setContent(const unsigned char* content, unsigned int contentLength)
{
content_ = Blob(content, contentLength);
onChanged();
@@ -226,12 +262,15 @@
* if you keep a pointer to the array then you must treat the array as immutable and promise not to change it.
* @param content A pointer to a vector with the byte array. This takes another reference and does not copy the bytes.
*/
- void setContent(const ptr_lib::shared_ptr<std::vector<unsigned char> > &content)
+ void
+ setContent(const ptr_lib::shared_ptr<std::vector<unsigned char> > &content)
{
content_ = content;
onChanged();
}
- void setContent(const ptr_lib::shared_ptr<const std::vector<unsigned char> > &content)
+
+ void
+ setContent(const ptr_lib::shared_ptr<const std::vector<unsigned char> > &content)
{
content_ = content;
onChanged();
@@ -241,7 +280,8 @@
/**
* Clear the wire encoding.
*/
- void onChanged();
+ void
+ onChanged();
ptr_lib::shared_ptr<Signature> signature_;
Name name_;
diff --git a/ndn-cpp/encoding/binary-xml-decoder.hpp b/ndn-cpp/encoding/binary-xml-decoder.hpp
index 0a556f4..7b28e7f 100644
--- a/ndn-cpp/encoding/binary-xml-decoder.hpp
+++ b/ndn-cpp/encoding/binary-xml-decoder.hpp
@@ -33,7 +33,8 @@
* @param expectedTag the expected value for DTAG
* @return true if got the expected tag, else false
*/
- bool peekDTag(unsigned int expectedTag)
+ bool
+ peekDTag(unsigned int expectedTag)
{
int gotExpectedTag;
ndn_Error error;
diff --git a/ndn-cpp/encoding/binary-xml-element-reader.cpp b/ndn-cpp/encoding/binary-xml-element-reader.cpp
index e597eb8..6a7c5ad 100644
--- a/ndn-cpp/encoding/binary-xml-element-reader.cpp
+++ b/ndn-cpp/encoding/binary-xml-element-reader.cpp
@@ -8,7 +8,8 @@
namespace ndn {
-void ElementListener::staticOnReceivedElement(struct ndn_ElementListener *self, unsigned char *element, unsigned int elementLength)
+void
+ElementListener::staticOnReceivedElement(struct ndn_ElementListener *self, unsigned char *element, unsigned int elementLength)
{
((ElementListener *)self)->onReceivedElement(element, elementLength);
}
diff --git a/ndn-cpp/encoding/binary-xml-element-reader.hpp b/ndn-cpp/encoding/binary-xml-element-reader.hpp
index f2a86ff..c86b99a 100644
--- a/ndn-cpp/encoding/binary-xml-element-reader.hpp
+++ b/ndn-cpp/encoding/binary-xml-element-reader.hpp
@@ -28,7 +28,8 @@
* later, you must copy.
* @param elementLength length of element
*/
- virtual void onReceivedElement(const unsigned char *element, unsigned int elementLength) = 0;
+ virtual void
+ onReceivedElement(const unsigned char *element, unsigned int elementLength) = 0;
private:
/**
@@ -37,7 +38,8 @@
* @param element
* @param elementLength
*/
- static void staticOnReceivedElement(struct ndn_ElementListener *self, unsigned char *element, unsigned int elementLength);
+ static void
+ staticOnReceivedElement(struct ndn_ElementListener *self, unsigned char *element, unsigned int elementLength);
};
}
diff --git a/ndn-cpp/encoding/binary-xml-encoder.hpp b/ndn-cpp/encoding/binary-xml-encoder.hpp
index d64b3e5..7c7f626 100644
--- a/ndn-cpp/encoding/binary-xml-encoder.hpp
+++ b/ndn-cpp/encoding/binary-xml-encoder.hpp
@@ -32,7 +32,8 @@
* Resize the output vector to the correct encoding length and return.
* @return The encoding as a shared_ptr. Assume that the caller now owns the vector.
*/
- const ptr_lib::shared_ptr<std::vector<unsigned char> >& getOutput()
+ const ptr_lib::shared_ptr<std::vector<unsigned char> >&
+ getOutput()
{
output_.get()->resize(offset);
return output_.get();
diff --git a/ndn-cpp/encoding/binary-xml-structure-decoder.hpp b/ndn-cpp/encoding/binary-xml-structure-decoder.hpp
index dbe5932..a1911ea 100644
--- a/ndn-cpp/encoding/binary-xml-structure-decoder.hpp
+++ b/ndn-cpp/encoding/binary-xml-structure-decoder.hpp
@@ -30,7 +30,8 @@
* @param inputLength the number of bytes in input.
* @return true if found the element end, false if need to read more. (This is the same as returning gotElementEnd().)
*/
- bool findElementEnd(unsigned char *input, unsigned int inputLength)
+ bool
+ findElementEnd(unsigned char *input, unsigned int inputLength)
{
ndn_Error error;
if ((error = ndn_BinaryXmlStructureDecoder_findElementEnd(this, input, inputLength)))
@@ -38,8 +39,11 @@
return gotElementEnd();
}
- unsigned int getOffset() const { return offset; }
- bool gotElementEnd() const { return gotElementEnd != 0; }
+ unsigned int
+ getOffset() const { return offset; }
+
+ bool
+ gotElementEnd() const { return gotElementEnd != 0; }
};
}
diff --git a/ndn-cpp/encoding/binary-xml-wire-format.cpp b/ndn-cpp/encoding/binary-xml-wire-format.cpp
index 930f89d..71f74d5 100644
--- a/ndn-cpp/encoding/binary-xml-wire-format.cpp
+++ b/ndn-cpp/encoding/binary-xml-wire-format.cpp
@@ -20,12 +20,14 @@
namespace ndn {
// This is declared in the WireFormat class.
-WireFormat *WireFormat::newInitialDefaultWireFormat()
+WireFormat*
+WireFormat::newInitialDefaultWireFormat()
{
return new BinaryXmlWireFormat();
}
-Blob BinaryXmlWireFormat::encodeInterest(const Interest& interest)
+Blob
+BinaryXmlWireFormat::encodeInterest(const Interest& interest)
{
struct ndn_NameComponent nameComponents[100];
struct ndn_ExcludeEntry excludeEntries[100];
@@ -43,7 +45,8 @@
return encoder.getOutput();
}
-void BinaryXmlWireFormat::decodeInterest(Interest& interest, const unsigned char *input, unsigned int inputLength)
+void
+BinaryXmlWireFormat::decodeInterest(Interest& interest, const unsigned char *input, unsigned int inputLength)
{
struct ndn_NameComponent nameComponents[100];
struct ndn_ExcludeEntry excludeEntries[100];
@@ -60,7 +63,8 @@
interest.set(interestStruct);
}
-Blob BinaryXmlWireFormat::encodeData(const Data& data, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset)
+Blob
+BinaryXmlWireFormat::encodeData(const Data& data, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset)
{
struct ndn_NameComponent nameComponents[100];
struct ndn_NameComponent keyNameComponents[100];
@@ -78,7 +82,8 @@
return encoder.getOutput();
}
-void BinaryXmlWireFormat::decodeData
+void
+BinaryXmlWireFormat::decodeData
(Data& data, const unsigned char *input, unsigned int inputLength, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset)
{
struct ndn_NameComponent nameComponents[100];
@@ -96,7 +101,8 @@
data.set(dataStruct);
}
-Blob BinaryXmlWireFormat::encodeForwardingEntry(const ForwardingEntry& forwardingEntry)
+Blob
+BinaryXmlWireFormat::encodeForwardingEntry(const ForwardingEntry& forwardingEntry)
{
struct ndn_NameComponent prefixNameComponents[100];
struct ndn_ForwardingEntry forwardingEntryStruct;
@@ -112,7 +118,8 @@
return encoder.getOutput();
}
-void BinaryXmlWireFormat::decodeForwardingEntry(ForwardingEntry& forwardingEntry, const unsigned char *input, unsigned int inputLength)
+void
+BinaryXmlWireFormat::decodeForwardingEntry(ForwardingEntry& forwardingEntry, const unsigned char *input, unsigned int inputLength)
{
struct ndn_NameComponent prefixNameComponents[100];
struct ndn_ForwardingEntry forwardingEntryStruct;
diff --git a/ndn-cpp/encoding/binary-xml-wire-format.hpp b/ndn-cpp/encoding/binary-xml-wire-format.hpp
index ebb7412..350561e 100644
--- a/ndn-cpp/encoding/binary-xml-wire-format.hpp
+++ b/ndn-cpp/encoding/binary-xml-wire-format.hpp
@@ -22,7 +22,8 @@
* @param interest The Interest object to encode.
* @return A Blob containing the encoding.
*/
- virtual Blob encodeInterest(const Interest& interest);
+ virtual Blob
+ encodeInterest(const Interest& interest);
/**
* Decode input as an interest in binary XML and set the fields of the interest object.
@@ -30,7 +31,8 @@
* @param input A pointer to the input buffer to decode.
* @param inputLength The number of bytes in input.
*/
- virtual void decodeInterest(Interest& interest, const unsigned char *input, unsigned int inputLength);
+ virtual void
+ decodeInterest(Interest& interest, const unsigned char *input, unsigned int inputLength);
/**
* Encode data with binary XML and return the encoding.
@@ -41,7 +43,8 @@
* If you are not encoding in order to sign, you can call encodeData(const Data& data) to ignore this returned value.
* @return A Blob containing the encoding.
*/
- virtual Blob encodeData
+ virtual Blob
+ encodeData
(const Data& data, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset);
/**
@@ -56,7 +59,8 @@
* If you are not decoding in order to verify, you can call
* decodeData(Data& data, const unsigned char *input, unsigned int inputLength) to ignore this returned value.
*/
- virtual void decodeData
+ virtual void
+ decodeData
(Data& data, const unsigned char *input, unsigned int inputLength, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset);
/**
@@ -64,7 +68,8 @@
* @param forwardingEntry The ForwardingEntry object to encode.
* @return A Blob containing the encoding.
*/
- virtual Blob encodeForwardingEntry(const ForwardingEntry& forwardingEntry);
+ virtual Blob
+ encodeForwardingEntry(const ForwardingEntry& forwardingEntry);
/**
* Decode input as a forwarding entry in binary XML and set the fields of the forwardingEntry object.
@@ -72,7 +77,8 @@
* @param input A pointer to the input buffer to decode.
* @param inputLength The number of bytes in input.
*/
- virtual void decodeForwardingEntry(ForwardingEntry& forwardingEntry, const unsigned char *input, unsigned int inputLength);
+ virtual void
+ decodeForwardingEntry(ForwardingEntry& forwardingEntry, const unsigned char *input, unsigned int inputLength);
};
}
diff --git a/ndn-cpp/encoding/wire-format.cpp b/ndn-cpp/encoding/wire-format.cpp
index fc39a7b..41c1f39 100644
--- a/ndn-cpp/encoding/wire-format.cpp
+++ b/ndn-cpp/encoding/wire-format.cpp
@@ -13,9 +13,10 @@
static bool gotInitialDefaultWireFormat = false;
-WireFormat *WireFormat::defaultWireFormat_ = 0;
+WireFormat* WireFormat::defaultWireFormat_ = 0;
-WireFormat *WireFormat::getDefaultWireFormat()
+WireFormat*
+WireFormat::getDefaultWireFormat()
{
if (!defaultWireFormat_ && !gotInitialDefaultWireFormat) {
// There is no defaultWireFormat_ and we have not yet initialized initialDefaultWireFormat_, so initialize and use it.
@@ -27,30 +28,39 @@
return defaultWireFormat_;
}
-Blob WireFormat::encodeInterest(const Interest& interest)
-{
- throw logic_error("unimplemented");
-}
-void WireFormat::decodeInterest(Interest& interest, const unsigned char *input, unsigned int inputLength)
+Blob
+WireFormat::encodeInterest(const Interest& interest)
{
throw logic_error("unimplemented");
}
-Blob WireFormat::encodeData(const Data& data, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset)
+void
+WireFormat::decodeInterest(Interest& interest, const unsigned char *input, unsigned int inputLength)
{
throw logic_error("unimplemented");
}
-void WireFormat::decodeData
+
+Blob
+WireFormat::encodeData(const Data& data, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset)
+{
+ throw logic_error("unimplemented");
+}
+
+void
+WireFormat::decodeData
(Data& data, const unsigned char *input, unsigned int inputLength, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset)
{
throw logic_error("unimplemented");
}
-Blob WireFormat::encodeForwardingEntry(const ForwardingEntry& forwardingEntry)
+Blob
+WireFormat::encodeForwardingEntry(const ForwardingEntry& forwardingEntry)
{
throw logic_error("unimplemented");
}
-void WireFormat::decodeForwardingEntry(ForwardingEntry& forwardingEntry, const unsigned char *input, unsigned int inputLength)
+
+void
+WireFormat::decodeForwardingEntry(ForwardingEntry& forwardingEntry, const unsigned char *input, unsigned int inputLength)
{
throw logic_error("unimplemented");
}
diff --git a/ndn-cpp/encoding/wire-format.hpp b/ndn-cpp/encoding/wire-format.hpp
index a892659..02e7a8c 100644
--- a/ndn-cpp/encoding/wire-format.hpp
+++ b/ndn-cpp/encoding/wire-format.hpp
@@ -24,7 +24,8 @@
* @return A Blob containing the encoding.
* @throw logic_error for unimplemented if the derived class does not override.
*/
- virtual Blob encodeInterest(const Interest& interest);
+ virtual Blob
+ encodeInterest(const Interest& interest);
/**
* Decode input as an interest and set the fields of the interest object. Your derived class should override.
@@ -33,7 +34,8 @@
* @param inputLength The number of bytes in input.
* @throw logic_error for unimplemented if the derived class does not override.
*/
- virtual void decodeInterest(Interest& interest, const unsigned char *input, unsigned int inputLength);
+ virtual void
+ decodeInterest(Interest& interest, const unsigned char *input, unsigned int inputLength);
/**
* Encode data and return the encoding. Your derived class should override.
@@ -45,7 +47,8 @@
* @return A Blob containing the encoding.
* @throw logic_error for unimplemented if the derived class does not override.
*/
- virtual Blob encodeData
+ virtual Blob
+ encodeData
(const Data& data, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset);
/**
@@ -54,7 +57,8 @@
* @return A Blob containing the encoding.
* @throw logic_error for unimplemented if the derived class does not override.
*/
- Blob encodeData(const Data& data)
+ Blob
+ encodeData(const Data& data)
{
unsigned int dummyBeginOffset, dummyEndOffset;
return encodeData(data, &dummyBeginOffset, &dummyEndOffset);
@@ -73,10 +77,12 @@
* decodeData(Data& data, const unsigned char *input, unsigned int inputLength) to ignore this returned value.
* @throw logic_error for unimplemented if the derived class does not override.
*/
- virtual void decodeData
+ virtual void
+ decodeData
(Data& data, const unsigned char *input, unsigned int inputLength, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset);
- void decodeData(Data& data, const unsigned char *input, unsigned int inputLength)
+ void
+ decodeData(Data& data, const unsigned char *input, unsigned int inputLength)
{
unsigned int dummyBeginOffset, dummyEndOffset;
decodeData(data, input, inputLength, &dummyBeginOffset, &dummyEndOffset);
@@ -88,7 +94,8 @@
* @return A Blob containing the encoding.
* @throw logic_error for unimplemented if the derived class does not override.
*/
- virtual Blob encodeForwardingEntry(const ForwardingEntry& forwardingEntry);
+ virtual Blob
+ encodeForwardingEntry(const ForwardingEntry& forwardingEntry);
/**
* Decode input as a forwarding entry and set the fields of the forwardingEntry object. Your derived class should override.
@@ -97,14 +104,16 @@
* @param inputLength The number of bytes in input.
* @throw logic_error for unimplemented if the derived class does not override.
*/
- virtual void decodeForwardingEntry(ForwardingEntry& forwardingEntry, const unsigned char *input, unsigned int inputLength);
+ virtual void
+ decodeForwardingEntry(ForwardingEntry& forwardingEntry, const unsigned char *input, unsigned int inputLength);
/**
* Set the static default WireFormat used by default encoding and decoding methods.
* @param wireFormat A Pointer to an object of a subclass of WireFormat. This does not make a copy and
* the caller must ensure that the object remains allocated.
*/
- static void setDefaultWireFormat(WireFormat *wireFormat)
+ static void
+ setDefaultWireFormat(WireFormat *wireFormat)
{
defaultWireFormat_ = wireFormat;
}
@@ -114,7 +123,8 @@
* setDefaultWireFormat.
* @return A pointer to the WireFormat object.
*/
- static WireFormat *getDefaultWireFormat();
+ static WireFormat*
+ getDefaultWireFormat();
private:
/**
@@ -123,7 +133,8 @@
* needs to include another subclass which defines WireFormat::newInitialDefaultWireFormat.
* @return a new object, which is held by a shared_ptr and freed when the application exits.
*/
- static WireFormat *newInitialDefaultWireFormat();
+ static WireFormat*
+ newInitialDefaultWireFormat();
static WireFormat *defaultWireFormat_;
};
diff --git a/ndn-cpp/face.cpp b/ndn-cpp/face.cpp
index 5780875..342a585 100644
--- a/ndn-cpp/face.cpp
+++ b/ndn-cpp/face.cpp
@@ -10,7 +10,8 @@
namespace ndn {
-void Face::expressInterest(const Name& name, const Interest *interestTemplate, const OnData& onData, const OnTimeout& onTimeout)
+void
+Face::expressInterest(const Name& name, const Interest *interestTemplate, const OnData& onData, const OnTimeout& onTimeout)
{
if (interestTemplate)
node_.expressInterest(Interest
@@ -22,7 +23,8 @@
node_.expressInterest(Interest(name, 4000.0), onData, onTimeout);
}
-void Face::shutdown()
+void
+Face::shutdown()
{
node_.shutdown();
}
diff --git a/ndn-cpp/face.hpp b/ndn-cpp/face.hpp
index affb0b7..2b202ef 100644
--- a/ndn-cpp/face.hpp
+++ b/ndn-cpp/face.hpp
@@ -46,7 +46,8 @@
* @param onTimeout A function object to call if the interest times out. If onTimeout is an empty OnTimeout(), this does not use it.
* This copies the function object, so you may need to use func_lib::ref() as appropriate.
*/
- void expressInterest(const Interest& interest, const OnData& onData, const OnTimeout& onTimeout = OnTimeout())
+ void
+ expressInterest(const Interest& interest, const OnData& onData, const OnTimeout& onTimeout = OnTimeout())
{
node_.expressInterest(interest, onData, onTimeout);
}
@@ -61,7 +62,8 @@
* @param onTimeout A function object to call if the interest times out. If onTimeout is an empty OnTimeout(), this does not use it.
* This copies the function object, so you may need to use func_lib::ref() as appropriate.
*/
- void expressInterest(const Name& name, const Interest *interestTemplate, const OnData& onData, const OnTimeout& onTimeout = OnTimeout());
+ void
+ expressInterest(const Name& name, const Interest *interestTemplate, const OnData& onData, const OnTimeout& onTimeout = OnTimeout());
/**
* Encode name as an Interest, using a default interest lifetime.
@@ -72,7 +74,8 @@
* @param onTimeout A function object to call if the interest times out. If onTimeout is an empty OnTimeout(), this does not use it.
* This copies the function object, so you may need to use func_lib::ref() as appropriate.
*/
- void expressInterest(const Name& name, const OnData& onData, const OnTimeout& onTimeout = OnTimeout())
+ void
+ expressInterest(const Name& name, const OnData& onData, const OnTimeout& onTimeout = OnTimeout())
{
expressInterest(name, 0, onData, onTimeout);
}
@@ -84,7 +87,8 @@
* use func_lib::ref() as appropriate.
* @param flags The flags for finer control of which interests are forward to the application.
*/
- void registerPrefix(const Name& prefix, const OnInterest& onInterest, int flags = 0)
+ void
+ registerPrefix(const Name& prefix, const OnInterest& onInterest, int flags = 0)
{
node_.registerPrefix(prefix, onInterest, flags);
}
@@ -96,7 +100,8 @@
* @throw This may throw an exception for reading data or in the callback for processing the data. If you
* call this from an main event loop, you may want to catch and log/disregard all exceptions.
*/
- void processEvents()
+ void
+ processEvents()
{
// Just call Node's processEvents.
node_.processEvents();
@@ -105,7 +110,8 @@
/**
* Shut down and disconnect this Face.
*/
- void shutdown();
+ void
+ shutdown();
private:
Node node_;
diff --git a/ndn-cpp/forwarding-entry.cpp b/ndn-cpp/forwarding-entry.cpp
index fad1e19..7311e3c 100644
--- a/ndn-cpp/forwarding-entry.cpp
+++ b/ndn-cpp/forwarding-entry.cpp
@@ -12,7 +12,8 @@
namespace ndn {
-void ForwardingEntry::set(const struct ndn_ForwardingEntry& forwardingEntryStruct)
+void
+ForwardingEntry::set(const struct ndn_ForwardingEntry& forwardingEntryStruct)
{
if (forwardingEntryStruct.action && forwardingEntryStruct.actionLength > 0)
action_ = string(forwardingEntryStruct.action, forwardingEntryStruct.action + forwardingEntryStruct.actionLength);
@@ -26,7 +27,8 @@
freshnessSeconds_ = forwardingEntryStruct.freshnessSeconds;
}
-void ForwardingEntry::get(struct ndn_ForwardingEntry& forwardingEntryStruct) const
+void
+ForwardingEntry::get(struct ndn_ForwardingEntry& forwardingEntryStruct) const
{
prefix_.get(forwardingEntryStruct.prefix);
publisherPublicKeyDigest_.get(forwardingEntryStruct.publisherPublicKeyDigest);
diff --git a/ndn-cpp/forwarding-entry.hpp b/ndn-cpp/forwarding-entry.hpp
index fc2fe6d..3c88a89 100644
--- a/ndn-cpp/forwarding-entry.hpp
+++ b/ndn-cpp/forwarding-entry.hpp
@@ -32,15 +32,20 @@
{
}
- Blob wireEncode(WireFormat& wireFormat = *WireFormat::getDefaultWireFormat()) const
+ Blob
+ wireEncode(WireFormat& wireFormat = *WireFormat::getDefaultWireFormat()) const
{
return wireFormat.encodeForwardingEntry(*this);
}
- void wireDecode(const unsigned char *input, unsigned int inputLength, WireFormat& wireFormat = *WireFormat::getDefaultWireFormat())
+
+ void
+ wireDecode(const unsigned char *input, unsigned int inputLength, WireFormat& wireFormat = *WireFormat::getDefaultWireFormat())
{
wireFormat.decodeForwardingEntry(*this, input, inputLength);
}
- void wireDecode(const std::vector<unsigned char>& input, WireFormat& wireFormat = *WireFormat::getDefaultWireFormat())
+
+ void
+ wireDecode(const std::vector<unsigned char>& input, WireFormat& wireFormat = *WireFormat::getDefaultWireFormat())
{
wireDecode(&input[0], input.size(), wireFormat);
}
@@ -50,36 +55,53 @@
* WARNING: The resulting pointers in forwardingEntryStruct are invalid after a further use of this object which could reallocate memory.
* @param forwardingEntryStruct a C ndn_ForwardingEntry struct where the prefix name components array is already allocated.
*/
- void get(struct ndn_ForwardingEntry& forwardingEntryStruct) const;
+ void
+ get(struct ndn_ForwardingEntry& forwardingEntryStruct) const;
- const std::string& getAction() const { return action_; }
+ const std::string&
+ getAction() const { return action_; }
- Name& getPrefix() { return prefix_; }
- const Name& getPrefix() const { return prefix_; }
+ Name&
+ getPrefix() { return prefix_; }
- PublisherPublicKeyDigest& getPublisherPublicKeyDigest() { return publisherPublicKeyDigest_; }
- const PublisherPublicKeyDigest& getPublisherPublicKeyDigest() const { return publisherPublicKeyDigest_; }
+ const Name&
+ getPrefix() const { return prefix_; }
- int getFaceId() const { return faceId_; }
+ PublisherPublicKeyDigest&
+ getPublisherPublicKeyDigest() { return publisherPublicKeyDigest_; }
+
+ const PublisherPublicKeyDigest&
+ getPublisherPublicKeyDigest() const { return publisherPublicKeyDigest_; }
+
+ int
+ getFaceId() const { return faceId_; }
- int getForwardingFlags() const { return forwardingFlags_; }
+ int
+ getForwardingFlags() const { return forwardingFlags_; }
- int getFreshnessSeconds() const { return freshnessSeconds_; }
+ int
+ getFreshnessSeconds() const { return freshnessSeconds_; }
/**
* Clear this forwarding entry, and set the values by copying from forwardingEntryStruct.
* @param forwardingEntryStruct a C ndn_ForwardingEntry struct.
*/
- void set(const struct ndn_ForwardingEntry& forwardingEntryStruct);
+ void
+ set(const struct ndn_ForwardingEntry& forwardingEntryStruct);
- void setAction(const std::string& value) { action_ = value; }
+ void
+ setAction(const std::string& value) { action_ = value; }
- void setFaceId(int value) { faceId_ = value; }
+ void
+ setFaceId(int value) { faceId_ = value; }
- void setForwardingFlags(int value) { forwardingFlags_ = value; }
+ void
+ setForwardingFlags(int value) { forwardingFlags_ = value; }
- void setFreshnessSeconds(int value) { freshnessSeconds_ = value; }
+ void
+ setFreshnessSeconds(int value) { freshnessSeconds_ = value; }
+private:
std::string action_; /**< empty for none. */
Name prefix_;
PublisherPublicKeyDigest publisherPublicKeyDigest_;
diff --git a/ndn-cpp/interest.cpp b/ndn-cpp/interest.cpp
index 0fe5ce7..3c09234 100644
--- a/ndn-cpp/interest.cpp
+++ b/ndn-cpp/interest.cpp
@@ -12,7 +12,8 @@
namespace ndn {
-void Exclude::get(struct ndn_Exclude& excludeStruct) const
+void
+Exclude::get(struct ndn_Exclude& excludeStruct) const
{
if (excludeStruct.maxEntries < entries_.size())
throw runtime_error("excludeStruct.maxEntries must be >= this exclude getEntryCount()");
@@ -22,7 +23,8 @@
entries_[i].get(excludeStruct.entries[i]);
}
-void Exclude::set(const struct ndn_Exclude& excludeStruct)
+void
+Exclude::set(const struct ndn_Exclude& excludeStruct)
{
entries_.clear();
for (unsigned int i = 0; i < excludeStruct.nEntries; ++i) {
@@ -37,7 +39,8 @@
}
}
-string Exclude::toUri() const
+string
+Exclude::toUri() const
{
if (entries_.size() == 0)
return "";
@@ -56,7 +59,8 @@
return result.str();
}
-void Interest::set(const struct ndn_Interest& interestStruct)
+void
+Interest::set(const struct ndn_Interest& interestStruct)
{
name_.set(interestStruct.name);
minSuffixComponents_ = interestStruct.minSuffixComponents;
@@ -72,7 +76,8 @@
nonce_ = Blob(interestStruct.nonce, interestStruct.nonceLength);
}
-void Interest::get(struct ndn_Interest& interestStruct) const
+void
+Interest::get(struct ndn_Interest& interestStruct) const
{
name_.get(interestStruct.name);
interestStruct.minSuffixComponents = minSuffixComponents_;
diff --git a/ndn-cpp/interest.hpp b/ndn-cpp/interest.hpp
index 3b285d8..749363f 100644
--- a/ndn-cpp/interest.hpp
+++ b/ndn-cpp/interest.hpp
@@ -39,7 +39,8 @@
* WARNING: The resulting pointer in excludeEntryStruct is invalid after a further use of this object which could reallocate memory.
* @param excludeEntryStruct the C ndn_NameComponent struct to receive the pointer
*/
- void get(struct ndn_ExcludeEntry& excludeEntryStruct) const
+ void
+ get(struct ndn_ExcludeEntry& excludeEntryStruct) const
{
excludeEntryStruct.type = type_;
if (type_ == ndn_Exclude_COMPONENT)
@@ -66,29 +67,34 @@
Exclude() {
}
- unsigned int getEntryCount() const {
+ unsigned int
+ getEntryCount() const {
return entries_.size();
}
- const ExcludeEntry& getEntry(unsigned int i) const { return entries_[i]; }
+ const ExcludeEntry&
+ getEntry(unsigned int i) const { return entries_[i]; }
/**
* Set the excludeStruct to point to the entries in this Exclude, without copying any memory.
* WARNING: The resulting pointers in excludeStruct are invalid after a further use of this object which could reallocate memory.
* @param excludeStruct a C ndn_Exclude struct where the entries array is already allocated
*/
- void get(struct ndn_Exclude& excludeStruct) const;
+ void
+ get(struct ndn_Exclude& excludeStruct) const;
/**
* Clear this Exclude, and set the entries by copying from the ndn_Exclude struct.
* @param excludeStruct a C ndn_Exclude struct
*/
- void set(const struct ndn_Exclude& excludeStruct);
+ void
+ set(const struct ndn_Exclude& excludeStruct);
/**
* Add a new entry of type ndn_Exclude_ANY
*/
- void addAny()
+ void
+ addAny()
{
entries_.push_back(ExcludeEntry());
}
@@ -96,7 +102,8 @@
/**
* Add a new entry of type ndn_Exclude_COMPONENT, copying from component of length compnentLength
*/
- void addComponent(unsigned char *component, unsigned int componentLen)
+ void
+ addComponent(unsigned char *component, unsigned int componentLen)
{
entries_.push_back(ExcludeEntry(component, componentLen));
}
@@ -104,7 +111,8 @@
/**
* Clear all the entries.
*/
- void clear() {
+ void
+ clear() {
entries_.clear();
}
@@ -160,15 +168,20 @@
construct();
}
- Blob wireEncode(WireFormat& wireFormat = *WireFormat::getDefaultWireFormat()) const
+ Blob
+ wireEncode(WireFormat& wireFormat = *WireFormat::getDefaultWireFormat()) const
{
return wireFormat.encodeInterest(*this);
}
- void wireDecode(const unsigned char *input, unsigned int inputLength, WireFormat& wireFormat = *WireFormat::getDefaultWireFormat())
+
+ void
+ wireDecode(const unsigned char *input, unsigned int inputLength, WireFormat& wireFormat = *WireFormat::getDefaultWireFormat())
{
wireFormat.decodeInterest(*this, input, inputLength);
}
- void wireDecode(const std::vector<unsigned char>& input, WireFormat& wireFormat = *WireFormat::getDefaultWireFormat())
+
+ void
+ wireDecode(const std::vector<unsigned char>& input, WireFormat& wireFormat = *WireFormat::getDefaultWireFormat())
{
wireDecode(&input[0], input.size(), wireFormat);
}
@@ -178,53 +191,79 @@
* WARNING: The resulting pointers in interestStruct are invalid after a further use of this object which could reallocate memory.
* @param interestStruct a C ndn_Interest struct where the name components array is already allocated.
*/
- void get(struct ndn_Interest& interestStruct) const;
+ void
+ get(struct ndn_Interest& interestStruct) const;
- Name& getName() { return name_; }
- const Name& getName() const { return name_; }
+ Name&
+ getName() { return name_; }
- int getMinSuffixComponents() const { return minSuffixComponents_; }
+ const Name&
+ getName() const { return name_; }
- int getMaxSuffixComponents() const { return maxSuffixComponents_; }
+ int
+ getMinSuffixComponents() const { return minSuffixComponents_; }
- PublisherPublicKeyDigest& getPublisherPublicKeyDigest() { return publisherPublicKeyDigest_; }
- const PublisherPublicKeyDigest& getPublisherPublicKeyDigest() const { return publisherPublicKeyDigest_; }
-
- Exclude& getExclude() { return exclude_; }
- const Exclude& getExclude() const { return exclude_; }
+ int
+ getMaxSuffixComponents() const { return maxSuffixComponents_; }
- int getChildSelector() const { return childSelector_; }
+ PublisherPublicKeyDigest&
+ getPublisherPublicKeyDigest() { return publisherPublicKeyDigest_; }
+
+ const PublisherPublicKeyDigest&
+ getPublisherPublicKeyDigest() const { return publisherPublicKeyDigest_; }
- int getAnswerOriginKind() const { return answerOriginKind_; }
+ Exclude&
+ getExclude() { return exclude_; }
+
+ const Exclude&
+ getExclude() const { return exclude_; }
+
+ int
+ getChildSelector() const { return childSelector_; }
- int getScope() const { return scope_; }
+ int
+ getAnswerOriginKind() const { return answerOriginKind_; }
- double getInterestLifetimeMilliseconds() const { return interestLifetimeMilliseconds_; }
+ int
+ getScope() const { return scope_; }
- const Blob& getNonce() const { return nonce_; }
+ double
+ getInterestLifetimeMilliseconds() const { return interestLifetimeMilliseconds_; }
+
+ const Blob&
+ getNonce() const { return nonce_; }
/**
* Clear this interest, and set the values by copying from the interest struct.
* @param interestStruct a C ndn_Interest struct
*/
- void set(const struct ndn_Interest& interestStruct);
+ void
+ set(const struct ndn_Interest& interestStruct);
- void setMinSuffixComponents(int value) { minSuffixComponents_ = value; }
+ void
+ setMinSuffixComponents(int value) { minSuffixComponents_ = value; }
- void setMaxSuffixComponents(int value) { maxSuffixComponents_ = value; }
+ void
+ setMaxSuffixComponents(int value) { maxSuffixComponents_ = value; }
- void setChildSelector(int value) { childSelector_ = value; }
+ void
+ setChildSelector(int value) { childSelector_ = value; }
- void setAnswerOriginKind(int value) { answerOriginKind_ = value; }
+ void
+ setAnswerOriginKind(int value) { answerOriginKind_ = value; }
- void setScope(int value) { scope_ = value; }
+ void
+ setScope(int value) { scope_ = value; }
- void setInterestLifetimeMilliseconds(double value) { interestLifetimeMilliseconds_ = value; }
+ void
+ setInterestLifetimeMilliseconds(double value) { interestLifetimeMilliseconds_ = value; }
- void setNonce(const std::vector<unsigned char>& value) { nonce_ = value; }
+ void
+ setNonce(const std::vector<unsigned char>& value) { nonce_ = value; }
private:
- void construct()
+ void
+ construct()
{
minSuffixComponents_ = -1;
maxSuffixComponents_ = -1;
diff --git a/ndn-cpp/key.cpp b/ndn-cpp/key.cpp
index 1fa7075..b453471 100644
--- a/ndn-cpp/key.cpp
+++ b/ndn-cpp/key.cpp
@@ -11,7 +11,8 @@
namespace ndn {
-void KeyLocator::get(struct ndn_KeyLocator& keyLocatorStruct) const
+void
+KeyLocator::get(struct ndn_KeyLocator& keyLocatorStruct) const
{
keyLocatorStruct.type = type_;
@@ -25,7 +26,8 @@
keyLocatorStruct.keyNameType = keyNameType_;
}
-void KeyLocator::set(const struct ndn_KeyLocator& keyLocatorStruct)
+void
+KeyLocator::set(const struct ndn_KeyLocator& keyLocatorStruct)
{
type_ = keyLocatorStruct.type;
keyData_ = Blob(keyLocatorStruct.keyData, keyLocatorStruct.keyDataLength);
diff --git a/ndn-cpp/key.hpp b/ndn-cpp/key.hpp
index c68d895..8215905 100644
--- a/ndn-cpp/key.hpp
+++ b/ndn-cpp/key.hpp
@@ -23,7 +23,8 @@
/**
* Clear the keyData and set the type to none.
*/
- void clear()
+ void
+ clear()
{
type_ = (ndn_KeyLocatorType)-1;
keyNameType_ = (ndn_KeyNameType)-1;
@@ -35,27 +36,39 @@
* WARNING: The resulting pointers in keyLocatorStruct are invalid after a further use of this object which could reallocate memory.
* @param keyLocatorStruct a C ndn_KeyLocator struct where the name components array is already allocated.
*/
- void get(struct ndn_KeyLocator& keyLocatorStruct) const;
+ void
+ get(struct ndn_KeyLocator& keyLocatorStruct) const;
/**
* Clear this key locator, and set the values by copying from the ndn_KeyLocator struct.
* @param keyLocatorStruct a C ndn_KeyLocator struct
*/
- void set(const struct ndn_KeyLocator& keyLocatorStruct);
+ void
+ set(const struct ndn_KeyLocator& keyLocatorStruct);
- ndn_KeyLocatorType getType() const { return type_; }
+ ndn_KeyLocatorType
+ getType() const { return type_; }
- const Blob& getKeyData() const { return keyData_; }
+ const Blob&
+ getKeyData() const { return keyData_; }
- const Name& getKeyName() const { return keyName_; }
- Name& getKeyName() { return keyName_; }
-
- ndn_KeyNameType getKeyNameType() const { return keyNameType_; }
-
- void setType(ndn_KeyLocatorType type) { type_ = type; }
+ const Name&
+ getKeyName() const { return keyName_; }
- void setKeyData(const std::vector<unsigned char>& keyData) { keyData_ = keyData; }
- void setKeyData(const unsigned char *keyData, unsigned int keyDataLength)
+ Name&
+ getKeyName() { return keyName_; }
+
+ ndn_KeyNameType
+ getKeyNameType() const { return keyNameType_; }
+
+ void
+ setType(ndn_KeyLocatorType type) { type_ = type; }
+
+ void
+ setKeyData(const std::vector<unsigned char>& keyData) { keyData_ = keyData; }
+
+ void
+ setKeyData(const unsigned char *keyData, unsigned int keyDataLength)
{
keyData_ = Blob(keyData, keyDataLength);
}
@@ -65,9 +78,11 @@
* if you keep a pointer to the array then you must treat the array as immutable and promise not to change it.
* @param keyData A pointer to a vector with the byte array. This takes another reference and does not copy the bytes.
*/
- void setKeyData(const ptr_lib::shared_ptr<std::vector<unsigned char> > &keyData) { keyData_ = keyData; }
+ void
+ setKeyData(const ptr_lib::shared_ptr<std::vector<unsigned char> > &keyData) { keyData_ = keyData; }
- void setKeyNameType(ndn_KeyNameType keyNameType) { keyNameType_ = keyNameType; }
+ void
+ setKeyNameType(ndn_KeyNameType keyNameType) { keyNameType_ = keyNameType; }
private:
ndn_KeyLocatorType type_; /**< -1 for none */
diff --git a/ndn-cpp/name.cpp b/ndn-cpp/name.cpp
index 2b5c6a9..1496219 100644
--- a/ndn-cpp/name.cpp
+++ b/ndn-cpp/name.cpp
@@ -18,7 +18,8 @@
* Modify str in place to erase whitespace on the left.
* @param str
*/
-static inline void trimLeft(string& str)
+static inline void
+trimLeft(string& str)
{
size_t found = str.find_first_not_of(WHITESPACE_CHARS);
if (found != string::npos) {
@@ -34,7 +35,8 @@
* Modify str in place to erase whitespace on the right.
* @param str
*/
-static inline void trimRight(string& str)
+static inline void
+trimRight(string& str)
{
size_t found = str.find_last_not_of(WHITESPACE_CHARS);
if (found != string::npos) {
@@ -50,7 +52,8 @@
* Modify str in place to erase whitespace on the left and right.
* @param str
*/
-static void trim(string& str)
+static void
+trim(string& str)
{
trimLeft(str);
trimRight(str);
@@ -61,7 +64,8 @@
* @param c
* @return
*/
-static int fromHexChar(unsigned char c)
+static int
+fromHexChar(unsigned char c)
{
if (c >= '0' && c <= '9')
return (int)c - (int)'0';
@@ -77,7 +81,8 @@
* Return a copy of str, converting each escaped "%XX" to the char value.
* @param str
*/
-static string unescape(const string& str)
+static string
+unescape(const string& str)
{
ostringstream result;
@@ -103,7 +108,8 @@
return result.str();
}
-Blob Name::Component::makeFromEscapedString(const char *escapedString, unsigned int beginOffset, unsigned int endOffset)
+Blob
+Name::Component::makeFromEscapedString(const char *escapedString, unsigned int beginOffset, unsigned int endOffset)
{
string trimmedString(escapedString + beginOffset, escapedString + endOffset);
trim(trimmedString);
@@ -122,7 +128,8 @@
return Blob((const unsigned char *)&component[0], component.size());
}
-Blob Name::Component::makeSegment(unsigned long segment)
+Blob
+Name::Component::makeSegment(unsigned long segment)
{
ptr_lib::shared_ptr<vector<unsigned char> > value;
@@ -140,7 +147,8 @@
return Blob(value);
}
-void Name::set(const char *uri_cstr)
+void
+Name::set(const char *uri_cstr)
{
components_.clear();
@@ -196,7 +204,8 @@
}
}
-void Name::get(struct ndn_Name& nameStruct) const
+void
+Name::get(struct ndn_Name& nameStruct) const
{
if (nameStruct.maxComponents < components_.size())
throw runtime_error("nameStruct.maxComponents must be >= this name getNComponents()");
@@ -206,14 +215,16 @@
components_[i].get(nameStruct.components[i]);
}
-void Name::set(const struct ndn_Name& nameStruct)
+void
+Name::set(const struct ndn_Name& nameStruct)
{
clear();
for (unsigned int i = 0; i < nameStruct.nComponents; ++i)
addComponent(nameStruct.components[i].value, nameStruct.components[i].valueLength);
}
-std::string Name::toUri() const
+std::string
+Name::toUri() const
{
if (components_.size() == 0)
return "/";
@@ -227,7 +238,8 @@
return result.str();
}
-bool Name::match(const Name& name) const
+bool
+Name::match(const Name& name) const
{
// Imitate ndn_Name_match.
@@ -248,7 +260,8 @@
return true;
}
-void Name::toEscapedString(const vector<unsigned char>& value, ostringstream& result)
+void
+Name::toEscapedString(const vector<unsigned char>& value, ostringstream& result)
{
bool gotNonDot = false;
for (unsigned i = 0; i < value.size(); ++i) {
diff --git a/ndn-cpp/name.hpp b/ndn-cpp/name.hpp
index cd80fac..8129979 100644
--- a/ndn-cpp/name.hpp
+++ b/ndn-cpp/name.hpp
@@ -63,7 +63,8 @@
* WARNING: The resulting pointer in componentStruct is invalid after a further use of this object which could reallocate memory.
* @param componentStruct The C ndn_NameComponent struct to receive the pointer.
*/
- void get(struct ndn_NameComponent& componentStruct) const
+ void
+ get(struct ndn_NameComponent& componentStruct) const
{
componentStruct.valueLength = value_.size();
if (value_.size() > 0)
@@ -72,7 +73,8 @@
componentStruct.value = 0;
}
- const Blob& getValue() const { return value_; }
+ const Blob&
+ getValue() const { return value_; }
/**
* Make a component value by decoding the escapedString between beginOffset and endOffset according to the NDN URI Scheme.
@@ -83,14 +85,16 @@
* @param endOffset The offset in escapedString of the end of the portion to decode.
* @return The component value as a Blob, or a Blob with a null pointer if escapedString is not a valid escaped component.
*/
- static Blob makeFromEscapedString(const char *escapedString, unsigned int beginOffset, unsigned int endOffset);
+ static Blob
+ makeFromEscapedString(const char *escapedString, unsigned int beginOffset, unsigned int endOffset);
/**
* Make a component as the encoded segment number.
* @param segment The segment number.
* @return The component value as a Blob.
*/
- static Blob makeSegment(unsigned long segment);
+ static Blob
+ makeSegment(unsigned long segment);
private:
Blob value_;
@@ -125,24 +129,28 @@
* WARNING: The resulting pointers in nameStruct are invalid after a further use of this object which could reallocate memory.
* @param nameStruct A C ndn_Name struct where the components array is already allocated.
*/
- void get(struct ndn_Name& nameStruct) const;
+ void
+ get(struct ndn_Name& nameStruct) const;
/**
* Clear this name, and set the components by copying from the name struct.
* @param nameStruct A C ndn_Name struct
*/
- void set(const struct ndn_Name& nameStruct);
+ void
+ set(const struct ndn_Name& nameStruct);
/**
* Parse the uri according to the NDN URI Scheme and set the name with the components.
* @param uri The URI string.
*/
- void set(const char *uri);
+ void
+ set(const char *uri);
/**
* Add a new component, copying from value of length valueLength.
*/
- void addComponent(const unsigned char *value, unsigned int valueLength)
+ void
+ addComponent(const unsigned char *value, unsigned int valueLength)
{
components_.push_back(Component(value, valueLength));
}
@@ -150,12 +158,14 @@
/**
* Add a new component, copying from value.
*/
- void addComponent(const std::vector<unsigned char>& value)
+ void
+ addComponent(const std::vector<unsigned char>& value)
{
components_.push_back(value);
}
- void addComponent(const Blob &value)
+ void
+ addComponent(const Blob &value)
{
components_.push_back(value);
}
@@ -163,7 +173,8 @@
/**
* Clear all the components.
*/
- void clear() {
+ void
+ clear() {
components_.clear();
}
@@ -171,22 +182,26 @@
* Get the number of components.
* @return The number of components.
*/
- unsigned int getComponentCount() const {
+ unsigned int
+ getComponentCount() const {
return components_.size();
}
- const Component& getComponent(unsigned int i) const { return components_[i]; }
+ const Component&
+ getComponent(unsigned int i) const { return components_[i]; }
/**
* Encode this name as a URI.
* @return The encoded URI.
*/
- std::string toUri() const;
+ std::string
+ toUri() const;
/**
* @deprecated Use toUri().
*/
- std::string to_uri() const
+ std::string
+ to_uri() const
{
return toUri();
}
@@ -195,7 +210,8 @@
* Append a component with the encoded segment number.
* @param segment The segment number.
*/
- void appendSegment(unsigned long segment)
+ void
+ appendSegment(unsigned long segment)
{
components_.push_back(Component(Component::makeSegment(segment)));
}
@@ -205,7 +221,8 @@
* @param name The Name to check.
* @return true if this matches the given name, otherwise false. This always returns true if this name is empty.
*/
- bool match(const Name& name) const;
+ bool
+ match(const Name& name) const;
/**
* Write the value to result, escaping characters according to the NDN URI Scheme.
@@ -213,7 +230,8 @@
* @param value the buffer with the value to escape
* @param result the string stream to write to.
*/
- static void toEscapedString(const std::vector<unsigned char>& value, std::ostringstream& result);
+ static void
+ toEscapedString(const std::vector<unsigned char>& value, std::ostringstream& result);
private:
std::vector<Component> components_;
diff --git a/ndn-cpp/node.cpp b/ndn-cpp/node.cpp
index 779d285..2cf881f 100644
--- a/ndn-cpp/node.cpp
+++ b/ndn-cpp/node.cpp
@@ -18,7 +18,8 @@
namespace ndn {
// Use gettimeofday to return the current time in milliseconds.
-static inline double getNowMilliseconds()
+static inline double
+getNowMilliseconds()
{
timeval t;
gettimeofday(&t, NULL);
@@ -31,7 +32,8 @@
{
}
-void Node::expressInterest(const Interest& interest, const OnData& onData, const OnTimeout& onTimeout)
+void
+Node::expressInterest(const Interest& interest, const OnData& onData, const OnTimeout& onTimeout)
{
// TODO: Properly check if we are already connected to the expected host.
if (!transport_->getIsConnected())
@@ -43,7 +45,8 @@
transport_->send(*encoding);
}
-void Node::registerPrefix(const Name& prefix, const OnInterest& onInterest, int flags)
+void
+Node::registerPrefix(const Name& prefix, const OnInterest& onInterest, int flags)
{
if (ndndId_.size() == 0) {
// First fetch the ndndId of the connected hub.
@@ -55,7 +58,8 @@
registerPrefixHelper(prefix, onInterest, flags);
}
-void Node::NdndIdFetcher::operator()(const ptr_lib::shared_ptr<const Interest>& interest, const ptr_lib::shared_ptr<Data>& ndndIdData)
+void
+Node::NdndIdFetcher::operator()(const ptr_lib::shared_ptr<const Interest>& interest, const ptr_lib::shared_ptr<Data>& ndndIdData)
{
Sha256WithRsaSignature *signature = dynamic_cast<Sha256WithRsaSignature*>(ndndIdData->getSignature());
if (signature && signature->getPublisherPublicKeyDigest().getPublisherPublicKeyDigest().size() > 0) {
@@ -67,12 +71,14 @@
// TODO: else need to log not getting the ndndId.
}
-void Node::NdndIdFetcher::operator()(const ptr_lib::shared_ptr<const Interest>& timedOutInterest)
+void
+Node::NdndIdFetcher::operator()(const ptr_lib::shared_ptr<const Interest>& timedOutInterest)
{
// TODO: Log the timeout.
}
-void Node::registerPrefixHelper(const Name& prefix, const OnInterest& onInterest, int flags)
+void
+Node::registerPrefixHelper(const Name& prefix, const OnInterest& onInterest, int flags)
{
// Create a ForwardingEntry.
ForwardingEntry forwardingEntry("selfreg", prefix, PublisherPublicKeyDigest(), -1, 3, 2147483647);
@@ -105,7 +111,8 @@
transport_->send(*encodedInterest);
}
-void Node::processEvents()
+void
+Node::processEvents()
{
transport_->processEvents();
@@ -121,7 +128,8 @@
}
}
-void Node::onReceivedElement(const unsigned char *element, unsigned int elementLength)
+void
+Node::onReceivedElement(const unsigned char *element, unsigned int elementLength)
{
BinaryXmlDecoder decoder(element, elementLength);
@@ -148,12 +156,14 @@
}
}
-void Node::shutdown()
+void
+Node::shutdown()
{
transport_->close();
}
-int Node::getEntryIndexForExpressedInterest(const Name& name)
+int
+Node::getEntryIndexForExpressedInterest(const Name& name)
{
// TODO: Doesn't this belong in the Name class?
vector<struct ndn_NameComponent> nameComponents;
@@ -176,7 +186,8 @@
return iResult;
}
-Node::PrefixEntry *Node::getEntryForRegisteredPrefix(const Name& name)
+Node::PrefixEntry*
+Node::getEntryForRegisteredPrefix(const Name& name)
{
int iResult = -1;
@@ -214,7 +225,8 @@
interest_->get(interestStruct_);
}
-bool Node::PitEntry::checkTimeout(Node *parent, double nowMilliseconds)
+bool
+Node::PitEntry::checkTimeout(Node *parent, double nowMilliseconds)
{
if (timeoutTimeMilliseconds_ >= 0.0 && nowMilliseconds >= timeoutTimeMilliseconds_) {
if (onTimeout_) {
diff --git a/ndn-cpp/node.hpp b/ndn-cpp/node.hpp
index 6301be7..3eb9597 100644
--- a/ndn-cpp/node.hpp
+++ b/ndn-cpp/node.hpp
@@ -50,7 +50,8 @@
* @param onTimeout A function object to call if the interest times out. If onTimeout is an empty OnTimeout(), this does not use it.
* This copies the function object, so you may need to use func_lib::ref() as appropriate.
*/
- void expressInterest(const Interest& interest, const OnData& onData, const OnTimeout& onTimeout);
+ void
+ expressInterest(const Interest& interest, const OnData& onData, const OnTimeout& onTimeout);
/**
* Register prefix with the connected NDN hub and call onInterest when a matching interest is received.
@@ -59,7 +60,8 @@
* use func_lib::ref() as appropriate.
* @param flags The flags for finer control of which interests are forward to the application.
*/
- void registerPrefix(const Name& prefix, const OnInterest& onInterest, int flags);
+ void
+ registerPrefix(const Name& prefix, const OnInterest& onInterest, int flags);
/**
* Process any data to receive. For each element received, call onReceivedElement.
@@ -68,15 +70,20 @@
* @throw This may throw an exception for reading data or in the callback for processing the data. If you
* call this from an main event loop, you may want to catch and log/disregard all exceptions.
*/
- void processEvents();
+ void
+ processEvents();
- const ptr_lib::shared_ptr<Transport>& getTransport() { return transport_; }
+ const ptr_lib::shared_ptr<Transport>&
+ getTransport() { return transport_; }
- const ptr_lib::shared_ptr<const Transport::ConnectionInfo>& getConnectionInfo() { return connectionInfo_; }
+ const ptr_lib::shared_ptr<const Transport::ConnectionInfo>&
+ getConnectionInfo() { return connectionInfo_; }
- void onReceivedElement(const unsigned char *element, unsigned int elementLength);
+ void
+ onReceivedElement(const unsigned char *element, unsigned int elementLength);
- void shutdown();
+ void
+ shutdown();
private:
class PitEntry {
@@ -89,9 +96,11 @@
*/
PitEntry(const ptr_lib::shared_ptr<const Interest>& interest, const OnData& onData, const OnTimeout& onTimeout);
- const ptr_lib::shared_ptr<const Interest>& getInterest() { return interest_; }
+ const ptr_lib::shared_ptr<const Interest>&
+ getInterest() { return interest_; }
- const OnData& getOnData() { return onData_; }
+ const OnData&
+ getOnData() { return onData_; }
/**
* Get the struct ndn_Interest for the interest_.
@@ -101,7 +110,8 @@
* @return A reference to the ndn_Interest struct.
* WARNING: The resulting pointers in are invalid uses getInterest() to manipulate the object which could reallocate memory.
*/
- const struct ndn_Interest& getInterestStruct()
+ const struct ndn_Interest&
+ getInterestStruct()
{
return interestStruct_;
}
@@ -112,7 +122,8 @@
* @param nowMilliseconds The current time in milliseconds from gettimeofday.
* @return true if this interest timed out and the timeout callback was called, otherwise false.
*/
- bool checkTimeout(Node *parent, double nowMilliseconds);
+ bool
+ checkTimeout(Node *parent, double nowMilliseconds);
private:
ptr_lib::shared_ptr<const Interest> interest_;
@@ -137,9 +148,11 @@
{
}
- const ptr_lib::shared_ptr<const Name>& getPrefix() { return prefix_; }
+ const ptr_lib::shared_ptr<const Name>&
+ getPrefix() { return prefix_; }
- const OnInterest& getOnInterest() { return onInterest_; }
+ const OnInterest&
+ getOnInterest() { return onInterest_; }
private:
ptr_lib::shared_ptr<const Name> prefix_;
@@ -163,13 +176,15 @@
* @param interest
* @param data
*/
- void operator()(const ptr_lib::shared_ptr<const Interest>& interest, const ptr_lib::shared_ptr<Data>& ndndIdData);
+ void
+ operator()(const ptr_lib::shared_ptr<const Interest>& interest, const ptr_lib::shared_ptr<Data>& ndndIdData);
/**
* We timed out fetching the ndnd ID.
* @param interest
*/
- void operator()(const ptr_lib::shared_ptr<const Interest>& timedOutInterest);
+ void
+ operator()(const ptr_lib::shared_ptr<const Interest>& timedOutInterest);
class Info {
public:
@@ -194,14 +209,16 @@
* @param name The name to find the interest for (from the incoming data packet).
* @return The index in pit_ of the pit entry, or -1 if not found.
*/
- int getEntryIndexForExpressedInterest(const Name& name);
+ int
+ getEntryIndexForExpressedInterest(const Name& name);
/**
* Find the first entry from the registeredPrefixTable_ where the entry prefix is the longest that matches name.
* @param name The name to find the PrefixEntry for (from the incoming interest packet).
* @return A pointer to the entry, or 0 if not found.
*/
- PrefixEntry *getEntryForRegisteredPrefix(const Name& name);
+ PrefixEntry*
+ getEntryForRegisteredPrefix(const Name& name);
/**
* Do the work of registerPrefix once we know we are connected with an ndndId_.
@@ -209,7 +226,8 @@
* @param onInterest
* @param flags
*/
- void registerPrefixHelper(const Name& prefix, const OnInterest& onInterest, int flags);
+ void
+ registerPrefixHelper(const Name& prefix, const OnInterest& onInterest, int flags);
ptr_lib::shared_ptr<Transport> transport_;
ptr_lib::shared_ptr<const Transport::ConnectionInfo> connectionInfo_;
diff --git a/ndn-cpp/publisher-public-key-digest.hpp b/ndn-cpp/publisher-public-key-digest.hpp
index df2da0b..7ce6dc7 100644
--- a/ndn-cpp/publisher-public-key-digest.hpp
+++ b/ndn-cpp/publisher-public-key-digest.hpp
@@ -27,7 +27,8 @@
* WARNING: The resulting pointers in publisherPublicKeyDigestStruct are invalid after a further use of this object which could reallocate memory.
* @param publisherPublicKeyDigestStruct a C ndn_PublisherPublicKeyDigest struct to receive the pointer
*/
- void get(struct ndn_PublisherPublicKeyDigest& publisherPublicKeyDigestStruct) const
+ void
+ get(struct ndn_PublisherPublicKeyDigest& publisherPublicKeyDigestStruct) const
{
publisherPublicKeyDigestStruct.publisherPublicKeyDigestLength = publisherPublicKeyDigest_.size();
if (publisherPublicKeyDigest_.size() > 0)
@@ -40,16 +41,24 @@
* Clear this PublisherPublicKeyDigest, and copy from the ndn_PublisherPublicKeyDigest struct.
* @param excludeStruct a C ndn_Exclude struct
*/
- void set(const struct ndn_PublisherPublicKeyDigest& publisherPublicKeyDigestStruct)
+ void
+ set(const struct ndn_PublisherPublicKeyDigest& publisherPublicKeyDigestStruct)
{
publisherPublicKeyDigest_ =
Blob(publisherPublicKeyDigestStruct.publisherPublicKeyDigest, publisherPublicKeyDigestStruct.publisherPublicKeyDigestLength);
}
- const Blob& getPublisherPublicKeyDigest() const { return publisherPublicKeyDigest_; }
+ const Blob&
+ getPublisherPublicKeyDigest() const { return publisherPublicKeyDigest_; }
- void setPublisherPublicKeyDigest(const std::vector<unsigned char>& publisherPublicKeyDigest) { publisherPublicKeyDigest_ = publisherPublicKeyDigest; }
- void setPublisherPublicKeyDigest(const unsigned char *publisherPublicKeyDigest, unsigned int publisherPublicKeyDigestLength)
+ void
+ setPublisherPublicKeyDigest(const std::vector<unsigned char>& publisherPublicKeyDigest)
+ {
+ publisherPublicKeyDigest_ = publisherPublicKeyDigest;
+ }
+
+ void
+ setPublisherPublicKeyDigest(const unsigned char *publisherPublicKeyDigest, unsigned int publisherPublicKeyDigestLength)
{
publisherPublicKeyDigest_ = Blob(publisherPublicKeyDigest, publisherPublicKeyDigestLength);
}
@@ -57,7 +66,8 @@
/**
* Clear the publisherPublicKeyDigest.
*/
- void clear()
+ void
+ clear()
{
publisherPublicKeyDigest_.reset();
}
diff --git a/ndn-cpp/security/identity/identity-manager.cpp b/ndn-cpp/security/identity/identity-manager.cpp
index 1d0639f..3955518 100644
--- a/ndn-cpp/security/identity/identity-manager.cpp
+++ b/ndn-cpp/security/identity/identity-manager.cpp
@@ -9,7 +9,8 @@
namespace ndn {
-void IdentityManager::signByCertificate(const Data &data, const Name &certificateName, WireFormat& wireFormat)
+void
+IdentityManager::signByCertificate(const Data &data, const Name &certificateName, WireFormat& wireFormat)
{
}
diff --git a/ndn-cpp/security/identity/identity-manager.hpp b/ndn-cpp/security/identity/identity-manager.hpp
index bb4bc00..86a35b6 100644
--- a/ndn-cpp/security/identity/identity-manager.hpp
+++ b/ndn-cpp/security/identity/identity-manager.hpp
@@ -22,7 +22,8 @@
* @param certificateName The Name identifying the certificate which identifies the signing key.
* @param wireFormat The WireFormat for calling encodeData, or WireFormat::getDefaultWireFormat() if omitted.
*/
- void signByCertificate(const Data& data, const Name& certificateName, WireFormat& wireFormat = *WireFormat::getDefaultWireFormat());
+ void
+ signByCertificate(const Data& data, const Name& certificateName, WireFormat& wireFormat = *WireFormat::getDefaultWireFormat());
};
}
diff --git a/ndn-cpp/security/key-chain.cpp b/ndn-cpp/security/key-chain.cpp
index 1a8d12b..da8108c 100644
--- a/ndn-cpp/security/key-chain.cpp
+++ b/ndn-cpp/security/key-chain.cpp
@@ -66,7 +66,8 @@
* @param data The Data object with the fields to digest.
* @param digest A pointer to a buffer of size SHA256_DIGEST_LENGTH to receive the data.
*/
-static void dataSignedPortionSha256(const Data& data, WireFormat& wireFormat, unsigned char *digest)
+static void
+dataSignedPortionSha256(const Data& data, WireFormat& wireFormat, unsigned char *digest)
{
unsigned int signedPortionBeginOffset, signedPortionEndOffset;
Blob encoding = wireFormat.encodeData(data, &signedPortionBeginOffset, &signedPortionEndOffset);
@@ -74,7 +75,8 @@
ndn_digestSha256(encoding.buf() + signedPortionBeginOffset, signedPortionEndOffset - signedPortionBeginOffset, digest);
}
-void KeyChain::sign
+void
+KeyChain::sign
(Data& data, const unsigned char *publicKeyDer, unsigned int publicKeyDerLength,
const unsigned char *privateKeyDer, unsigned int privateKeyDerLength, WireFormat& wireFormat)
{
@@ -108,12 +110,14 @@
signature->setSignature(signatureBits, signatureBitsLength);
}
-void KeyChain::defaultSign(Data& data, WireFormat& wireFormat)
+void
+KeyChain::defaultSign(Data& data, WireFormat& wireFormat)
{
sign(data, DEFAULT_PUBLIC_KEY_DER, sizeof(DEFAULT_PUBLIC_KEY_DER), DEFAULT_PRIVATE_KEY_DER, sizeof(DEFAULT_PRIVATE_KEY_DER), wireFormat);
}
-bool KeyChain::selfVerifyData(const unsigned char *input, unsigned int inputLength, WireFormat& wireFormat)
+bool
+KeyChain::selfVerifyData(const unsigned char *input, unsigned int inputLength, WireFormat& wireFormat)
{
// Decode the data packet and digest the data fields.
Data data;
diff --git a/ndn-cpp/security/key-chain.hpp b/ndn-cpp/security/key-chain.hpp
index 297e490..7cfa64e 100644
--- a/ndn-cpp/security/key-chain.hpp
+++ b/ndn-cpp/security/key-chain.hpp
@@ -25,7 +25,8 @@
* @param privateKeyDerLength The number of bytes in privateKeyDer.
* @param wireFormat The WireFormat for calling encodeData.
*/
- static void sign
+ static void
+ sign
(Data& data, const unsigned char *publicKeyDer, unsigned int publicKeyDerLength,
const unsigned char *privateKeyDer, unsigned int privateKeyDerLength, WireFormat& wireFormat);
@@ -34,7 +35,8 @@
* @param data
* @param wireFormat The WireFormat for calling encodeData, or WireFormat::getDefaultWireFormat() if omitted.
*/
- static void defaultSign(Data& data, WireFormat& wireFormat = *WireFormat::getDefaultWireFormat());
+ static void
+ defaultSign(Data& data, WireFormat& wireFormat = *WireFormat::getDefaultWireFormat());
/**
* Use the WireFormat to decode the input as a Data packet and use the public key in the key locator to
@@ -46,9 +48,11 @@
* @return true if the public key in the Data object verifies the object, false if not or if the Data object
* doesn't have a public key.
*/
- static bool selfVerifyData(const unsigned char *input, unsigned int inputLength, WireFormat& wireFormat);
+ static bool
+ selfVerifyData(const unsigned char *input, unsigned int inputLength, WireFormat& wireFormat);
- static bool selfVerifyData(const unsigned char *input, unsigned int inputLength)
+ static bool
+ selfVerifyData(const unsigned char *input, unsigned int inputLength)
{
return selfVerifyData(input, inputLength, *WireFormat::getDefaultWireFormat());
}
diff --git a/ndn-cpp/sha256-with-rsa-signature.cpp b/ndn-cpp/sha256-with-rsa-signature.cpp
index 3b71d70..aad9c9f 100644
--- a/ndn-cpp/sha256-with-rsa-signature.cpp
+++ b/ndn-cpp/sha256-with-rsa-signature.cpp
@@ -10,12 +10,14 @@
namespace ndn {
-ptr_lib::shared_ptr<Signature> Sha256WithRsaSignature::clone() const
+ptr_lib::shared_ptr<Signature>
+Sha256WithRsaSignature::clone() const
{
return ptr_lib::shared_ptr<Signature>(new Sha256WithRsaSignature(*this));
}
-void Sha256WithRsaSignature::get(struct ndn_Signature& signatureStruct) const
+void
+Sha256WithRsaSignature::get(struct ndn_Signature& signatureStruct) const
{
signatureStruct.digestAlgorithmLength = digestAlgorithm_.size();
if (digestAlgorithm_.size() > 0)
@@ -39,7 +41,8 @@
keyLocator_.get(signatureStruct.keyLocator);
}
-void Sha256WithRsaSignature::set(const struct ndn_Signature& signatureStruct)
+void
+Sha256WithRsaSignature::set(const struct ndn_Signature& signatureStruct)
{
digestAlgorithm_ = Blob(signatureStruct.digestAlgorithm, signatureStruct.digestAlgorithmLength);
witness_ = Blob(signatureStruct.witness, signatureStruct.witnessLength);
diff --git a/ndn-cpp/sha256-with-rsa-signature.hpp b/ndn-cpp/sha256-with-rsa-signature.hpp
index d111058..24fa69f 100644
--- a/ndn-cpp/sha256-with-rsa-signature.hpp
+++ b/ndn-cpp/sha256-with-rsa-signature.hpp
@@ -21,59 +21,83 @@
/**
* Return a pointer to a new Sha256WithRsaSignature which is a copy of this signature.
*/
- virtual ptr_lib::shared_ptr<Signature> clone() const;
+ virtual ptr_lib::shared_ptr<Signature>
+ clone() const;
/**
* Set the signatureStruct to point to the values in this signature object, without copying any memory.
* WARNING: The resulting pointers in signatureStruct are invalid after a further use of this object which could reallocate memory.
* @param signatureStruct a C ndn_Signature struct where the name components array is already allocated.
*/
- virtual void get(struct ndn_Signature& signatureStruct) const;
+ virtual void
+ get(struct ndn_Signature& signatureStruct) const;
/**
* Clear this signature, and set the values by copying from the ndn_Signature struct.
* @param signatureStruct a C ndn_Signature struct
*/
- virtual void set(const struct ndn_Signature& signatureStruct);
+ virtual void
+ set(const struct ndn_Signature& signatureStruct);
- const Blob& getDigestAlgorithm() const { return digestAlgorithm_; }
+ const Blob&
+ getDigestAlgorithm() const { return digestAlgorithm_; }
- const Blob& getWitness() const { return witness_; }
+ const Blob&
+ getWitness() const { return witness_; }
- const Blob& getSignature() const { return signature_; }
+ const Blob&
+ getSignature() const { return signature_; }
- const PublisherPublicKeyDigest& getPublisherPublicKeyDigest() const { return publisherPublicKeyDigest_; }
- PublisherPublicKeyDigest& getPublisherPublicKeyDigest() { return publisherPublicKeyDigest_; }
+ const PublisherPublicKeyDigest&
+ getPublisherPublicKeyDigest() const { return publisherPublicKeyDigest_; }
- const KeyLocator& getKeyLocator() const { return keyLocator_; }
- KeyLocator& getKeyLocator() { return keyLocator_; }
+ PublisherPublicKeyDigest&
+ getPublisherPublicKeyDigest() { return publisherPublicKeyDigest_; }
+
+ const KeyLocator&
+ getKeyLocator() const { return keyLocator_; }
+
+ KeyLocator&
+ getKeyLocator() { return keyLocator_; }
- void setDigestAlgorithm(const std::vector<unsigned char>& digestAlgorithm) { digestAlgorithm_ = digestAlgorithm; }
- void setDigestAlgorithm(const unsigned char *digestAlgorithm, unsigned int digestAlgorithmLength)
+ void
+ setDigestAlgorithm(const std::vector<unsigned char>& digestAlgorithm) { digestAlgorithm_ = digestAlgorithm; }
+
+ void
+ setDigestAlgorithm(const unsigned char *digestAlgorithm, unsigned int digestAlgorithmLength)
{
digestAlgorithm_ = Blob(digestAlgorithm, digestAlgorithmLength);
}
- void setWitness(const std::vector<unsigned char>& witness) { witness_ = witness; }
- void setWitness(const unsigned char *witness, unsigned int witnessLength)
+ void
+ setWitness(const std::vector<unsigned char>& witness) { witness_ = witness; }
+
+ void
+ setWitness(const unsigned char *witness, unsigned int witnessLength)
{
witness_ = Blob(witness, witnessLength);
}
- void setSignature(const std::vector<unsigned char>& signature) { signature_ = signature; }
- void setSignature(const unsigned char *signature, unsigned int signatureLength)
+ void
+ setSignature(const std::vector<unsigned char>& signature) { signature_ = signature; }
+
+ void
+ setSignature(const unsigned char *signature, unsigned int signatureLength)
{
signature_ = Blob(signature, signatureLength);
}
- void setPublisherPublicKeyDigest(const PublisherPublicKeyDigest& publisherPublicKeyDigest) { publisherPublicKeyDigest_ = publisherPublicKeyDigest; }
+ void
+ setPublisherPublicKeyDigest(const PublisherPublicKeyDigest& publisherPublicKeyDigest) { publisherPublicKeyDigest_ = publisherPublicKeyDigest; }
- void setKeyLocator(const KeyLocator& keyLocator) { keyLocator_ = keyLocator; }
+ void
+ setKeyLocator(const KeyLocator& keyLocator) { keyLocator_ = keyLocator; }
/**
* Clear all the fields.
*/
- void clear()
+ void
+ clear()
{
digestAlgorithm_.reset();
witness_.reset();
diff --git a/ndn-cpp/transport/tcp-transport.cpp b/ndn-cpp/transport/tcp-transport.cpp
index 2fbfeeb..e454e4a 100644
--- a/ndn-cpp/transport/tcp-transport.cpp
+++ b/ndn-cpp/transport/tcp-transport.cpp
@@ -17,7 +17,8 @@
{
}
-void TcpTransport::connect(const Transport::ConnectionInfo& connectionInfo, ElementListener& elementListener)
+void
+TcpTransport::connect(const Transport::ConnectionInfo& connectionInfo, ElementListener& elementListener)
{
const TcpTransport::ConnectionInfo& tcpConnectionInfo = dynamic_cast<const TcpTransport::ConnectionInfo&>(connectionInfo);
@@ -35,14 +36,16 @@
elementListener_ = &elementListener;
}
-void TcpTransport::send(const unsigned char *data, unsigned int dataLength)
+void
+TcpTransport::send(const unsigned char *data, unsigned int dataLength)
{
ndn_Error error;
if ((error = ndn_TcpTransport_send(&transport_, (unsigned char *)data, dataLength)))
throw std::runtime_error(ndn_getErrorString(error));
}
-void TcpTransport::processEvents()
+void
+TcpTransport::processEvents()
{
int receiveIsReady;
ndn_Error error;
@@ -59,12 +62,14 @@
ndn_BinaryXmlElementReader_onReceivedData(&elementReader_, buffer, nBytes);
}
-bool TcpTransport::getIsConnected()
+bool
+TcpTransport::getIsConnected()
{
return isConnected_;
}
-void TcpTransport::close()
+void
+TcpTransport::close()
{
ndn_Error error;
if ((error = ndn_TcpTransport_close(&transport_)))
diff --git a/ndn-cpp/transport/tcp-transport.hpp b/ndn-cpp/transport/tcp-transport.hpp
index 9e12ef6..1f8a573 100644
--- a/ndn-cpp/transport/tcp-transport.hpp
+++ b/ndn-cpp/transport/tcp-transport.hpp
@@ -35,15 +35,18 @@
* Get the host given to the constructor.
* @return A string reference for the host.
*/
- const std::string& getHost() const { return host_; }
+ const std::string&
+ getHost() const { return host_; }
/**
* Get the port given to the constructor.
* @return The port number.
*/
- unsigned short getPort() const { return port_; }
+ unsigned short
+ getPort() const { return port_; }
- virtual ~ConnectionInfo();
+ virtual
+ ~ConnectionInfo();
private:
std::string host_;
diff --git a/ndn-cpp/transport/transport.cpp b/ndn-cpp/transport/transport.cpp
index bb28045..ae532db 100644
--- a/ndn-cpp/transport/transport.cpp
+++ b/ndn-cpp/transport/transport.cpp
@@ -15,27 +15,32 @@
{
}
-void Transport::connect(const Transport::ConnectionInfo& connectionInfo, ElementListener& elementListener)
+void
+Transport::connect(const Transport::ConnectionInfo& connectionInfo, ElementListener& elementListener)
{
throw logic_error("unimplemented");
}
-void Transport::send(const unsigned char *data, unsigned int dataLength)
+void
+Transport::send(const unsigned char *data, unsigned int dataLength)
{
throw logic_error("unimplemented");
}
-void Transport::processEvents()
+void
+Transport::processEvents()
{
throw logic_error("unimplemented");
}
-bool Transport::getIsConnected()
+bool
+Transport::getIsConnected()
{
throw logic_error("unimplemented");
}
-void Transport::close()
+void
+Transport::close()
{
}
diff --git a/ndn-cpp/transport/transport.hpp b/ndn-cpp/transport/transport.hpp
index c791a87..2f71096 100644
--- a/ndn-cpp/transport/transport.hpp
+++ b/ndn-cpp/transport/transport.hpp
@@ -28,16 +28,19 @@
* @param connectionInfo A reference to an object of a subclass of ConnectionInfo.
* @param elementListener Not a shared_ptr because we assume that it will remain valid during the life of this object.
*/
- virtual void connect(const Transport::ConnectionInfo& connectionInfo, ElementListener& elementListener);
+ virtual void
+ connect(const Transport::ConnectionInfo& connectionInfo, ElementListener& elementListener);
/**
* Set data to the host
* @param data A pointer to the buffer of data to send.
* @param dataLength The number of bytes in data.
*/
- virtual void send(const unsigned char *data, unsigned int dataLength);
+ virtual void
+ send(const unsigned char *data, unsigned int dataLength);
- void send(const std::vector<unsigned char>& data)
+ void
+ send(const std::vector<unsigned char>& data)
{
send(&data[0], data.size());
}
@@ -49,14 +52,17 @@
* @throw This may throw an exception for reading data or in the callback for processing the data. If you
* call this from an main event loop, you may want to catch and log/disregard all exceptions.
*/
- virtual void processEvents() = 0;
+ virtual void
+ processEvents() = 0;
- virtual bool getIsConnected();
+ virtual bool
+ getIsConnected();
/**
* Close the connection. This base class implementation does nothing, but your derived class can override.
*/
- virtual void close();
+ virtual void
+ close();
virtual ~Transport();
};
diff --git a/ndn-cpp/transport/udp-transport.cpp b/ndn-cpp/transport/udp-transport.cpp
index 0cde016..d5e48cb 100644
--- a/ndn-cpp/transport/udp-transport.cpp
+++ b/ndn-cpp/transport/udp-transport.cpp
@@ -17,7 +17,8 @@
{
}
-void UdpTransport::connect(const Transport::ConnectionInfo& connectionInfo, ElementListener& elementListener)
+void
+UdpTransport::connect(const Transport::ConnectionInfo& connectionInfo, ElementListener& elementListener)
{
const UdpTransport::ConnectionInfo& udpConnectionInfo = dynamic_cast<const UdpTransport::ConnectionInfo&>(connectionInfo);
@@ -35,14 +36,16 @@
elementListener_ = &elementListener;
}
-void UdpTransport::send(const unsigned char *data, unsigned int dataLength)
+void
+UdpTransport::send(const unsigned char *data, unsigned int dataLength)
{
ndn_Error error;
if ((error = ndn_UdpTransport_send(&transport_, (unsigned char *)data, dataLength)))
throw std::runtime_error(ndn_getErrorString(error));
}
-void UdpTransport::processEvents()
+void
+UdpTransport::processEvents()
{
int receiveIsReady;
ndn_Error error;
@@ -59,12 +62,14 @@
ndn_BinaryXmlElementReader_onReceivedData(&elementReader_, buffer, nBytes);
}
-bool UdpTransport::getIsConnected()
+bool
+UdpTransport::getIsConnected()
{
return isConnected_;
}
-void UdpTransport::close()
+void
+UdpTransport::close()
{
ndn_Error error;
if ((error = ndn_UdpTransport_close(&transport_)))
diff --git a/ndn-cpp/transport/udp-transport.hpp b/ndn-cpp/transport/udp-transport.hpp
index deb7dc5..3ea1703 100644
--- a/ndn-cpp/transport/udp-transport.hpp
+++ b/ndn-cpp/transport/udp-transport.hpp
@@ -35,15 +35,18 @@
* Get the host given to the constructor.
* @return A string reference for the host.
*/
- const std::string& getHost() const { return host_; }
+ const std::string&
+ getHost() const { return host_; }
/**
* Get the port given to the constructor.
* @return The port number.
*/
- unsigned short getPort() const { return port_; }
+ unsigned short
+ getPort() const { return port_; }
- virtual ~ConnectionInfo();
+ virtual
+ ~ConnectionInfo();
private:
std::string host_;
@@ -62,14 +65,16 @@
* @param connectionInfo A reference to a TcpTransport::ConnectionInfo.
* @param elementListener Not a shared_ptr because we assume that it will remain valid during the life of this object.
*/
- virtual void connect(const Transport::ConnectionInfo& connectionInfo, ElementListener& elementListener);
+ virtual void
+ connect(const Transport::ConnectionInfo& connectionInfo, ElementListener& elementListener);
/**
* Set data to the host
* @param data A pointer to the buffer of data to send.
* @param dataLength The number of bytes in data.
*/
- virtual void send(const unsigned char *data, unsigned int dataLength);
+ virtual void
+ send(const unsigned char *data, unsigned int dataLength);
/**
* Process any data to receive. For each element received, call elementListener.onReceivedElement.
@@ -78,14 +83,17 @@
* @throw This may throw an exception for reading data or in the callback for processing the data. If you
* call this from an main event loop, you may want to catch and log/disregard all exceptions.
*/
- virtual void processEvents();
+ virtual void
+ processEvents();
- virtual bool getIsConnected();
+ virtual bool
+ getIsConnected();
/**
* Close the connection to the host.
*/
- virtual void close();
+ virtual void
+ close();
~UdpTransport();
diff --git a/ndn-cpp/util/blob.hpp b/ndn-cpp/util/blob.hpp
index 24de528..0572301 100644
--- a/ndn-cpp/util/blob.hpp
+++ b/ndn-cpp/util/blob.hpp
@@ -68,7 +68,8 @@
/**
* Return the length of the immutable byte array.
*/
- unsigned int size() const
+ unsigned int
+ size() const
{
if (*this)
return (*this)->size();
@@ -79,7 +80,8 @@
/**
* Return a const pointer to the first byte of the immutable byte array, or 0 if the pointer is null.
*/
- const unsigned char* buf() const
+ const unsigned char*
+ buf() const
{
if (*this)
return &(*this)->front();
diff --git a/ndn-cpp/util/changed-event.cpp b/ndn-cpp/util/changed-event.cpp
index 24a87bd..1d12c75 100644
--- a/ndn-cpp/util/changed-event.cpp
+++ b/ndn-cpp/util/changed-event.cpp
@@ -10,7 +10,8 @@
namespace ndn {
-void ChangedEvent::fire()
+void
+ChangedEvent::fire()
{
for (unsigned int i = 0; i < listeners_.size(); ++i)
listeners_[i]();
diff --git a/ndn-cpp/util/changed-event.hpp b/ndn-cpp/util/changed-event.hpp
index 3bac8b6..ce4b20f 100644
--- a/ndn-cpp/util/changed-event.hpp
+++ b/ndn-cpp/util/changed-event.hpp
@@ -23,7 +23,8 @@
* Add onChanged to the listener list. This does not check if a duplicate is already in the list.
* @param onChanged The OnChanged function object.
*/
- void add(OnChanged onChanged)
+ void
+ add(OnChanged onChanged)
{
listeners_.push_back(onChanged);
}
@@ -31,7 +32,8 @@
/**
* Call all the listeners.
*/
- void fire();
+ void
+ fire();
#if 0
private:
diff --git a/ndn-cpp/util/dynamic-uchar-vector.cpp b/ndn-cpp/util/dynamic-uchar-vector.cpp
index 454ce8c..4b17e63 100644
--- a/ndn-cpp/util/dynamic-uchar-vector.cpp
+++ b/ndn-cpp/util/dynamic-uchar-vector.cpp
@@ -16,7 +16,8 @@
ndn_DynamicUCharArray_initialize(this, &vector_->front(), initialLength, DynamicUCharVector::realloc);
}
-unsigned char *DynamicUCharVector::realloc(struct ndn_DynamicUCharArray *self, unsigned char *array, unsigned int length)
+unsigned char*
+DynamicUCharVector::realloc(struct ndn_DynamicUCharArray *self, unsigned char *array, unsigned int length)
{
// Because this method is private, assume there is not a problem with upcasting.
DynamicUCharVector *thisObject = (DynamicUCharVector *)self;
diff --git a/ndn-cpp/util/dynamic-uchar-vector.hpp b/ndn-cpp/util/dynamic-uchar-vector.hpp
index 7313cc9..68950a9 100644
--- a/ndn-cpp/util/dynamic-uchar-vector.hpp
+++ b/ndn-cpp/util/dynamic-uchar-vector.hpp
@@ -29,7 +29,8 @@
* Get the shared_ptr to the allocated vector.
* @return The shared_ptr to the allocated vector.
*/
- const ptr_lib::shared_ptr<std::vector<unsigned char> >& get() { return vector_; }
+ const ptr_lib::shared_ptr<std::vector<unsigned char> >&
+ get() { return vector_; }
private:
/**
@@ -39,7 +40,8 @@
* @param length The new length for the vector.
* @return The front of the allocated vector.
*/
- static unsigned char *realloc(struct ndn_DynamicUCharArray *self, unsigned char *array, unsigned int length);
+ static unsigned char*
+ realloc(struct ndn_DynamicUCharArray *self, unsigned char *array, unsigned int length);
ptr_lib::shared_ptr<std::vector<unsigned char> > vector_;
};
diff --git a/ndn-cpp/util/signed-blob.hpp b/ndn-cpp/util/signed-blob.hpp
index 25966b6..0b6cdda 100644
--- a/ndn-cpp/util/signed-blob.hpp
+++ b/ndn-cpp/util/signed-blob.hpp
@@ -76,7 +76,8 @@
/**
* Return the length of the signed portion of the immutable byte array, or 0 of the pointer to the array is null.
*/
- unsigned int signedSize() const
+ unsigned int
+ signedSize() const
{
if (*this)
return signedPortionEndOffset_ - signedPortionBeginOffset_;
@@ -88,7 +89,8 @@
* Return a const pointer to the first byte of the signed portion of the immutable byte array, or 0 if the
* pointer to the array is null.
*/
- const unsigned char* signedBuf() const
+ const unsigned char*
+ signedBuf() const
{
if (*this)
return &(*this)->front() + signedPortionBeginOffset_;
@@ -99,12 +101,14 @@
/**
* Return the offset in the array of the beginning of the signed portion.
*/
- unsigned int getSignedPortionBeginOffset() { return signedPortionBeginOffset_; }
+ unsigned int
+ getSignedPortionBeginOffset() { return signedPortionBeginOffset_; }
/**
* Return the offset in the array of the end of the signed portion.
*/
- unsigned int getSignedPortionEndOffset() { return signedPortionEndOffset_; }
+ unsigned int
+ getSignedPortionEndOffset() { return signedPortionEndOffset_; }
private:
unsigned int signedPortionBeginOffset_;