mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Clean up initialization of TunnelEncapsulation to use default member values
This commit is contained in:
parent
9091fe5c99
commit
739efc79be
1 changed files with 7 additions and 15 deletions
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "zeek/zeek-config.h"
|
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "zeek/ID.h"
|
#include "zeek/ID.h"
|
||||||
|
@ -28,7 +26,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Default tunnel connection constructor.
|
* Default tunnel connection constructor.
|
||||||
*/
|
*/
|
||||||
EncapsulatingConn() : src_port(0), dst_port(0), proto(TRANSPORT_UNKNOWN), type(BifEnum::Tunnel::NONE), uid() {}
|
EncapsulatingConn() = default;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct an IP tunnel "connection" with its own UID.
|
* Construct an IP tunnel "connection" with its own UID.
|
||||||
|
@ -42,13 +40,7 @@ public:
|
||||||
*/
|
*/
|
||||||
EncapsulatingConn(const IPAddr& s, const IPAddr& d, BifEnum::Tunnel::Type t = BifEnum::Tunnel::IP,
|
EncapsulatingConn(const IPAddr& s, const IPAddr& d, BifEnum::Tunnel::Type t = BifEnum::Tunnel::IP,
|
||||||
uint16_t ip_proto = UNKNOWN_IP_PROTO)
|
uint16_t ip_proto = UNKNOWN_IP_PROTO)
|
||||||
: src_addr(s),
|
: src_addr(s), dst_addr(d), ip_proto(ip_proto), type(t), uid(UID(detail::bits_per_uid)) {
|
||||||
dst_addr(d),
|
|
||||||
src_port(0),
|
|
||||||
dst_port(0),
|
|
||||||
ip_proto(ip_proto),
|
|
||||||
type(t),
|
|
||||||
uid(UID(detail::bits_per_uid)) {
|
|
||||||
switch ( ip_proto ) {
|
switch ( ip_proto ) {
|
||||||
case IPPROTO_ICMP: proto = TRANSPORT_ICMP; break;
|
case IPPROTO_ICMP: proto = TRANSPORT_ICMP; break;
|
||||||
case IPPROTO_UDP: proto = TRANSPORT_UDP; break;
|
case IPPROTO_UDP: proto = TRANSPORT_UDP; break;
|
||||||
|
@ -141,11 +133,11 @@ public:
|
||||||
protected:
|
protected:
|
||||||
IPAddr src_addr;
|
IPAddr src_addr;
|
||||||
IPAddr dst_addr;
|
IPAddr dst_addr;
|
||||||
uint16_t src_port;
|
uint16_t src_port = 0;
|
||||||
uint16_t dst_port;
|
uint16_t dst_port = 0;
|
||||||
TransportProto proto;
|
TransportProto proto = TRANSPORT_UNKNOWN;
|
||||||
uint16_t ip_proto;
|
uint16_t ip_proto = UNKNOWN_IP_PROTO;
|
||||||
BifEnum::Tunnel::Type type;
|
BifEnum::Tunnel::Type type = BifEnum::Tunnel::NONE;
|
||||||
UID uid;
|
UID uid;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue