NOVA User-Level Environment  Version testbox/changed-memory-timing-317-g320d8b5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Client Class Reference

A simple per-cpu client. More...

#include <client.h>

Public Member Functions

 Client (pollfd &pfd, struct sockaddr_in &addr, bool hp=false)
 Client (int fd, struct sockaddr_in &addr, bool hp=false)
void touch ()
unsigned idle_secs ()
unsigned secs_until_timeout ()
string name ()
pollfd * get_pfd () const
int msg (const char *fmt,...) __attribute__((format(printf
 va_start (ap, fmt)
 va_end (ap)
 if (l > 0 &&str[l-1]== '\n') str[l-1]=0
 msg ("%s: %s\n", name().c_str(), str)
 free (str)
void add_to_queue (bool as_first=false)
void print_queue ()
void del_from_queue ()
void bye_bye (const string &message)
bool is_active () const
unsigned clients_before (string &who)
bool interpret_as_command (char ch, string &to_relay)
bool handle ()
void send (const char *str, size_t len)
void send (const string &str)
unsigned call ()
 Client (Utcb &utcb, CapAllocator *cap, const char *service, unsigned instance, bool blocking=true, bool single=false)
 ~Client ()

Public Attributes

bool high_prio
int va_list ap
int ret
char * str
 ret = vasprintf(&str, fmt, ap)
unsigned l = strlen(str)
return ret

Static Public Attributes

static Clientactive
static IpRelayip_relay
static const int timeout_secs = 20*60

Protected Attributes

Utcb_utcb
CapAllocator_cap_alloc
const char * _service
unsigned _session
unsigned _pseudonym
unsigned _portal
bool _single

Private Member Functions

 Client (const Client &)
Clientoperator= (const Client &)

Private Attributes

Clientnext
int fd
pollfd * pfd
struct sockaddr_in addr
char buf [4096]
string to_client
CommandStr command
struct timeval last_activity

Detailed Description

A simple per-cpu client.

Constructing a CpuLocalClient implicitly creates a session to the given service. Sessions are not closed on object destruction, as it might interfere with modularity (see comments in ~CpuLocalClient). Subclasses of CpuLocalClient (and services) are expected to add another layer to multiplex multiple connections using the same pseudonym (i.e. running in the same PD).

Constructor & Destructor Documentation

Client::Client ( const Client )
private
Client::Client ( pollfd &  pfd,
struct sockaddr_in &  addr,
bool  hp = false 
)
inline
Client::Client ( int  fd,
struct sockaddr_in &  addr,
bool  hp = false 
)
inline
Client::Client ( Utcb utcb,
CapAllocator cap,
const char *  service,
unsigned  instance,
bool  blocking = true,
bool  single = false 
)
inline
Client::~Client ( )
inline

Member Function Documentation

void Client::add_to_queue ( bool  as_first = false)
inline
void Client::bye_bye ( const string &  message)
inline
unsigned Client::call ( )
inline
unsigned Client::clients_before ( string &  who)
inline
void Client::del_from_queue ( )
inline
Client::free ( str  )
pollfd* Client::get_pfd ( ) const
inline
bool Client::handle ( )
inline
unsigned Client::idle_secs ( )
inline
Client::if ( l  ,
0 &&  str[l-1] = = '\n' 
)
pure virtual
bool Client::interpret_as_command ( char  ch,
string &  to_relay 
)
inline
bool Client::is_active ( ) const
inline
int Client::msg ( const char *  fmt,
  ... 
)
Client::msg ( "%s: %s\n"  ,
name().c_str()  ,
str   
)
string Client::name ( )
inline
Client& Client::operator= ( const Client )
private
void Client::print_queue ( )
inline
unsigned Client::secs_until_timeout ( )
inline
void Client::send ( const char *  str,
size_t  len 
)
inline
void Client::send ( const string &  str)
inline
void Client::touch ( )
inline
Client::va_end ( ap  )
Client::va_start ( ap  ,
fmt   
)

Member Data Documentation

CapAllocator* Client::_cap_alloc
protected
unsigned Client::_portal
protected
unsigned Client::_pseudonym
protected
const char* Client::_service
protected
unsigned Client::_session
protected
bool Client::_single
protected
Utcb& Client::_utcb
protected
Client * Client::active
static
struct sockaddr_in Client::addr
private
int va_list Client::ap
char Client::buf[4096]
private
CommandStr Client::command
private
int Client::fd
private
bool Client::high_prio
IpRelay * Client::ip_relay
static
unsigned Client::l = strlen(str)
struct timeval Client::last_activity
private
Client* Client::next
private
pollfd* Client::pfd
private
int Client::ret
Client::ret = vasprintf(&str, fmt, ap)
return Client::ret
char* Client::str
const int Client::timeout_secs = 20*60
static
string Client::to_client
private

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