Conflict Manager
[System]


Modules

 Conflict Manager Tokens

Defines

#define ALP_CLASS_CONFLICT_CALLBACK_STATUS   (ALP_CLASS_CONFLICT_MANAGER|0x00010000)
#define ALP_CLASS_CONFLICT_ERROR_STATUS   (ALP_CLASS_CONFLICT_MANAGER|0x00000000)
#define ALP_CLASS_CONFLICT_STATES   (ALP_CLASS_CONFLICT_MANAGER|0x00020000)
#define SUPPORT_TRY_ACTIVATE   0

Typedefs

typedef alp_status_t(* AlpConflictCallback )(AlpConflictToken token, AlpConflictState newState, const char *otherTokenName, void *cbData)
 The state change callback. This will be called at least once after every successful call to alp_conflict_token_activate().
typedef void * AlpConflictToken
 An opaque type, representing an activated token.

Enumerations

enum  {
  ALP_STATUS_CONFLICT_TOKEN_UNKNOWN, ALP_STATUS_CONFLICT_TOKEN_UNAVAILABLE, ALP_STATUS_CONFLICT_TOKEN_BLOCKED, ALP_STATUS_CONFLICT_IPC_ERROR,
  ALP_STATUS_CONFLICT_TOKEN_INVALID, ALP_STATUS_CONFLICT_UNREADABLE_RULES_FILE, ALP_STATUS_CONFLICT_INVALID_RULES_FILE, ALP_STATUS_CONFLICT_INVALID_PARAMETER
}
enum  { ALP_STATUS_CONFLICT_CALLBACK_CHANGE_PENDING, ALP_STATUS_CONFLICT_CALLBACK_ERROR }
enum  AlpConflictState {
  ALP_CONFLICT_INACTIVE, ALP_CONFLICT_CANCEL, ALP_CONFLICT_SUSPEND, ALP_CONFLICT_PENDING,
  ALP_CONFLICT_ALLOW
}
 The states passed to the AlpConflictCallback method. More...

Functions

alp_status_t alp_conflict_configure (const char *configFilename)
 Loads a set of tokens and conflict rules, from an ASCII file.
alp_status_t alp_conflict_token_activate (const char *tokenName, AlpConflictCallback stateChangeCB, void *cbData, AlpConflictToken *outToken)
 Tells the conflict manager that a component wants to enter a state that needs tracking.
alp_status_t alp_conflict_token_release (AlpConflictToken token)
 Tells the conflict manager that a component is leaving a state that needs tracking.


Define Documentation

#define ALP_CLASS_CONFLICT_CALLBACK_STATUS   (ALP_CLASS_CONFLICT_MANAGER|0x00010000)
 

#define ALP_CLASS_CONFLICT_ERROR_STATUS   (ALP_CLASS_CONFLICT_MANAGER|0x00000000)
 

#define ALP_CLASS_CONFLICT_STATES   (ALP_CLASS_CONFLICT_MANAGER|0x00020000)
 

#define SUPPORT_TRY_ACTIVATE   0
 


Typedef Documentation

typedef alp_status_t(* AlpConflictCallback)(AlpConflictToken token, AlpConflictState newState, const char *otherTokenName, void *cbData)
 

The state change callback. This will be called at least once after every successful call to alp_conflict_token_activate().

Parameters:
[in] token The token object whose permission state is changing.
[in] newState The new state of the conflict token: ALLOW, SUSPEND, or CANCEL
[in] otherTokenName The name of the other token that caused this permission state change.
[in] cbData Arbitrary user-data, passed to alp_conflict_token_activate()
Returns:
ALP_STATUS_OK Normal status: state change occurred

ALP_STATUS_CONFLICT_CALLBACK_CHANGE_PENDING State change in progress; will be signalled sepaarely via alp_conflict_token_yield() (alp_conflict_token_yield IS NOT SUPPORTED IN THIS RELEASE. DO NOT RETURN ALP_STATUS_CONFLICT_CALLBACK_CHANGE_PENDING.)

ALP_STATUS_CONFLICT_CALLBACK_ERROR Internal error: stuck in current state

Note:
There are two very important things to know about callbacks:
  1. The daemon will be blocked while the callback is running. The callback must return as quickly as possible. If the callback does not return within ALP_CONFLICT_CALLBACK_TIMEOUT milliseconds, the daemon will timeout and any result will be lost.
  2. Because the daemon will be blocked while the callback is running, you can not make any alp_conflict_X calls within the callback.

typedef void* AlpConflictToken
 

An opaque type, representing an activated token.


Enumeration Type Documentation

anonymous enum
 

Enumerator:
ALP_STATUS_CONFLICT_TOKEN_UNKNOWN  0x65000000: Token name is not declared in any loaded rules file
ALP_STATUS_CONFLICT_TOKEN_UNAVAILABLE  0x65000001: Token is already active
ALP_STATUS_CONFLICT_TOKEN_BLOCKED  0x65000002: Token can not be activated
ALP_STATUS_CONFLICT_IPC_ERROR  0x65000003: Unable to communicate with server
ALP_STATUS_CONFLICT_TOKEN_INVALID  0x65000004: Not a AlpConflictToken assigned by the Conflict Manager
ALP_STATUS_CONFLICT_UNREADABLE_RULES_FILE  0x65000005: Can't open a rules file: missing, bad permissions, or system errors
ALP_STATUS_CONFLICT_INVALID_RULES_FILE  0x65000006: Error parsing a rules file
ALP_STATUS_CONFLICT_INVALID_PARAMETER  0x65000007: A parameter is invalid in some way. Most typically, a required pointer is NULL.

anonymous enum
 

Enumerator:
ALP_STATUS_CONFLICT_CALLBACK_CHANGE_PENDING  0x65010000: State change in progress; will be signalled separately via alp_conflict_token_yield()
ALP_STATUS_CONFLICT_CALLBACK_ERROR  0x65010001: Internal error - state change will not happen

enum AlpConflictState
 

The states passed to the AlpConflictCallback method.

Enumerator:
ALP_CONFLICT_INACTIVE  0x65020000: Token has never been activated, or has been released and deactivated.
ALP_CONFLICT_CANCEL  0x65020001: A conflict occurred and this token's functionality was disallowed. The token should become inactive soon.
ALP_CONFLICT_SUSPEND  0x65020002: A conflict occurred, and this token's functionality was suspended. It will be automatically changed back to ALLOW when possible.
ALP_CONFLICT_PENDING  0x65020003: A conflict occurred, and a different token was canceled or suspended, but its state change has not yet been acknowledged by the clients. This state should change to ALLOW soon (when the other change is acknowledged).
ALP_CONFLICT_ALLOW  0x65020004: The token's functionality is allowed.


Function Documentation

alp_status_t alp_conflict_configure const char *  configFilename  ) 
 

Loads a set of tokens and conflict rules, from an ASCII file.

Parameters:
[in] configFilename The filename to load
Returns:
ALP_STATUS_OK Successful execution

ALP_STATUS_CONFLICT_UNREADABLE_RULES_FILE Can't open rules file: missing, bad permissions, or system errors like too many open files

ALP_STATUS_CONFLICT_INVALID_RULES_FILE Syntax error

ALP_STATUS_CONFLICT_IPC_ERROR System failure

alp_status_t alp_conflict_token_activate const char *  tokenName,
AlpConflictCallback  stateChangeCB,
void *  cbData,
AlpConflictToken outToken
 

Tells the conflict manager that a component wants to enter a state that needs tracking.

Parameters:
[in] tokenName The name of the state you wish to enter. Must match a token declared in a loaded rules file. The conflict manager will not use this string after the call returns; you may free it at any time.
[in] stateChangeCB The method called whenever the token's AlpConflictState changes. May be NULL.
[in] cbData Arbitrary data passed to the callback. May contain a this pointer, or some other pointer to component state.
[out] outToken Shorthand representation of tokenName; passed to AlpConflictCallback(), alp_conflict_token_release(), and alp_conflict_token_yield()
Returns:
ALP_STATUS_OK Normal status; at least one call to stateChangeCB will follow.

ALP_STATUS_CONFLICT_TOKEN_UNKNOWN tokenName is not declared in any loaded rules file

ALP_STATUS_CONFLICT_TOKEN_UNAVAILABLE Token is already active and multiple activations are not allowed

ALP_STATUS_CONFLICT_TOKEN_BLOCKED Token is blocked

ALP_STATUS_CONFLICT_IPC_ERROR System failure

ALP_STATUS_CONFLICT_INVALID_PARAMETER Either tokenNames or outToken is NULL.

alp_status_t alp_conflict_token_release AlpConflictToken  token  ) 
 

Tells the conflict manager that a component is leaving a state that needs tracking.

Parameters:
[in] token The outToken you got from a call to alp_conflict_token_activate (or alp_conflict_token_try_activate)
Returns:
ALP_STATUS_OK Successful execution

ALP_STATUS_CONFLICT_TOKEN_INVALID Not an active token

ALP_STATUS_CONFLICT_IPC_ERROR System failure


Generated on Wed Jul 30 07:06:42 2008 by Doxygen 1.4.6 for ALP SDK + Hiker Documentation

Copyright © 1999-2008 ACCESS CO., LTD. All rights reserved.