SContext Class Reference
[Binder]

#include <support/Context.h>

List of all members.


Detailed Description

Representation of a global context (namespace).


Public Types

enum  new_flags_enum {
  PROCESS_MASK = 0x000f, PREFER_LOCAL = 0x0000, PREFER_REMOTE = 0x0001, REQUIRE_LOCAL = 0x0002,
  REQUIRE_REMOTE = 0x0003
}
 Flags given to New(), RemoteNew(), and NewProcess() to control process assignment. More...

Public Member Functions

status_t InitCheck () const
SValue Lookup (const SString &location) const
status_t LookupComponent (const SString &id, SValue *out_info) const
SValue LookupComponentProperty (const SString &component, const SString &property) const
sptr< IBinderLookupService (const SString &name) const
template<class INTERFACE>
sptr< INTERFACE > LookupServiceAs (const SString &name) const
sptr< IBinderNew (const SValue &component, const SValue &args=B_UNDEFINED_VALUE, uint32_t flags=PREFER_LOCAL, status_t *outError=NULL) const
 Instantiate a new component, possibly hosted by the local process.
sptr< IBinderNewCustomProcess (const SString &executable, const SVector< SString > &args=SVector< SString >(), uint32_t flags=0, const SValue &env=B_UNDEFINED_VALUE, status_t *outError=NULL) const
 Low-level process instantiation function. Use NewProcess() instead.
sptr< IProcessNewProcess (const SString &name, uint32_t flags=PREFER_REMOTE, const SValue &env=B_UNDEFINED_VALUE, status_t *outError=NULL) const
 Instantiate a new process.
bool operator!= (const SContext &o) const
bool operator< (const SContext &o) const
bool operator<= (const SContext &o) const
SContextoperator= (const SContext &o)
bool operator== (const SContext &o) const
bool operator> (const SContext &o) const
bool operator>= (const SContext &o) const
status_t Publish (const SString &location, const SValue &val) const
status_t PublishService (const SString &name, const sptr< IBinder > &object) const
sptr< IBinderRemoteNew (const SValue &component, const sptr< IProcess > &process, const SValue &args=B_UNDEFINED_VALUE, uint32_t flags=PREFER_LOCAL, status_t *outError=NULL) const
 Instantiate a new component, possibly hosted by a specified process.
sptr< INodeRoot () const
status_t RunScript (const SString &filename) const
 SContext (const SContext &context)
 SContext (const sptr< INode > &node)
 SContext ()
status_t Unpublish (const SString &location) const
 ~SContext ()

Static Public Member Functions

static SContext GetContext (const SString &name, const sptr< IProcess > &caller)
 Low-level version of GetContext() taking an explicit process.
static SContext GetContext (const SString &name)
 Back-door to retrieve a specific named context.
static SContext SystemContext ()
 Back-door for retrieving the global system context.
static SContext UserContext ()
 Back-door for retrieving the global user context.


Member Enumeration Documentation

enum new_flags_enum
 

Flags given to New(), RemoteNew(), and NewProcess() to control process assignment.

Enumerator:
PROCESS_MASK  All bits specifying the process preference.
PREFER_LOCAL  We would like to use a local process, if that is possible.

This will always use the local process, unless that conflicts with the preferences of the component or is prevented by security restrictions.

PREFER_REMOTE  We would like to use a remote process, if that is possible.

This will always use a remote process, unless prevented by the capabilities of the system. Primarily the only way this will not be honored is if BINDER_SINGLE_PROCESS is set or the binder kernel module is not available. Note that this may result in a child process being created from your own process in which to host the component.

REQUIRE_LOCAL  We must always use a local process, without exception.

This option should be used rarely. If the local process can not be used (probably due to security restrictions), the instantiation will fail.

REQUIRE_REMOTE  We must always use a remote process, without exception.

This option should be used rarely. If a remote process can not be used (probably because the binder kernel module is not available), the instantiation will fail.


Constructor & Destructor Documentation

SContext  ) 
 

SContext const sptr< INode > &  node  ) 
 

SContext const SContext context  ) 
 

~SContext  ) 
 


Member Function Documentation

SContext GetContext const SString name,
const sptr< IProcess > &  caller
[static]
 

Low-level version of GetContext() taking an explicit process.

The other context retrieval calls funnel down to this one, passing the local IProcess in to 'caller'.

SContext GetContext const SString name  )  [static]
 

Back-door to retrieve a specific named context.

The contexts that are available depends on how the system has been configured, though the "user" and "system" contexts should always exist (corresponding to the UserContext() and SystemContext() APIs here).

status_t InitCheck  )  const
 

SValue Lookup const SString location  )  const
 

status_t LookupComponent const SString id,
SValue out_info
const
 

SValue LookupComponentProperty const SString component,
const SString property
const
 

sptr< IBinder > LookupService const SString name  )  const
 

sptr< INTERFACE > LookupServiceAs const SString name  )  const
 

sptr< IBinder > New const SValue component,
const SValue args = B_UNDEFINED_VALUE,
uint32_t  flags = PREFER_LOCAL,
status_t outError = NULL
const
 

Instantiate a new component, possibly hosted by the local process.

Parameters:
[in] component Name of the component to instantiate. This may be a complex SValue combining the name and arguments as the mapping { component -> args }.
[in] args Additional component arguments.
[in] flags Behavior modifiers, selected from new_flags_enum.
[out] outError Result code, B_OK if no error.
Returns:
Non-NULL if the component was instantiated. If NULL, outError will contain the reason for the error.

sptr< IBinder > NewCustomProcess const SString executable,
const SVector< SString > &  args = SVectorSString >(),
uint32_t  flags = 0,
const SValue env = B_UNDEFINED_VALUE,
status_t outError = NULL
const
 

Low-level process instantiation function. Use NewProcess() instead.

sptr< IProcess > NewProcess const SString name,
uint32_t  flags = PREFER_REMOTE,
const SValue env = B_UNDEFINED_VALUE,
status_t outError = NULL
const
 

Instantiate a new process.

Parameters:
[in] name Name of the new process.
[in] flags Behavior modifiers, selected from new_flags_enum.
[in] env Evironment variables for process (not currently implemented).
[out] outError Result code, B_OK if no error.
Returns:
Non-NULL if a new process was created. If NULL, outError will contain the reason for failure.
This function creates a new, empty process, which you can then use with RemoteNew() to instantiate components inside of. The name you give is currently just a convenience and not really used. The PREFER_LOCAL and FORCE_LOCAL flags will result in always getting the local IProcess.

bool operator!= const SContext o  )  const
 

bool operator< const SContext o  )  const
 

bool operator<= const SContext o  )  const
 

SContext & operator= const SContext o  ) 
 

bool operator== const SContext o  )  const
 

bool operator> const SContext o  )  const
 

bool operator>= const SContext o  )  const
 

status_t Publish const SString location,
const SValue val
const
 

status_t PublishService const SString name,
const sptr< IBinder > &  object
const
 

sptr< IBinder > RemoteNew const SValue component,
const sptr< IProcess > &  process,
const SValue args = B_UNDEFINED_VALUE,
uint32_t  flags = PREFER_LOCAL,
status_t outError = NULL
const
 

Instantiate a new component, possibly hosted by a specified process.

Parameters:
[in] component Name of the component to instantiate. This may be a complex SValue combining the name and arguments as the mapping { component -> args }.
[in] process The process object into which to instantiate the component.
[in] args Additional component arguments.
[in] flags Behavior modifiers, selected from new_flags_enum.
[out] outError Result code, B_OK if no error.
Returns:
Non-NULL if the component was instantiated. If NULL, outError will contain the reason for the error.
This is like New(), but allows you to specify a different process than your own into which the component should be instantiated. Otherwise, the process is treated as if it is your own -- i.e., PREFER_LOCAL means that you would like the component to be instantiated in process.

sptr< INode > Root  )  const
 

status_t RunScript const SString filename  )  const
 

SContext SystemContext  )  [static]
 

Back-door for retrieving the global system context.

This returns the "root" or system context. This is the initial context created by smooved, with full permissions. Access to it may be quite restricted, so you can't in any way count on this API returning back a valid context.

status_t Unpublish const SString location  )  const
 

SContext UserContext  )  [static]
 

Back-door for retrieving the global user context.

Note:
You should only use this API if you are not running as a normal Binder components. Binder components should always access their context through BBinder::Context().
This returns the least-trusted "user" context. This context is always guaranteed to exist, though the functionality offered through it may be quite limited.


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