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

Generic protocol handling, hides the parent protocol handling. More...

#include <parent.h>

Inheritance diagram for GenericProtocol:
ParentProtocol AdmissionProtocol ConfigProtocol EchoProtocol EventsProtocol FsProtocol GenericNoXlateProtocol LogProtocol TimerProtocol

Public Types

enum  { CAP_PSEUDONYM, CAP_LOCK, CAP_SERVER_SESSION, CAP_SERVER_PT }
 Client capabilities used to talk to the service. More...
- Public Types inherited from ParentProtocol
enum  {
  TYPE_INVALID = 0, TYPE_OPEN, TYPE_CLOSE, TYPE_GENERIC_END,
  TYPE_GET_PORTAL, TYPE_REGISTER, TYPE_UNREGISTER, TYPE_GET_QUOTA,
  TYPE_SINGLETON, TYPE_REQ_KILL, TYPE_SIGNAL
}
 Protocol operations (message types). More...
enum  {
  CAP_CHILD_ID = Config::CAP_PARENT_BEGIN, CAP_SC_USAGE, CAP_CHILD_EC, CAP_PARENT_ID,
  CAP_PT_PERCPU, CAP_PT_IDLE_SCS = CAP_PT_PERCPU + Config::MAX_CPUS
}
 Capabilities used by parent to construct child. More...

Public Member Functions

unsigned call_server (Utcb &utcb, bool drop_frame)
 Call the server in a loop to resolve all faults.
unsigned call_server_drop (Utcb &utcb)
unsigned call_server_keep (Utcb &utcb)
template<class T >
void destroy (Utcb &utcb, unsigned portal_num, T *obj)
 Destroy the object.
void close (Utcb &utcb, unsigned portal_num, bool revoke_lock=true, bool _release_pseudonym=true)
 Close the session to the parent.
unsigned get_notify_sm ()
Utcbinit_frame (Utcb &utcb, unsigned op)
 GenericProtocol (const char *service, unsigned instance, unsigned cap_base, bool blocking, unsigned session_base=~0u)
- Public Member Functions inherited from ParentProtocol
 static_assert ((CAP_PT_PERCPU+Config::MAX_CPUS)< (1U<< Config::CAP_RESERVED_ORDER),"Capability Space misconfiguration.")

Static Public Member Functions

static Utcbinit_frame_noid (Utcb &utcb, unsigned op)
- Static Public Member Functions inherited from ParentProtocol
static Utcbinit_frame (Utcb &utcb, unsigned op, unsigned id)
static unsigned call (Utcb &utcb, unsigned cap_base, bool drop_frame, bool percpu=true)
 Low-level systemcall.
static unsigned get_pseudonym (Utcb &utcb, const char *service, unsigned instance, unsigned cap_pseudonym, unsigned parent_id=CAP_PARENT_ID)
static unsigned release_pseudonym (Utcb &utcb, unsigned cap_pseudonym)
static unsigned get_portal (Utcb &utcb, unsigned cap_pseudonym, unsigned cap_portal, bool blocking, char const *service_name=0)
 Ask parent to get the portal to talk to the service.
static unsigned register_service (Utcb &utcb, const char *service, unsigned cpu, unsigned pt, unsigned cap_service, char *revoke_mem=0)
static unsigned unregister_service (Utcb &utcb, unsigned cap_service)
static unsigned get_quota (Utcb &utcb, unsigned cap_client_pseudonym, const char *name, long invalue, long *outvalue=0)
static unsigned set_singleton (Utcb &utcb, unsigned cap_client_pseudonym, unsigned cap_local_session)
static unsigned check_singleton (Utcb &utcb, unsigned cap_client_pseudonym, unsigned &cap_local_session, Crd crd=Crd(0, 31, DESC_CAP_ALL))
 Services can use check_singleton() in conjunction with set_singleton() to enforce a one-session-per-client policy.
static unsigned kill (Utcb &utcb, unsigned cap_client_pseudonym, unsigned service_cap=0)
static unsigned signal (Utcb &utcb, unsigned value)
 Signals an (arbitrary) event to the parent.

Protected Attributes

const char * _service
unsigned _instance
unsigned _cap_base
 Base of the capability range. This cap refers to CAP_PSEUDONYM.
unsigned _session_base
 Base of the session portals.
Semaphore _lock
bool _blocking
bool _disabled

Detailed Description

Generic protocol handling, hides the parent protocol handling.

Specific protocols will be inherited from it. This is meant to be used only by clients.

Features: session-open, parent-open, request-portal, optional blocking Missing: restrict-quota

Member Enumeration Documentation

anonymous enum

Client capabilities used to talk to the service.

Enumerator:
CAP_PSEUDONYM 
CAP_LOCK 
CAP_SERVER_SESSION 
CAP_SERVER_PT 

Portal for CPU0.

Constructor & Destructor Documentation

GenericProtocol::GenericProtocol ( const char *  service,
unsigned  instance,
unsigned  cap_base,
bool  blocking,
unsigned  session_base = ~0u 
)
inline

Member Function Documentation

unsigned GenericProtocol::call_server ( Utcb utcb,
bool  drop_frame 
)
inline

Call the server in a loop to resolve all faults.

unsigned GenericProtocol::call_server_drop ( Utcb utcb)
inline
unsigned GenericProtocol::call_server_keep ( Utcb utcb)
inline
void GenericProtocol::close ( Utcb utcb,
unsigned  portal_num,
bool  revoke_lock = true,
bool  _release_pseudonym = true 
)
inline

Close the session to the parent.

  • Revoke all caps we got from external and we created (default: revoke_lock = true)
  • If revoke_lock == false than this object can be reused afterwards to create another session.
template<class T >
void GenericProtocol::destroy ( Utcb utcb,
unsigned  portal_num,
T *  obj 
)
inline

Destroy the object.

  • Revoke all caps and add caps back to cap allocator.
unsigned GenericProtocol::get_notify_sm ( )
inline
Utcb& GenericProtocol::init_frame ( Utcb utcb,
unsigned  op 
)
inline

Reimplemented in GenericNoXlateProtocol.

static Utcb& GenericProtocol::init_frame_noid ( Utcb utcb,
unsigned  op 
)
inlinestatic

Member Data Documentation

bool GenericProtocol::_blocking
protected
unsigned GenericProtocol::_cap_base
protected

Base of the capability range. This cap refers to CAP_PSEUDONYM.

bool GenericProtocol::_disabled
protected
unsigned GenericProtocol::_instance
protected
Semaphore GenericProtocol::_lock
protected
const char* GenericProtocol::_service
protected
unsigned GenericProtocol::_session_base
protected

Base of the session portals.


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