Remove other general deprecations

This commit is contained in:
Tim Wojtulewicz 2022-06-16 12:29:42 -07:00
parent 6130d32440
commit fb16ce3711
16 changed files with 5 additions and 278 deletions

View file

@ -36,8 +36,6 @@ function archiver_rotation_format_func(ri: Log::RotationFmtInfo): Log::RotationP
@if ( Supervisor::is_supervised() )
global supervisor_rotation_format_func = archiver_rotation_format_func &deprecated="Remove in v5.1. Use 'archiver_rotation_format_func'.";
redef Log::default_rotation_dir = "log-queue";
redef Log::rotation_format_func = archiver_rotation_format_func;

View file

@ -71,8 +71,6 @@ struct ConnTuple
TransportProto proto;
};
using ConnID [[deprecated("Remove in v5.1. Use zeek::ConnTuple.")]] = ConnTuple;
static inline int addr_port_canon_lt(const IPAddr& addr1, uint32_t p1, const IPAddr& addr2,
uint32_t p2)
{

View file

@ -54,8 +54,6 @@ private:
TransportProto t, bool one_way);
};
using ConnIDKey [[deprecated("Remove in v5.1. Use zeek::detail::ConnKey.")]] = ConnKey;
} // namespace detail
/**

View file

@ -1,202 +0,0 @@
// See the file "COPYING" in the main distribution directory for copyright.
#pragma once
#include <cstring>
#include <iterator>
// Queue.h --
// Interface for class Queue, current implementation is as an
// array of ent's. This implementation was chosen to optimize
// getting to the ent's rather than inserting and deleting.
// Also push's and pop's from the front or the end of the queue
// are very efficient. The only really expensive operation
// is resizing the list, which involves getting new space
// and moving the data. Resizing occurs automatically when inserting
// more elements than the list can currently hold. Automatic
// resizing is done one "chunk_size" of elements at a time and
// always increases the size of the list. Resizing to zero
// (or to less than the current value of num_entries)
// will decrease the size of the list to the current number of
// elements. Resize returns the new max_entries.
//
// Entries must be either a pointer to the data or nonzero data with
// sizeof(data) <= sizeof(void*).
namespace zeek
{
template <typename T>
class [[deprecated("Remove in v5.1. This class is deprecated (and is likely broken, see #1528). "
"Use std::vector<T>.")]] Queue
{
public:
explicit Queue(int size = 0)
{
constexpr int DEFAULT_CHUNK_SIZE = 10;
chunk_size = DEFAULT_CHUNK_SIZE;
head = tail = num_entries = 0;
if ( size < 0 )
{
entries = new T[1];
max_entries = 0;
}
else
{
if ( (entries = new T[chunk_size + 1]) )
max_entries = chunk_size;
else
{
entries = new T[1];
max_entries = 0;
}
}
}
~Queue() { delete[] entries; }
int length() const { return num_entries; }
int capacity() const { return max_entries; }
int resize(int new_size = 0) // 0 => size to fit current number of entries
{
if ( new_size < num_entries )
new_size = num_entries; // do not lose any entries
if ( new_size != max_entries )
{
// Note, allocate extra space, so that we can always
// use the [max_entries] element.
// ### Yin, why not use realloc()?
T* new_entries = new T[new_size + 1];
if ( new_entries )
{
if ( head <= tail )
memcpy(new_entries, entries + head, sizeof(T) * num_entries);
else
{
int len = num_entries - tail;
memcpy(new_entries, entries + head, sizeof(T) * len);
memcpy(new_entries + len, entries, sizeof(T) * tail);
}
delete[] entries;
entries = new_entries;
max_entries = new_size;
head = 0;
tail = num_entries;
}
else
{ // out of memory
}
}
return max_entries;
}
// remove all entries without delete[] entry
void clear() { head = tail = num_entries = 0; }
// helper functions for iterating over queue
T& front() { return entries[head]; }
T& back() { return entries[tail]; }
const T& front() const { return entries[head]; }
const T& back() const { return entries[tail]; }
void push_front(const T& a) // add in front of queue
{
if ( num_entries == max_entries )
{
resize(max_entries + chunk_size); // make more room
chunk_size *= 2;
}
++num_entries;
if ( head )
entries[--head] = a;
else
{
head = max_entries;
entries[head] = a;
}
}
void push_back(const T& a) // add at end of queue
{
if ( num_entries == max_entries )
{
resize(max_entries + chunk_size); // make more room
chunk_size *= 2;
}
++num_entries;
if ( tail < max_entries )
entries[tail++] = a;
else
{
entries[tail] = a;
tail = 0;
}
}
void pop_front()
{
--num_entries;
if ( head < max_entries )
head++;
else
head = 0;
}
void pop_back()
{
--num_entries;
if ( tail )
--tail;
else
tail = max_entries;
}
// return nth *PHYSICAL* entry of queue (do not remove)
T& operator[](int i) const { return entries[i]; }
// Type traits needed for some of the std algorithms to work
using value_type = T;
using pointer = T*;
using const_pointer = const T*;
// Iterator support
using iterator = pointer;
using const_iterator = const_pointer;
using reverse_iterator = std::reverse_iterator<iterator>;
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
iterator begin() { return entries; }
iterator end() { return entries + num_entries; }
const_iterator begin() const { return entries; }
const_iterator end() const { return entries + num_entries; }
const_iterator cbegin() const { return entries; }
const_iterator cend() const { return entries + num_entries; }
reverse_iterator rbegin() { return reverse_iterator{end()}; }
reverse_iterator rend() { return reverse_iterator{begin()}; }
const_reverse_iterator rbegin() const { return const_reverse_iterator{end()}; }
const_reverse_iterator rend() const { return const_reverse_iterator{begin()}; }
const_reverse_iterator crbegin() const { return rbegin(); }
const_reverse_iterator crend() const { return rend(); }
protected:
T* entries;
int chunk_size; // increase size by this amount when necessary
int max_entries; // entry's index range: 0 .. max_entries
int num_entries;
int head; // beginning of the queue in the ring
int tail; // just beyond the end of the queue in the ring
};
template <typename T>
using PQueue [[deprecated("Remove in v5.1. This class is deprecated (and is likely broken, see "
"#1528). Use std::vector<T*>.")]] = Queue<T*>;
} // namespace zeek

View file

@ -227,10 +227,7 @@ void dispatch_packet(Packet* pkt, iosource::PktSrc* pkt_src)
}
current_iosrc = pkt_src;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
current_pktsrc = pkt_src;
#pragma GCC diagnostic pop
// network_time never goes back.
update_network_time(zeek::detail::timer_mgr->Time() < t ? t : zeek::detail::timer_mgr->Time());
@ -273,10 +270,7 @@ void dispatch_packet(Packet* pkt, iosource::PktSrc* pkt_src)
first_wallclock = util::current_time(true);
current_iosrc = nullptr;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
current_pktsrc = nullptr;
#pragma GCC diagnostic pop
}
void run_loop()

View file

@ -1,2 +0,0 @@
#warning "This file is deprecated and will be removed in v5.1. Use session/Manager.h instead."
#include "zeek/session/Manager.h"

View file

@ -89,19 +89,6 @@ public:
bool Cache(const void* obj, Val* val);
Val* Lookup(const void* obj);
[[deprecated(
"Remove in v5.1. Use Frame::GetTriggerAssoc() / const void* interface instead.")]] bool
Cache(const CallExpr* call, Val* val)
{
return Cache((const void*)call, val);
}
[[deprecated(
"Remove in v5.1. Use Frame::GetTriggerAssoc() / const void* interface instead.")]] Val*
Lookup(const CallExpr* call)
{
return Lookup((const void*)call);
}
// Disable this trigger completely. Needed because Unref'ing the trigger
// may not immediately delete it as other references may still exist.
void Disable();

View file

@ -3629,26 +3629,14 @@ void VectorVal::ValDescribe(ODesc* d) const
d->Add("]");
}
ValPtr check_and_promote(ValPtr v, const TypePtr& t, bool is_init,
ValPtr check_and_promote(ValPtr v, const TypePtr& new_type, bool is_init,
const detail::Location* expr_location)
{
// Once 5.0 comes out, this function can merge with the deprecated one below it, and this
// pragma block can go away.
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
return check_and_promote(v, t.get(), is_init, expr_location);
#pragma GCC diagnostic pop
}
[[deprecated("Remove in v5.1. Use version that takes TypePtr instead.")]] ValPtr
check_and_promote(ValPtr v, const Type* t, bool is_init, const detail::Location* expr_location)
{
if ( ! v )
return nullptr;
Type* vt = flatten_type(v->GetType().get());
t = flatten_type(t);
Type* t = flatten_type(new_type.get());
TypeTag t_tag = t->Tag();
TypeTag v_tag = vt->Tag();

View file

@ -1706,11 +1706,8 @@ UNDERLYING_ACCESSOR_DEF(TypeVal, zeek::Type*, AsType)
// exact match, returns it. If promotable, returns the promoted version.
// If not a match, generates an error message and return nil. If is_init is
// true, then the checking is done in the context of an initialization.
extern ValPtr check_and_promote(ValPtr v, const TypePtr& t, bool is_init,
extern ValPtr check_and_promote(ValPtr v, const TypePtr& new_type, bool is_init,
const detail::Location* expr_location = nullptr);
[[deprecated("Remove in v5.1. Use version that takes TypePtr instead.")]] extern ValPtr
check_and_promote(ValPtr v, const Type* t, bool is_init,
const detail::Location* expr_location = nullptr);
extern bool same_val(const Val* v1, const Val* v2);
extern bool same_atomic_val(const Val* v1, const Val* v2);

View file

@ -25,7 +25,6 @@
#include "zeek/telemetry/Manager.h"
zeek::session::Manager* zeek::session_mgr = nullptr;
zeek::session::Manager*& zeek::sessions = zeek::session_mgr;
namespace zeek::session
{
@ -287,9 +286,4 @@ void Manager::InsertSession(detail::Key key, Session* session)
}
}
zeek::detail::PacketFilter* Manager::GetPacketFilter(bool init)
{
return packet_mgr->GetPacketFilter(init);
}
} // namespace zeek::session

View file

@ -89,9 +89,6 @@ public:
void Weird(const char* name, const Packet* pkt, const char* addl = "", const char* source = "");
void Weird(const char* name, const IP_Hdr* ip, const char* addl = "");
[[deprecated("Remove in v5.1. Use packet_mgr->GetPacketFilter().")]] zeek::detail::PacketFilter*
GetPacketFilter(bool init = true);
unsigned int CurrentSessions() { return session_map.size(); }
private:
@ -113,8 +110,4 @@ private:
// Manager for the currently active sessions.
extern session::Manager* session_mgr;
extern session::Manager*& sessions
[[deprecated("Remove in v5.1. Use zeek::sessions::session_mgr.")]];
using NetSessions [[deprecated("Remove in v5.1. Use zeek::session::Manager.")]] = session::Manager;
} // namespace zeek

View file

@ -2523,11 +2523,6 @@ void zeek_strerror_r(int zeek_errno, char* buf, size_t buflen)
strerror_r_helper(res, buf, buflen);
}
char* zeekenv(const char* name)
{
return getenv(name);
}
static string json_escape_byte(char c)
{
char hex[2] = {'0', '0'};

View file

@ -547,12 +547,6 @@ std::string canonify_name(const std::string& name);
*/
void zeek_strerror_r(int zeek_errno, char* buf, size_t buflen);
/**
* A wrapper function for getenv(). Helps check for existence of
* legacy environment variable names that map to the latest \a name.
*/
[[deprecated("Remove in v5.1. Use getenv() directly.")]] char* zeekenv(const char* name);
/**
* Escapes bytes in a string that are not valid UTF8 characters with \xYY format. Used
* by the JSON writer and BIF methods.

View file

@ -16,7 +16,7 @@ bool LLCDemo::AnalyzePacket(size_t len, const uint8_t* data, Packet* packet)
// Rudimentary parsing of 802.2 LLC
if ( 17 >= len )
{
sessions->Weird("truncated_llc_header", packet);
session_mgr->Weird("truncated_llc_header", packet);
return false;
}

View file

@ -17,7 +17,7 @@ bool RawLayer::AnalyzePacket(size_t len, const uint8_t* data, Packet* packet)
constexpr auto layer_size = 21;
if ( layer_size >= len )
{
sessions->Weird("truncated_raw_layer", packet);
session_mgr->Weird("truncated_raw_layer", packet);
return false;
}

View file

@ -4,7 +4,6 @@ binpac_root=@ZEEK_CONFIG_BINPAC_ROOT_DIR@
broker_root=@ZEEK_CONFIG_BROKER_ROOT_DIR@
btest_tools_dir=@ZEEK_CONFIG_BTEST_TOOLS_DIR@
build_type=@CMAKE_BUILD_TYPE_LOWER@
caf_root=@ZEEK_CONFIG_CAF_ROOT_DIR@
cmake_dir=@CMAKE_INSTALL_PREFIX@/share/zeek/cmake
config_dir=@ZEEK_ETC_INSTALL_DIR@
include_dir=@CMAKE_INSTALL_PREFIX@/include
@ -65,7 +64,6 @@ Toplevel installation directories for third-party components:
--binpac_root BinPAC compiler
--broker_root Broker communication framework
--caf_root C++ Actor Framework (deprecated, will be removed in 5.1)
"
}
@ -99,9 +97,6 @@ while [ $# -ne 0 ]; do
--build_type)
echo $build_type
;;
--caf_root)
echo "The caf_root option is deprecated and will be removed in 5.1. The Broker API has been updated to no longer require access to CAF to build against Broker."
;;
--cmake_dir)
echo $cmake_dir
;;