cryptlib  3.4.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros
scorebrd.h
Go to the documentation of this file.
1 /****************************************************************************
2 * *
3 * cryptlib Session Scoreboard Header File *
4 * Copyright Peter Gutmann 1998-2004 *
5 * *
6 ****************************************************************************/
7 
8 #ifndef _SCOREBRD_DEFINED
9 
10 #define _SCOREBRD_DEFINED
11 
12 /****************************************************************************
13 * *
14 * Scoreboard Types and Structures *
15 * *
16 ****************************************************************************/
17 
18 /* The search key to use for a scoreboard lookup. We distinguish between
19  client and server sessionIDs in order to provide a logically distinct
20  namespace for client and server sessions */
21 
22 typedef enum {
24  SCOREBOARD_KEY_SESSIONID_CLI, /* Lookup by client session ID */
25  SCOREBOARD_KEY_SESSIONID_SVR, /* Lookup by server session ID */
26  SCOREBOARD_KEY_FQDN, /* Lookup by server FQDN */
29 
30 /* The search result from looking up an entry in the scoreboard */
31 
32 typedef struct {
33  /* Scoreboard search key information */
35  const void *key;
36  int keySize;
37 
38  /* The data stored with the scoreboard entry */
40  const void *data;
41  int dataSize;
43 
44 /* Storage for the scoreboard state. When passed to scoreboard functions
45  it's declared as a void * because to the caller it's an opaque memory
46  block while to the scoreboard routines it's structured storage */
47 
48 typedef BYTE SCOREBOARD_STATE[ 64 ];
49 
50 /****************************************************************************
51 * *
52 * Scoreboard Functions *
53 * *
54 ****************************************************************************/
55 
56 /* Session scoreboard management functions */
57 
59 int lookupScoreboardEntry( INOUT void *scoreboardInfoPtr,
60  IN_ENUM( SCOREBOARD_KEY ) \
62  IN_BUFFER( keyLength ) const void *key,
64  OUT SCOREBOARD_LOOKUP_RESULT *lookupResult );
65 CHECK_RETVAL_RANGE( 0, MAX_INTLENGTH ) STDC_NONNULL_ARG( ( 1, 2, 4 ) ) \
66 int addScoreboardEntry( INOUT void *scoreboardInfoPtr,
67  IN_BUFFER( keyLength ) const void *key,
68  IN_LENGTH_SHORT_MIN( 8 ) const int keyLength,
69  IN_BUFFER( valueLength ) const void *value,
71 CHECK_RETVAL_RANGE( 0, MAX_INTLENGTH ) STDC_NONNULL_ARG( ( 1, 2, 4, 6 ) ) \
72 int addScoreboardEntryEx( INOUT void *scoreboardInfoPtr,
73  IN_BUFFER( keyLength ) const void *key,
74  IN_LENGTH_SHORT_MIN( 8 ) const int keyLength,
75  IN_BUFFER( keyLength ) const void *altKey,
76  IN_LENGTH_SHORT_MIN( 2 ) const int altKeyLength,
77  IN_BUFFER( valueLength ) const void *value,
78  IN_LENGTH_SHORT const int valueLength );
79 STDC_NONNULL_ARG( ( 1 ) ) \
80 void deleteScoreboardEntry( INOUT void *scoreboardInfoPtr,
82 
83 #ifdef USE_SSL
85  int initScoreboard( INOUT void *scoreboardInfoPtr,
86  IN_LENGTH_SHORT_MIN( 16 ) const int scoreboardEntries );
87  STDC_NONNULL_ARG( ( 1 ) ) \
88  void endScoreboard( INOUT void *scoreboardInfoPtr );
89 #else
90  #define initScoreboard( scoreboardInfo, scoreboardSize ) CRYPT_OK
91  #define endScoreboard( scoreboardInfo )
92 #endif /* USE_SSL */
93 #endif /* _SCOREBRD_DEFINED */