tcpflow  1.6.1
About: tcpflow is a TCP/IP packet demultiplexer that captures data transmitted as part of TCP connections (flows), and stores the data in a way that is convenient for protocol analysis and debugging.
  Fossies Dox: tcpflow-1.6.1.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

Loading...
Searching...
No Matches
utils.cpp File Reference
#include "config.h"
#include "cppmutex.h"
#include "utils.h"
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
#include <ctype.h>
#include <assert.h>
#include <inttypes.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <string.h>
#include <stdarg.h>
#include <sstream>
Include dependency graph for utils.cpp:

Go to the source code of this file.

Macros

#define _FILE_OFFSET_BITS   64
 
#define __STDC_FORMAT_MACROS
 

Functions

void err (int eval, const char *fmt,...)
 
void errx (int eval, const char *fmt,...)
 
void warn (const char *fmt,...)
 
void warnx (const char *fmt,...)
 
void localtime_r (time_t *t, struct tm *tm)
 
void gmtime_r (time_t *t, struct tm *tm)
 
bool ends_with (const std::string &buf, const std::string &with)
 
bool ends_with (const std::wstring &buf, const std::wstring &with)
 
std::vector< std::string > & split (const std::string &s, char delim, std::vector< std::string > &elems)
 
std::vector< std::string > split (const std::string &s, char delim)
 

Variables

cppmutex localtime_mutex
 
cppmutex gmtime_mutex
 

Macro Definition Documentation

◆ __STDC_FORMAT_MACROS

#define __STDC_FORMAT_MACROS

Definition at line 10 of file utils.cpp.

◆ _FILE_OFFSET_BITS

#define _FILE_OFFSET_BITS   64

A collection of utility functions that are useful.

Definition at line 6 of file utils.cpp.

Function Documentation

◆ ends_with() [1/2]

bool ends_with ( const std::string &  buf,
const std::string &  with 
)

Definition at line 114 of file utils.cpp.

◆ ends_with() [2/2]

bool ends_with ( const std::wstring &  buf,
const std::wstring &  with 
)

Definition at line 121 of file utils.cpp.

◆ err()

void err ( int  eval,
const char *  fmt,
  ... 
)

◆ errx()

void errx ( int  eval,
const char *  fmt,
  ... 
)

Definition at line 46 of file utils.cpp.

◆ gmtime_r()

void gmtime_r ( time_t *  t,
struct tm *  tm 
)

Definition at line 98 of file utils.cpp.

References gmtime_mutex.

Referenced by microsoftDateToISODate(), and unixTimeToISODate().

◆ localtime_r()

void localtime_r ( time_t *  t,
struct tm *  tm 
)

Definition at line 88 of file utils.cpp.

References localtime_mutex.

◆ split() [1/2]

std::vector< std::string > split ( const std::string &  s,
char  delim 
)

Definition at line 143 of file utils.cpp.

References split().

◆ split() [2/2]

std::vector< std::string > & split ( const std::string &  s,
char  delim,
std::vector< std::string > &  elems 
)

Definition at line 133 of file utils.cpp.

Referenced by main(), mkdirs_for_path(), and split().

◆ warn()

void warn ( const char *  fmt,
  ... 
)

Definition at line 59 of file utils.cpp.

◆ warnx()

void warnx ( const char *  fmt,
  ... 
)

Definition at line 70 of file utils.cpp.

Variable Documentation

◆ gmtime_mutex

cppmutex gmtime_mutex

Definition at line 97 of file utils.cpp.

Referenced by gmtime_r().

◆ localtime_mutex

cppmutex localtime_mutex

Extract a buffer...

Parameters
buf- the buffer to extract;
buflen- the size of the page to extract
pos0- the byte position of buf[0]

Definition at line 87 of file utils.cpp.

Referenced by localtime_r().