(file) Return to credcache.h CVS log (file) (dir) Up to [OMI] / omi / base

 1 mike  1.1 /*
 2           **==============================================================================
 3           **
 4           ** Open Management Infrastructure (OMI)
 5           **
 6           ** Copyright (c) Microsoft Corporation
 7           ** 
 8           ** Licensed under the Apache License, Version 2.0 (the "License"); you may not 
 9           ** use this file except in compliance with the License. You may obtain a copy 
10           ** of the License at 
11           **
12           **     http://www.apache.org/licenses/LICENSE-2.0 
13           **
14           ** THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15           ** KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED 
16           ** WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, 
17           ** MERCHANTABLITY OR NON-INFRINGEMENT. 
18           **
19           ** See the Apache 2 License for the specific language governing permissions 
20           ** and limitations under the License.
21           **
22 mike  1.1 **==============================================================================
23           */
24           
25           #ifndef _omi_credcache_h
26           #define _omi_credcache_h
27           
28           #include <common.h>
29           #include "strings.h"
30           #if defined(CONFIG_POSIX)
31           #else
32           #endif
33           
34           BEGIN_EXTERNC
35           
36           /* 
37               Adds user name and password into cache
38           */
39           void CredCache_PutUser(const char* user, const char* password);
40           
41           /* 
42               Checks if user credentials matches the one in cache
43 mike  1.1     Returns:
44               '0' if user account matches entry in cache
45               '-1' if user is not in cache, if password does not match or
46                   record expired
47           */
48           int CredCache_CheckUser(const char* user, const char* password);
49           
50           /* Unit-test support - updating expiration timeout */
51           void CredCache_SetExpirationTimeout(MI_Uint64 expirationTimeUS);
52           /* Unit-test support mostly - clear all cached items */
53           void CredCache_Clean();
54           
55           /* security-related utility */
56           /*
57               Generates crypto-suitable random data
58               Parameters:
59               buf - bufer for random data
60               size - number of bytes to generate
61           
62               Returns:
63               0 - success
64 mike  1.1     -1 - failed
65           */
66           int CredCache_GenerateRandom(
67               char* buf,
68               size_t  size);
69           
70           END_EXTERNC
71           
72           #endif /* _omi_credcache_h */

ViewCVS 0.9.2