Merge remote-tracking branch 'origin/master' into topic/johanna/remove-serializer

# Conflicts:
#	src/File.cc
#	src/File.h
#	src/StateAccess.h
#	src/bro.bif
This commit is contained in:
Johanna Amann 2019-05-22 15:16:31 -07:00
commit 7ae5c7d1b4
68 changed files with 394 additions and 747 deletions

View file

@ -12,13 +12,7 @@
# include <krb5.h>
# endif // NEED_KRB5_H
// From OpenSSL. We forward-declare these here to avoid introducing a
// dependency on OpenSSL headers just for this header file.
typedef struct evp_pkey_st EVP_PKEY;
typedef struct evp_cipher_ctx_st EVP_CIPHER_CTX;
class BroType;
class RotateTimer;
class BroFile : public BroObj {
public:
@ -51,21 +45,14 @@ public:
void Describe(ODesc* d) const override;
void SetRotateInterval(double secs);
// Rotates the logfile. Returns rotate_info.
RecordVal* Rotate();
// Set &rotate_interval, &rotate_size,
// and &raw_output attributes.
// Set &raw_output attribute.
void SetAttrs(Attributes* attrs);
// Returns the current size of the file, after fresh stat'ing.
double Size() { fflush(f); UpdateFileSize(); return current_size; }
// Set rotate/postprocessor for all files that don't define them
// by their own. (interval/max_size=0 for no rotation; size in bytes).
static void SetDefaultRotation(double interval, double max_size);
double Size();
// Close all files which are managed by us.
static void CloseCachedFiles();
@ -80,8 +67,6 @@ public:
bool IsRawOutput() const { return raw_output; }
protected:
friend class RotateTimer;
BroFile() { Init(); }
void Init();
@ -102,7 +87,6 @@ protected:
void Unlink();
void InsertAtBeginning();
void MoveToBeginning();
void InstallRotateTimer();
// Returns nil if the file is not active, was in error, etc.
// (Protected because we do not want anyone to write directly
@ -110,17 +94,9 @@ protected:
FILE* File();
FILE* BringIntoCache();
// Stats the file to get its current size.
void UpdateFileSize();
// Raises a file_opened event.
void RaiseOpenEvent();
// Initialize encryption with the given public key.
void InitEncrypt(const char* keyfile);
// Finalize encryption.
void FinishEncrypt();
FILE* f;
BroType* t;
char* name;
@ -132,28 +108,12 @@ protected:
BroFile* next; // doubly-linked list of cached files
BroFile* prev;
Attributes* attrs;
double rotate_interval;
bool buffered;
// Sizes are double's so that it's easy to specify large
// ones with scientific notation, and so they can exceed 4GB.
double rotate_size;
double current_size;
Timer* rotate_timer;
double open_time;
bool print_hook;
bool raw_output;
static double default_rotation_interval;
static double default_rotation_size;
EVP_PKEY* pub_key;
EVP_CIPHER_CTX* cipher_ctx;
static const int MIN_BUFFER_SIZE = 1024;
unsigned char* cipher_buffer;
};
#endif