Logo Search packages:      
Sourcecode: pan version File versions

pan::ScriptedSocket Class Reference

#include <socket-impl-scripted.h>

Inheritance diagram for pan::ScriptedSocket:

pan::Socket

List of all members.


Detailed Description

A mock socket suitable for automated tests.

This object reads from a script and, if the commands passed to it match the script, it quotes back its lines from the script. If the commands don't match, it explodes.

Definition at line 35 of file socket-impl-scripted.h.


Public Types

typedef std::deque< std::string > strings_t

Public Member Functions

void add_script (const std::string &command, const std::string &response)
void add_script (const std::string &command, const strings_t &responses)
void clear ()
bool empty () const
double get_speed_KiBps () const
bool is_abort_set () const
virtual bool open (const StringView &address, int port)
void reset_speed_counter ()
void set_abort_flag (bool b)
virtual void write_command (const StringView &chars, Listener *)
void write_command_va (Listener *, const char *fmt,...)

Static Public Attributes

static const std::string ABORT
static const std::string NETWORK_ERROR

Protected Member Functions

void increment_xfer_byte_count (unsigned long byte_count)

Protected Attributes

bool _abort_flag
unsigned long _byte_count
time_t _time_started

Private Types

typedef std::pair< std::string,
strings_t > 
command_and_responses_t
typedef std::deque
< command_and_responses_t > 
script_t

Private Attributes

script_t _script

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index