Bristol Wearable Computing

[ Home | Plans | Meetings | Members | Search | Papers | Links | CyberWear | LocoSoft]


Policy Server

Purpose

The Policy Server allows any process to request, get or set policies that will affect the operations of the whole jacket.  The Policy Server is a central component of the jacket that any proces may consult to find out about current policies.

As well as serving policies, the Policy Server is also responsible for storing current policies safely, in the event of power-down or power cut-off's.

API's


/***********************************************************/
/*PolicyServer API header 1.00                             */
/*Michael McTernan mm7323@Bris.Ac.Uk                       */
/*   Started 31/8/98                                       */
/*Notes:                                                   */
/*                                                         */
/***********************************************************/
#ifndef POLICYSERVERAPI
#define POLICYSERVERAPI
/*---AddPolicy---
PROTOTYPE                                                  */
  int AddPolicy(int Type,char *Policy);                    /*
  
DESCRIPTION
  Adds the policy Policy of type Type, to the
  policy server. 
RETURNS
  0 if the policy was added without error, otherwise -1.
*/



/*---RemovePolicy---
PROTOTYPE                                                  */
  int RemovePolicy(int Type,char *Policy);                 /*
  
DESCRIPTION
  Remove the policy Policy of type Type, from the
  policy server.
RETURNS
  0 if the policy was removed without error, otherwise -1.
*/



/*---GetPolicies---
PROTOTYPE                                                  */
  int GetPolicies(int PolicyType,char ***ServiceList);     /*
  
DESCRIPTION
  Gets all polices of type PolicyType, and puts them into
  an array of type char * so that they may be read by the
  calling process.  
RETURNS
  -1 if an error occured, otherwise the number of policies held in 
  the returned array (although this maybe 0 if no policies of type
  PolicyType are defined).
  
NOTES
  It is the responsibility of the calling process to free all the
  memory held in the returned datastructure.  For ease, a function
  called DestroyPolicyList0 function has been supplied to do
  this; see the next function.
*/


 
/*---DestroyPolicyList---
PROTOTYPE                                                  */
  void DestroyPolicyList(char **ServiceList);              /*
  
DESCRIPTION
  Destroys the datastructure returned by GetPolicies.
*/ 
 


/*---EvaluatePolicy()---
PROTOTYPE                                                  */
  int EvaluatePolicy(int PolicyType,char *Expression);     /*
  
DESCRIPTION
  Evaluates Expression of policy type PolicyType
  and returns whether Expression is acceptable,
  not acceptable, or maybe acceptable to the users currently
  set policy.  
RETURNS
  -1   Error
  0    Not acceptable
  1    Accptable
  2    Maybe acceptable (user interaction required to resolve this)
NOTES
  Note that 'Maybe' may be returned even if maybe is not an allowed
  policy for the supplied PolicyType.  This may happen if 
  conflicting policies are encounted, or if no policies relating to
  PolicyType  have yet been set.
*/



/*---ConnectPolicyServer()---
PROTOTYPE                                                  */
  int ConnectPolicyServer();                               /*
  
DESCRIPTION
  Makes a connection to the policy server, so that a process
  may communicate with the policy server directly.
RETURNS
  -1 if an error occured, otherwise the unix file descriptor of
  the opened stream.
*/  
   
#endif

/***********************************************************/
/*Policy Types Header 1.00                                 */
/*Michael McTernan mm7323@Bris.Ac.Uk                       */
/*   Started 27/6/98                                       */
/*Notes:                                                   */
/*                                                         */
/***********************************************************/
#ifndef POLICYTYPESHEADER
#define POLICYTYPESHEADER
/*The codes for the policy types*/
/*Maybe ammended if required*/
#define POLICY_AddSensedContext     0
#define POLICY_AddUserContext       1
#define POLICY_MatchSensedContext   2
#define POLICY_MatchUserContext     3
#define POLICY_SuspendNoteUntil     4
#define POLICY_DeleteNoteWhen       5
#define POLICY_SetRenderProfile     6
#define POLICY_TransmitNote         7
#define POLICY_ReceiveNote          8
#define POLICY_FinishTransmitNote   9
#define POLICY_FinishReceiveNote    10
/*The greatest policy number*/
#define NUMPOLICYS                  11
#endif

unicrest.gif (4191 bytes)

The material displayed is provided 'as is' and is subject to use restrictions.
For problems or questions regarding this web contact Cliff Randell.
Last updated: January 14, 2000.
logoep.gif (1404 bytes)
ęCopyright Hewlett-Packard 1997-2000.