aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2018-07-06 18:46:59 -0400
committerDeterminant <[email protected]>2018-07-06 18:46:59 -0400
commitf3976e3c06ef57671e823953a8cc27c30547da6d (patch)
treeaa9c8a1f9a52ccebb22ab89d8610273dd5a53e61 /include
parentfb6c58e08102200b9f23e7b940130defed4ce5ea (diff)
...
Diffstat (limited to 'include')
-rw-r--r--include/salticidae/netaddr.h6
-rw-r--r--include/salticidae/stream.h10
2 files changed, 13 insertions, 3 deletions
diff --git a/include/salticidae/netaddr.h b/include/salticidae/netaddr.h
index 1b53dff..eabb5da 100644
--- a/include/salticidae/netaddr.h
+++ b/include/salticidae/netaddr.h
@@ -84,7 +84,11 @@ struct NetAddr {
bool operator==(const NetAddr &other) const {
return ip == other.ip && port == other.port;
}
-
+
+ bool operator!=(const NetAddr &other) const {
+ return ip != other.ip || port != other.port;
+ }
+
operator std::string() const {
struct in_addr in;
in.s_addr = ip;
diff --git a/include/salticidae/stream.h b/include/salticidae/stream.h
index a5bc74c..fdbf967 100644
--- a/include/salticidae/stream.h
+++ b/include/salticidae/stream.h
@@ -170,7 +170,7 @@ class DataStream {
return bytearray_t(buffer.begin() + offset, buffer.end());
}
- operator bytearray_t () const && {
+ operator bytearray_t () && {
return std::move(buffer);
}
@@ -223,7 +223,7 @@ class Blob {
}
bool operator!=(const Blob<N> &other) const {
- return !(data == other);
+ return !(*this == other);
}
size_t cheap_hash() const { return *data; }
@@ -250,6 +250,12 @@ class Blob {
}
loaded = true;
}
+
+ operator bytearray_t () const & {
+ DataStream s;
+ s << *this;
+ return std::move(s);
+ }
};
const size_t ENT_HASH_LENGTH = 256 / 8;