00001 //Copyright, 2002-2003, Astra Network Inc. All Rights Reserved 00002 00003 //This source code has been published by Astra Network Inc. However, any 00004 //use, reproduction, modification, distribution or transfer of this 00005 //software, or any software which includes or is based upon any of this 00006 //code, is only permitted if expressly authorized by a written license 00007 //agreement from Astra. Contact your Astra representative directly for 00008 //more information. 00009 00018 #ifndef __CHECKPOINT_H__ 00019 #define __CHECKPOINT_H__ 00020 00021 00023 typedef enum { 00024 HC_INVALID_EVENT, 00025 HC_NORMALFAIL, 00026 HC_NORMALSUCCESS, 00027 HC_ROLLBACKSUCCESS, 00028 HC_ROLLBACKFAIL 00029 } HC_PolicyEvent_t; 00030 00031 00032 #define HC_OK 0 00033 #define HC_FAIL -1 00034 #define HC_INVALIDSEQUENCE -2 00035 #define HC_INVALIDNODE -3 00036 #define HC_FAILEDALLOC -4 00037 #define HC_FAILEDSEQUENCE -5 00038 #define HC_FINALERROR -5 00039 00040 00041 typedef enum { 00042 HC_LISTEND, 00043 HC_NORMALFUNC, 00044 HC_ROLLBACKFUNC, 00045 HC_POLICYFUNC 00046 } HC_TypeTag_t; 00047 00048 00050 typedef struct 00051 { 00052 long node_number; 00053 HC_TypeTag_t type_tag; 00054 void *data; 00055 } 00056 HC_NodelistNode_t; 00057 00059 typedef struct HC_NodeStack_s 00060 { 00061 long index; 00062 struct HC_NodeStack_s *next; 00063 } 00064 HC_NodeStack_t; 00065 00066 00071 typedef struct 00072 { 00073 HC_NodelistNode_t *node_list; 00074 HC_NodeStack_t *index_stack; 00075 long num_nodes; 00076 long curr_node; 00077 00078 long curr_policy_data; 00079 HC_PolicyEvent_t curr_event; 00080 unsigned long checkpoint; 00081 void *userdata; 00082 } 00083 HC_Sequence_t; 00084 00085 00086 /* function prototypes, documentation is in the source files */ 00087 int HC_Normal (HC_Sequence_t *sequence, long node, void *userdata); 00088 int HC_NormalCurrent (HC_Sequence_t *sequence, void *userdata); 00089 00090 int HC_RollBackPrev (HC_Sequence_t *sequence); 00091 int HC_RollBackCurrent (HC_Sequence_t *sequence); 00092 00093 int HC_NormalSuccess (HC_Sequence_t *sequence, long policy_data); 00094 int HC_NormalFail (HC_Sequence_t *sequence, long policy_data); 00095 int HC_RollBackSuccess (HC_Sequence_t *sequence, long policy_data); 00096 int HC_RollBackFail (HC_Sequence_t *sequence, long policy_data); 00097 00098 int HC_Checkpoint (HC_Sequence_t *sequence, unsigned long checkpoint); 00099 00100 HC_Sequence_t * 00101 HC_NewSequence (HC_NodelistNode_t * nodelist); 00102 void HC_DeleteSequence (HC_Sequence_t *sequence); 00103 00104 int HC_CallSequence (HC_Sequence_t * sequence, void *userdata, 00105 long start_node); 00106 00107 int HC_DefaultPolicy (HC_Sequence_t *sequence, void *userdata, 00108 HC_PolicyEvent_t event, long policy_data); 00109 00110 //lint -function(exit, HC_Panic) 00111 void HC_Panic (HC_Sequence_t *sequence, const char *format, ...); 00112 //lint -function(printf, HC_Log) 00113 int HC_Log (HC_Sequence_t *sequence, const char *format, ...); 00114 const char *HC_Strerror(int error); 00115 00116 #endif
Copyright ©2003. Astra Network Inc. All Rights Reserved.