14 * undefine to enable time synchronization only on authenticated packets
16 #define LCD_TIME_SYNC_OPT 1
19 * Macros and definitions.
21 #define ETIMELIST_SIZE 23
25 typedef struct enginetime_struct {
32 * Time & boots values received from last authenticated
33 * * message within the previous time window.
36 time_t lastReceivedEngineTime;
38 * Timestamp made when engineTime/engineBoots was last
39 * * updated. Measured in seconds.
42 #ifdef LCD_TIME_SYNC_OPT
43 u_int authenticatedFlag;
45 struct enginetime_struct *next;
46 } enginetime , *Enginetime;
52 * Macros for streamlined engineID existence checks --
54 * e is char *engineID,
55 * e_l is u_int engineID_len.
58 * ISENGINEKNOWN(e, e_l)
60 * TRUE If engineID is recoreded in the EngineID List;
63 * ENSURE_ENGINE_RECORD(e, e_l)
64 * Adds the given engineID to the EngineID List if it does not exist
65 * already. engineID is added with a <enginetime, engineboots>
66 * tuple of <0,0>. ALWAYS succeeds -- except in case of a
67 * fatal internal error.
69 * SNMPERR_SUCCESS On success;
70 * SNMPERR_GENERR Otherwise.
72 * MAKENEW_ENGINE_RECORD(e, e_l)
74 * SNMPERR_SUCCESS If engineID already exists in the EngineID List;
75 * SNMPERR_GENERR Otherwise -and- invokes ENSURE_ENGINE_RECORD()
76 * to add an entry to the EngineID List.
78 * XXX Requres the following declaration in modules calling ISENGINEKNOWN():
79 * static u_int dummy_etime, dummy_eboot;
81 #define ISENGINEKNOWN(e, e_l) \
82 ( (get_enginetime(e, e_l, \
83 &dummy_eboot, &dummy_etime, TRUE) == SNMPERR_SUCCESS) \
87 #define ENSURE_ENGINE_RECORD(e, e_l) \
88 ( (set_enginetime(e, e_l, 0, 0, FALSE) == SNMPERR_SUCCESS) \
92 #define MAKENEW_ENGINE_RECORD(e, e_l) \
93 ( (ISENGINEKNOWN(e, e_l) == TRUE) \
95 : (ENSURE_ENGINE_RECORD(e, e_l), SNMPERR_GENERR) )
102 int get_enginetime(u_char * engineID, u_int engineID_len,
105 u_int authenticated);
107 int get_enginetime_ex(u_char * engineID,
111 u_int * last_engine_time,
112 u_int authenticated);
114 int set_enginetime(u_char * engineID, u_int engineID_len,
115 u_int engine_boot, u_int engine_time,
116 u_int authenticated);
125 search_enginetime_list(u_char * engineID, u_int engineID_len);
127 int hash_engineID(u_char * engineID, u_int engineID_len);
129 void dump_etimelist_entry(Enginetime e, int count);
130 void dump_etimelist(void);
135 #endif /* _LCD_TIME_H */