OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [net/] [snmp/] [lib/] [v2_0/] [include/] [lcd_time.h] - Blame information for rev 201

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
//==========================================================================
2
//
3
//      ./lib/current/include/lcd_time.h
4
//
5
//
6
//==========================================================================
7
//####ECOSGPLCOPYRIGHTBEGIN####
8
// -------------------------------------------
9
// This file is part of eCos, the Embedded Configurable Operating System.
10
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
11
//
12
// eCos is free software; you can redistribute it and/or modify it under
13
// the terms of the GNU General Public License as published by the Free
14
// Software Foundation; either version 2 or (at your option) any later version.
15
//
16
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
17
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
18
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19
// for more details.
20
//
21
// You should have received a copy of the GNU General Public License along
22
// with eCos; if not, write to the Free Software Foundation, Inc.,
23
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
24
//
25
// As a special exception, if other files instantiate templates or use macros
26
// or inline functions from this file, or you compile this file and link it
27
// with other works to produce a work based on this file, this file does not
28
// by itself cause the resulting work to be covered by the GNU General Public
29
// License. However the source code for this file must still be made available
30
// in accordance with section (3) of the GNU General Public License.
31
//
32
// This exception does not invalidate any other reasons why a work based on
33
// this file might be covered by the GNU General Public License.
34
//
35
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
36
// at http://sources.redhat.com/ecos/ecos-license/
37
// -------------------------------------------
38
//####ECOSGPLCOPYRIGHTEND####
39
//####UCDSNMPCOPYRIGHTBEGIN####
40
//
41
// -------------------------------------------
42
//
43
// Portions of this software may have been derived from the UCD-SNMP
44
// project,  <http://ucd-snmp.ucdavis.edu/>  from the University of
45
// California at Davis, which was originally based on the Carnegie Mellon
46
// University SNMP implementation.  Portions of this software are therefore
47
// covered by the appropriate copyright disclaimers included herein.
48
//
49
// The release used was version 4.1.2 of May 2000.  "ucd-snmp-4.1.2"
50
// -------------------------------------------
51
//
52
//####UCDSNMPCOPYRIGHTEND####
53
//==========================================================================
54
//#####DESCRIPTIONBEGIN####
55
//
56
// Author(s):    hmt
57
// Contributors: hmt
58
// Date:         2000-05-30
59
// Purpose:      Port of UCD-SNMP distribution to eCos.
60
// Description:  
61
//              
62
//
63
//####DESCRIPTIONEND####
64
//
65
//==========================================================================
66
/********************************************************************
67
       Copyright 1989, 1991, 1992 by Carnegie Mellon University
68
 
69
                          Derivative Work -
70
Copyright 1996, 1998, 1999, 2000 The Regents of the University of California
71
 
72
                         All Rights Reserved
73
 
74
Permission to use, copy, modify and distribute this software and its
75
documentation for any purpose and without fee is hereby granted,
76
provided that the above copyright notice appears in all copies and
77
that both that copyright notice and this permission notice appear in
78
supporting documentation, and that the name of CMU and The Regents of
79
the University of California not be used in advertising or publicity
80
pertaining to distribution of the software without specific written
81
permission.
82
 
83
CMU AND THE REGENTS OF THE UNIVERSITY OF CALIFORNIA DISCLAIM ALL
84
WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
85
WARRANTIES OF MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL CMU OR
86
THE REGENTS OF THE UNIVERSITY OF CALIFORNIA BE LIABLE FOR ANY SPECIAL,
87
INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
88
FROM THE LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
89
CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
90
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
91
*********************************************************************/
92
/*
93
 * lcd_time.h
94
 */
95
 
96
#ifndef _LCD_TIME_H
97
#define _LCD_TIME_H
98
 
99
#ifdef __cplusplus
100
extern "C" {
101
#endif
102
 
103
 
104
/* undefine to enable time synchronization only on authenticated packets */
105
#define LCD_TIME_SYNC_OPT 1
106
 
107
/*
108
 * Macros and definitions.
109
 */
110
#define ETIMELIST_SIZE  23
111
 
112
 
113
 
114
typedef struct enginetime_struct {
115
        u_char          *engineID;
116
        u_int            engineID_len;
117
 
118
        u_int            engineTime;
119
        u_int            engineBoot;
120
                /* Time & boots values received from last authenticated
121
                 *   message within the previous time window.
122
                 */
123
 
124
        time_t           lastReceivedEngineTime;
125
                /* Timestamp made when engineTime/engineBoots was last
126
                 *   updated.  Measured in seconds.
127
                 */
128
 
129
#ifdef LCD_TIME_SYNC_OPT        
130
        u_int  authenticatedFlag;
131
#endif      
132
        struct enginetime_struct        *next;
133
} enginetime, *Enginetime;
134
 
135
 
136
 
137
 
138
/*
139
 * Macros for streamlined engineID existence checks --
140
 *
141
 *      e       is char *engineID,
142
 *      e_l     is u_int engineID_len.
143
 *
144
 *
145
 *  ISENGINEKNOWN(e, e_l)
146
 *      Returns:
147
 *              TRUE    If engineID is recoreded in the EngineID List;
148
 *              FALSE   Otherwise.
149
 *
150
 *  ENSURE_ENGINE_RECORD(e, e_l)
151
 *      Adds the given engineID to the EngineID List if it does not exist
152
 *              already.  engineID is added with a <enginetime, engineboots>
153
 *              tuple of <0,0>.  ALWAYS succeeds -- except in case of a
154
 *              fatal internal error.
155
 *      Returns:
156
 *              SNMPERR_SUCCESS On success;
157
 *              SNMPERR_GENERR  Otherwise.
158
 *
159
 *  MAKENEW_ENGINE_RECORD(e, e_l)
160
 *      Returns:
161
 *              SNMPERR_SUCCESS If engineID already exists in the EngineID List;
162
 *              SNMPERR_GENERR  Otherwise -and- invokes ENSURE_ENGINE_RECORD()
163
 *                                      to add an entry to the EngineID List.
164
 *
165
 * XXX  Requres the following declaration in modules calling ISENGINEKNOWN():
166
 *      static u_int    dummy_etime, dummy_eboot;
167
 */
168
#define ISENGINEKNOWN(e, e_l)                                   \
169
        ( (get_enginetime(e, e_l,                               \
170
                &dummy_eboot, &dummy_etime, TRUE) == SNMPERR_SUCCESS)   \
171
                ? TRUE                                          \
172
                : FALSE )
173
 
174
#define ENSURE_ENGINE_RECORD(e, e_l)                            \
175
        ( (set_enginetime(e, e_l, 0, 0, FALSE) == SNMPERR_SUCCESS)        \
176
                ? SNMPERR_SUCCESS                               \
177
                : SNMPERR_GENERR )
178
 
179
#define MAKENEW_ENGINE_RECORD(e, e_l)                           \
180
        ( (ISENGINEKNOWN(e, e_l) == TRUE)                       \
181
                ? SNMPERR_SUCCESS                               \
182
                : (ENSURE_ENGINE_RECORD(e, e_l), SNMPERR_GENERR) )
183
 
184
 
185
 
186
/*
187
 * Prototypes.
188
 */
189
int      get_enginetime (u_char *engineID, u_int  engineID_len,
190
                             u_int *engine_boot, u_int *engine_time,
191
                             u_int authenticated);
192
 
193
int      get_enginetime_ex (u_char *engineID, u_int  engineID_len,
194
                            u_int *engine_boot, u_int *engine_time,
195
                            u_int *last_engine_time,
196
                            u_int authenticated);
197
 
198
int      set_enginetime (u_char *engineID, u_int engineID_len,
199
                             u_int   engine_boot, u_int engine_time,
200
                             u_int authenticated);
201
 
202
Enginetime
203
         search_enginetime_list (       u_char          *engineID,
204
                                        u_int            engineID_len);
205
 
206
int      hash_engineID (u_char *engineID, u_int engineID_len);
207
 
208
void     dump_etimelist_entry (Enginetime e, int count);
209
void     dump_etimelist (void);
210
 
211
#ifdef __cplusplus
212
}
213
#endif
214
 
215
#endif /* _LCD_TIME_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.