2-24
SOMobjects Base Toolkit: Programmer’s Reference Manual
get_principal Method
Purpose
Returns the ID of the principal that issued the request.
IDL Syntax
Principal get_principal (
in SOMDObject obj,
in Environment* req_ev);
Description
The get_principal method returns the ID of the principal that issued a request.
Parameters
receiver A pointer to a BOA (SOMOA) object for the server.
env A pointer to the Environment structure for the method caller.
obj A pointer to the object reference which is the target of the method call.
req_ev A pointer to the Environment object passed as input to the request.
Return Value
The get_principal method returns a pointer to a Principal object which identifies the user
and host from which a request originated.
Example
#include <somd.h>
/* assumed context: inside a method implementation */
void methodBody(SOMObject *somSelf, Environment *ev, ...)
{
Principal p;
SOMDObject selfRef;
Environment localev;
SOMInitEnvironment(&localev);
/* get a reference to myself from the server object */
selfRef =
somdRefFromSOMObj(SOMD_ServerObject, &ev, somSelf);
/* get principal information from the SOMOA */
p = _get_principal(SOMD_SOMOAObject, &localev, selfRef, ev);
printf(”user = %s, host = %s\n”,
__get_userName(p), __get_hostName(p));
...
}
Original Class
BOA
Related Information
Classes: Principal
Kommentare zu diesen Handbüchern