mirror of
https://github.com/zeek/zeek.git
synced 2025-10-16 05:28:20 +00:00
Cleanup/improve PList usage and Event API
Majority of PLists are now created as automatic/stack objects, rather than on heap and initialized either with the known-capacity reserved upfront or directly from an initializer_list (so there's no wasted slack in the memory that gets allocated for lists containing a fixed/known number of elements). Added versions of the ConnectionEvent/QueueEvent methods that take a val_list by value. Added a move ctor/assign-operator to Plists to allow passing them around without having to copy the underlying array of pointers.
This commit is contained in:
parent
78dcbcc71a
commit
8bc65f09ec
92 changed files with 1585 additions and 1679 deletions
|
@ -57,11 +57,11 @@ bool file_analysis::X509::EndOfFile()
|
|||
RecordVal* cert_record = ParseCertificate(cert_val, GetFile());
|
||||
|
||||
// and send the record on to scriptland
|
||||
val_list* vl = new val_list();
|
||||
vl->append(GetFile()->GetVal()->Ref());
|
||||
vl->append(cert_val->Ref());
|
||||
vl->append(cert_record->Ref()); // we Ref it here, because we want to keep a copy around for now...
|
||||
mgr.QueueEvent(x509_certificate, vl);
|
||||
mgr.QueueEvent(x509_certificate, {
|
||||
GetFile()->GetVal()->Ref(),
|
||||
cert_val->Ref(),
|
||||
cert_record->Ref(), // we Ref it here, because we want to keep a copy around for now...
|
||||
});
|
||||
|
||||
// after parsing the certificate - parse the extensions...
|
||||
|
||||
|
@ -227,11 +227,10 @@ void file_analysis::X509::ParseBasicConstraints(X509_EXTENSION* ex)
|
|||
if ( constr->pathlen )
|
||||
pBasicConstraint->Assign(1, val_mgr->GetCount((int32_t) ASN1_INTEGER_get(constr->pathlen)));
|
||||
|
||||
val_list* vl = new val_list();
|
||||
vl->append(GetFile()->GetVal()->Ref());
|
||||
vl->append(pBasicConstraint);
|
||||
|
||||
mgr.QueueEvent(x509_ext_basic_constraints, vl);
|
||||
mgr.QueueEvent(x509_ext_basic_constraints, {
|
||||
GetFile()->GetVal()->Ref(),
|
||||
pBasicConstraint,
|
||||
});
|
||||
BASIC_CONSTRAINTS_free(constr);
|
||||
}
|
||||
|
||||
|
@ -367,10 +366,10 @@ void file_analysis::X509::ParseSAN(X509_EXTENSION* ext)
|
|||
|
||||
sanExt->Assign(4, val_mgr->GetBool(otherfields));
|
||||
|
||||
val_list* vl = new val_list();
|
||||
vl->append(GetFile()->GetVal()->Ref());
|
||||
vl->append(sanExt);
|
||||
mgr.QueueEvent(x509_ext_subject_alternative_name, vl);
|
||||
mgr.QueueEvent(x509_ext_subject_alternative_name, {
|
||||
GetFile()->GetVal()->Ref(),
|
||||
sanExt,
|
||||
});
|
||||
GENERAL_NAMES_free(altname);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue