mirror of
https://github.com/zeek/zeek.git
synced 2025-10-05 16:18:19 +00:00
and factor stuff out the input framework too.
This commit is contained in:
parent
501328d61a
commit
9b2265877d
10 changed files with 339 additions and 292 deletions
|
@ -8,6 +8,12 @@
|
|||
|
||||
class AsciiInputOutput {
|
||||
public:
|
||||
// Constructor that leaves separators, etc empty.
|
||||
// Use if you just need functionality like StringToAddr, etc.
|
||||
AsciiInputOutput(threading::MsgThread*);
|
||||
|
||||
// Constructor that defines all separators, etc.
|
||||
// Use if you need either ValToODesc or EntryToVal.
|
||||
AsciiInputOutput(threading::MsgThread*, const string & separator, const string & set_separator,
|
||||
const string & empty_field, const string & unset_field);
|
||||
~AsciiInputOutput();
|
||||
|
@ -17,6 +23,9 @@ class AsciiInputOutput {
|
|||
// returns false & logs an error with reporter in case an error occurs
|
||||
bool ValToODesc(ODesc* desc, threading::Value* val, const threading::Field* field) const;
|
||||
|
||||
// convert the ascii representation of a field into a Value
|
||||
threading::Value* EntryToVal(string s, string name, TypeTag type, TypeTag subtype = TYPE_ERROR) const;
|
||||
|
||||
/** Helper method to render an IP address as a string.
|
||||
*
|
||||
* @param addr The address.
|
||||
|
@ -41,8 +50,24 @@ class AsciiInputOutput {
|
|||
*/
|
||||
static string Render(double d);
|
||||
|
||||
/**
|
||||
* Convert a string into a TransportProto. This is just a utility
|
||||
* function for Readers.
|
||||
*
|
||||
* @param proto the transport protocol
|
||||
*/
|
||||
TransportProto StringToProto(const string &proto) const;
|
||||
|
||||
/**
|
||||
* Convert a string into a Value::addr_t. This is just a utility
|
||||
* function for Readers.
|
||||
*
|
||||
* @param addr containing an ipv4 or ipv6 address
|
||||
*/
|
||||
threading::Value::addr_t StringToAddr(const string &addr) const;
|
||||
|
||||
private:
|
||||
bool CheckNumberError(const string& s, const char * end) const;
|
||||
|
||||
string separator;
|
||||
string set_separator;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue