diff options
author | Mauro Sardara <msardara+fdio@cisco.com> | 2017-04-18 11:25:13 +0200 |
---|---|---|
committer | Mauro Sardara <msardara+fdio@cisco.com> | 2017-04-18 09:31:56 +0000 |
commit | 7e312299ab4a84334af19e4988e9c5365626b80b (patch) | |
tree | d223f035dbcfb734dd6384c18c83fa6421a3aa1b | |
parent | 526f25cf2a8777e4cf88732b87076bf9457ae8df (diff) |
- Fixing code style issues
- Adding new feature to producer test: now it is possible to specify the size of the file to download
- Fixing initialization of max number of retransmissions in icnet_socket_consumer.cc
Change-Id: Ia7e48a4beda6adebf5179700c80f6d7316922187
Signed-off-by: Mauro Sardara <msardara+fdio@cisco.com>
-rwxr-xr-x | apps/producers/icnet_producer_test.cc | 25 | ||||
-rw-r--r-- | icnet/ccnx/icnet_ccnx_content_object.cc | 11 | ||||
-rw-r--r-- | icnet/ccnx/icnet_ccnx_interest.cc | 9 | ||||
-rw-r--r-- | icnet/ccnx/icnet_ccnx_key_locator.cc | 6 | ||||
-rw-r--r-- | icnet/ccnx/icnet_ccnx_local_connector.cc | 5 | ||||
-rw-r--r-- | icnet/ccnx/icnet_ccnx_manifest.cc | 3 | ||||
-rw-r--r-- | icnet/ccnx/icnet_ccnx_name.cc | 15 | ||||
-rw-r--r-- | icnet/ccnx/icnet_ccnx_network_message.cc | 3 | ||||
-rw-r--r-- | icnet/ccnx/icnet_ccnx_segment.cc | 13 | ||||
-rw-r--r-- | icnet/transport/icnet_content_store.cc | 3 | ||||
-rw-r--r-- | icnet/transport/icnet_socket_consumer.cc | 1 | ||||
-rw-r--r-- | icnet/transport/icnet_transport.cc | 3 | ||||
-rw-r--r-- | icnet/transport/icnet_transport_vegas_rto_estimator.cc | 9 |
13 files changed, 65 insertions, 41 deletions
diff --git a/apps/producers/icnet_producer_test.cc b/apps/producers/icnet_producer_test.cc index 571e9615..6add25d3 100755 --- a/apps/producers/icnet_producer_test.cc +++ b/apps/producers/icnet_producer_test.cc @@ -15,14 +15,18 @@ #include "icnet_socket_producer.h" -#define IDENTITY_NAME "ciao" +#define IDENTITY_NAME "cisco" namespace icnet { class CallbackContainer { public: - CallbackContainer() : buffer_(1400, 'X') { + CallbackContainer(unsigned long download_size = 0) + : buffer_(1400, 'X'), final_chunk_number_(0) { content_object_.setContent((uint8_t *) buffer_.c_str(), 1400); + if (download_size > 0) { + final_chunk_number_ = static_cast<uint64_t>(std::ceil(download_size / 1400)); + } } void processInterest(ProducerSocket &p, const Interest &interest) { @@ -31,17 +35,21 @@ class CallbackContainer { void processIncomingInterest(ProducerSocket &p, const Interest &interest) { content_object_.setName(Name(interest.getName().getWrappedStructure())); + if (final_chunk_number_ > 0) { + content_object_.setFinalChunkNumber(final_chunk_number_); + } p.produce(content_object_); } private: - ContentObject content_object_; std::string buffer_; + uint64_t final_chunk_number_; }; class Signer { public: - Signer() : counter_(0), identity_name_(IDENTITY_NAME) { + Signer() + : counter_(0), identity_name_(IDENTITY_NAME) { }; ~Signer() { @@ -102,15 +110,19 @@ void becomeDaemon() { int main(int argc, char **argv) { std::string name = "ccnx:/ccnxtest"; + unsigned long download_size = 0; bool daemon = false; int opt; - while ((opt = getopt(argc, argv, "D")) != -1) { + while ((opt = getopt(argc, argv, "Ds:")) != -1) { switch (opt) { case 'D': daemon = true; break; + case 's': + download_size = std::stoul(optarg); + break; default: exit(EXIT_FAILURE); } @@ -126,7 +138,8 @@ int main(int argc, char **argv) { becomeDaemon(); } - CallbackContainer stubs; + CallbackContainer stubs(download_size); + // Signer signer; std::cout << "Setting name.. " << name << std::endl; diff --git a/icnet/ccnx/icnet_ccnx_content_object.cc b/icnet/ccnx/icnet_ccnx_content_object.cc index 1a7fa3c6..03875724 100644 --- a/icnet/ccnx/icnet_ccnx_content_object.cc +++ b/icnet/ccnx/icnet_ccnx_content_object.cc @@ -37,13 +37,10 @@ ContentObject::ContentObject(const Name &name, uint8_t *payload, std::size_t siz parcBuffer_Release(&buffer); } -ContentObject::ContentObject(const CCNxContentObjectStructure *content_object) : name_(ccnxContentObject_GetName( - content_object)), - ccnx_content_object_( - ccnxContentObject_Acquire( - content_object)), - content_type_((PayloadType) ccnxContentObject_GetPayloadType( - content_object)) { +ContentObject::ContentObject(const CCNxContentObjectStructure *content_object) + : name_(ccnxContentObject_GetName(content_object)), + ccnx_content_object_(ccnxContentObject_Acquire(content_object)), + content_type_((PayloadType) ccnxContentObject_GetPayloadType(content_object)) { } ContentObject::ContentObject(const Name &name) diff --git a/icnet/ccnx/icnet_ccnx_interest.cc b/icnet/ccnx/icnet_ccnx_interest.cc index a2bcf72e..6b0f92cb 100644 --- a/icnet/ccnx/icnet_ccnx_interest.cc +++ b/icnet/ccnx/icnet_ccnx_interest.cc @@ -31,9 +31,8 @@ Interest::Interest(CCNxInterestStruct *interest) : name_(ccnxInterest_GetName(interest)), interest_(ccnxInterest_Acquire(interest)) { } -Interest::Interest(const Interest &other_interest) : name_(other_interest.name_), - interest_(ccnxInterest_CreateSimple(other_interest.name_ - .getWrappedStructure())) { +Interest::Interest(const Interest &other_interest) + : name_(other_interest.name_), interest_(ccnxInterest_CreateSimple(other_interest.name_.getWrappedStructure())) { PARCBuffer *buffer = nullptr; // Key Id restriction @@ -58,8 +57,8 @@ Interest::Interest(const Interest &other_interest) : name_(other_interest.name_) ccnxInterest_SetLifetime(interest_, ccnxInterest_GetLifetime(other_interest.interest_)); } -Interest::Interest(Interest &&other_interest) : name_(std::move(other_interest.name_)), - interest_(ccnxInterest_Acquire(other_interest.interest_)) { +Interest::Interest(Interest &&other_interest) + : name_(std::move(other_interest.name_)), interest_(ccnxInterest_Acquire(other_interest.interest_)) { } Interest &Interest::operator=(const Interest &other_interest) { diff --git a/icnet/ccnx/icnet_ccnx_key_locator.cc b/icnet/ccnx/icnet_ccnx_key_locator.cc index 193573a9..ad099bc8 100644 --- a/icnet/ccnx/icnet_ccnx_key_locator.cc +++ b/icnet/ccnx/icnet_ccnx_key_locator.cc @@ -8,10 +8,12 @@ namespace icnet { namespace ccnx { -KeyLocator::KeyLocator() : type_(KeyLocatorType::UNKNOWN) { +KeyLocator::KeyLocator() + : type_(KeyLocatorType::UNKNOWN) { } -KeyLocator::KeyLocator(KeyLocatorType type, Name &name) : type_(type), name_(name) { +KeyLocator::KeyLocator(KeyLocatorType type, Name &name) + : type_(type), name_(name) { } Name &KeyLocator::getName() { diff --git a/icnet/ccnx/icnet_ccnx_local_connector.cc b/icnet/ccnx/icnet_ccnx_local_connector.cc index efe995cc..cd828b08 100644 --- a/icnet/ccnx/icnet_ccnx_local_connector.cc +++ b/icnet/ccnx/icnet_ccnx_local_connector.cc @@ -19,7 +19,6 @@ #include "icnet_ccnx_local_connector.h" - namespace icnet { namespace ccnx { @@ -168,9 +167,9 @@ void LocalConnector::doConnect() { if (is_reconnection_) { is_reconnection_ = false; #ifdef __ANDROID__ - __android_log_print(ANDROID_LOG_DEBUG, "libICNet", "Connection recovered!\n"); + __android_log_print(ANDROID_LOG_DEBUG, "libICNet", "Connection recovered!\n"); #else - std::cout << "Connection recovered!" << std::endl; + std::cout << "Connection recovered!" << std::endl; #endif for (auto &name : served_name_list_) { bind(name); diff --git a/icnet/ccnx/icnet_ccnx_manifest.cc b/icnet/ccnx/icnet_ccnx_manifest.cc index c818f110..b743291b 100644 --- a/icnet/ccnx/icnet_ccnx_manifest.cc +++ b/icnet/ccnx/icnet_ccnx_manifest.cc @@ -20,7 +20,8 @@ namespace icnet { namespace ccnx { -Manifest::Manifest(Name &name) : ContentObject(name) { +Manifest::Manifest(Name &name) + : ContentObject(name) { } std::size_t Manifest::estimateManifestSize() { diff --git a/icnet/ccnx/icnet_ccnx_name.cc b/icnet/ccnx/icnet_ccnx_name.cc index 2ea0d8ab..bb329c83 100644 --- a/icnet/ccnx/icnet_ccnx_name.cc +++ b/icnet/ccnx/icnet_ccnx_name.cc @@ -23,21 +23,26 @@ Name::Name() { name_ = ccnxName_Create(); } -Name::Name(const char *uri) : name_(ccnxName_CreateFromCString(uri)) { +Name::Name(const char *uri) + : name_(ccnxName_CreateFromCString(uri)) { ccnxName_AssertValid(name_); } -Name::Name(std::string uri) : Name(uri.c_str()) { +Name::Name(std::string uri) + : Name(uri.c_str()) { } -Name::Name(const CCNxNameStructure *name) : name_(ccnxName_Acquire(name)) { +Name::Name(const CCNxNameStructure *name) + : name_(ccnxName_Acquire(name)) { ccnxName_AssertValid(name_); } -Name::Name(const Name &name) : name_(ccnxName_Copy(name.name_)) { +Name::Name(const Name &name) + : name_(ccnxName_Copy(name.name_)) { } -Name::Name(Name &&otherName) : name_(ccnxName_Acquire(otherName.name_)) { +Name::Name(Name &&otherName) + : name_(ccnxName_Acquire(otherName.name_)) { } Name &Name::operator=(const Name &name) { diff --git a/icnet/ccnx/icnet_ccnx_network_message.cc b/icnet/ccnx/icnet_ccnx_network_message.cc index 70dff5f7..28ab0c24 100644 --- a/icnet/ccnx/icnet_ccnx_network_message.cc +++ b/icnet/ccnx/icnet_ccnx_network_message.cc @@ -19,7 +19,8 @@ namespace icnet { namespace ccnx { -TransportMessage::TransportMessage() : packet_length_(0) { +TransportMessage::TransportMessage() + : packet_length_(0) { } const uint8_t *TransportMessage::data() const { diff --git a/icnet/ccnx/icnet_ccnx_segment.cc b/icnet/ccnx/icnet_ccnx_segment.cc index 4215650a..e487d41d 100644 --- a/icnet/ccnx/icnet_ccnx_segment.cc +++ b/icnet/ccnx/icnet_ccnx_segment.cc @@ -19,17 +19,20 @@ namespace icnet { namespace ccnx { -Segment::Segment(CCNxNameLabelType type, std::string &segment_value) : name_segment_( - ccnxNameSegment_CreateTypeValueArray(type, segment_value.length(), segment_value.c_str())) { +Segment::Segment(CCNxNameLabelType type, std::string &segment_value) + : name_segment_(ccnxNameSegment_CreateTypeValueArray(type, segment_value.length(), segment_value.c_str())) { } -Segment::Segment(CCNxNameSegmentStructure *segment) : name_segment_(ccnxNameSegment_Acquire(segment)) { +Segment::Segment(CCNxNameSegmentStructure *segment) + : name_segment_(ccnxNameSegment_Acquire(segment)) { } -Segment::Segment(const Segment &segment) : name_segment_(ccnxNameSegment_Copy(segment.name_segment_)) { +Segment::Segment(const Segment &segment) + : name_segment_(ccnxNameSegment_Copy(segment.name_segment_)) { } -Segment::Segment(Segment &&otherSegment) : name_segment_(ccnxNameSegment_Acquire(otherSegment.name_segment_)) { +Segment::Segment(Segment &&otherSegment) + : name_segment_(ccnxNameSegment_Acquire(otherSegment.name_segment_)) { } Segment::~Segment() { diff --git a/icnet/transport/icnet_content_store.cc b/icnet/transport/icnet_content_store.cc index 884ad2e7..64694b20 100644 --- a/icnet/transport/icnet_content_store.cc +++ b/icnet/transport/icnet_content_store.cc @@ -17,7 +17,8 @@ namespace icnet { -ContentStore::ContentStore(std::size_t max_packets) : max_content_store_size_(max_packets) { +ContentStore::ContentStore(std::size_t max_packets) + : max_content_store_size_(max_packets) { } ContentStore::~ContentStore() { diff --git a/icnet/transport/icnet_socket_consumer.cc b/icnet/transport/icnet_socket_consumer.cc index b6c928c6..2aec571b 100644 --- a/icnet/transport/icnet_socket_consumer.cc +++ b/icnet/transport/icnet_socket_consumer.cc @@ -24,6 +24,7 @@ ConsumerSocket::ConsumerSocket(Name prefix, int protocol) min_window_size_(default_values::min_window_size), max_window_size_(default_values::max_window_size), current_window_size_(-1), + max_retransmissions_(default_values::transport_protocol_max_retransmissions), /****** RAAQM Parameters ******/ minimum_drop_probability_(default_values::minimum_drop_probability), sample_number_(default_values::sample_number), diff --git a/icnet/transport/icnet_transport.cc b/icnet/transport/icnet_transport.cc index c85f02b4..632d03c4 100644 --- a/icnet/transport/icnet_transport.cc +++ b/icnet/transport/icnet_transport.cc @@ -17,7 +17,8 @@ namespace icnet { -TransportProtocol::TransportProtocol(Socket *icn_socket) : socket_(icn_socket), is_running_(false) { +TransportProtocol::TransportProtocol(Socket *icn_socket) + : socket_(icn_socket), is_running_(false) { } void TransportProtocol::updatePortal() { diff --git a/icnet/transport/icnet_transport_vegas_rto_estimator.cc b/icnet/transport/icnet_transport_vegas_rto_estimator.cc index 889a6bd3..6653518e 100644 --- a/icnet/transport/icnet_transport_vegas_rto_estimator.cc +++ b/icnet/transport/icnet_transport_vegas_rto_estimator.cc @@ -18,10 +18,11 @@ namespace icnet { -RtoEstimator::RtoEstimator(Duration min_rto) : smoothed_rtt_(RtoEstimator::getInitialRtt().count()), - rtt_variation_(0), - first_measurement_(true), - last_rto_(min_rto.count()) { +RtoEstimator::RtoEstimator(Duration min_rto) + : smoothed_rtt_(RtoEstimator::getInitialRtt().count()), + rtt_variation_(0), + first_measurement_(true), + last_rto_(min_rto.count()) { } void RtoEstimator::addMeasurement(Duration rtt) { |