ReactOS  0.4.15-dev-1150-g593bcce
nbnamecache.h
Go to the documentation of this file.
1 /* Copyright (c) 2003 Juan Lang
2  *
3  * This library is free software; you can redistribute it and/or
4  * modify it under the terms of the GNU Lesser General Public
5  * License as published by the Free Software Foundation; either
6  * version 2.1 of the License, or (at your option) any later version.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with this library; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
16  */
17 #ifndef __WINE_NBNAMECACHE_H
18 #define __WINE_NBNAMECACHE_H
19 
20 struct NBNameCache;
21 
22 /* Represents an entry in the name cache. If the NetBIOS name is known, it's
23  * in nbname. Otherwise, nbname begins with '*'. numAddresses defines the
24  * number of addresses in addresses.
25  * Notice that it allows multiple addresses per name, but doesn't explicitly
26  * allow group names. That's because all names so far are unique; if a use for
27  * group names comes up, adding a flag here is simple enough.
28  * Also, only the first NCBNAMSZ - 1 bytes are considered significant. This is
29  * because a name may have been resolved using DNS, and the suffix byte is
30  * always truncated for DNS lookups.
31  */
32 typedef struct _NBNameCacheEntry
33 {
39 
40 /* Functions that create, manipulate, and destroy a name cache. Thread-safe,
41  * with the exception of NBNameCacheDestroy--ensure that no other threads are
42  * manipulating the cache before destroying it.
43  */
44 
45 /* Allocates a new name cache from heap, and sets the expire time on new
46  * entries to entryExpireTimeMS after a cache entry is added.
47  */
49 
50 /* Adds an entry to the cache. The entry is assumed to have been allocated
51  * from the same heap as the name cache; the name cache will own the entry
52  * from now on. The entry's expire time is initialized at this time to
53  * entryExpireTimeMS + the current time in MS. If an existing entry with the
54  * same name was in the cache, the entry is replaced. Returns TRUE on success
55  * or FALSE on failure.
56  */
58 
59 /* Finds the entry with name name in the cache and returns a pointer to it, or
60  * NULL if it isn't found.
61  */
64 
66 
67 #endif /* ndef __WINE_NBNAMECACHE_H */
void NBNameCacheDestroy(struct NBNameCache *cache) DECLSPEC_HIDDEN
Definition: nbnamecache.c:176
Definition: cache.c:48
HANDLE heap
Definition: nbnamecache.c:33
#define DECLSPEC_HIDDEN
Definition: precomp.h:8
const NBNameCacheEntry * NBNameCacheFindEntry(struct NBNameCache *cache, const UCHAR name[NCBNAMSZ]) DECLSPEC_HIDDEN
Definition: nbnamecache.c:151
unsigned int BOOL
Definition: ntddk_ex.h:94
UCHAR nbname[NCBNAMSZ]
Definition: nbnamecache.h:35
#define NCBNAMSZ
Definition: nb30.h:7
struct NBNameCache * NBNameCacheCreate(HANDLE heap, DWORD entryExpireTimeMS) DECLSPEC_HIDDEN
Definition: nbnamecache.c:92
BOOL NBNameCacheAddEntry(struct NBNameCache *cache, NBNameCacheEntry *entry) DECLSPEC_HIDDEN
Definition: nbnamecache.c:111
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned char UCHAR
Definition: xmlstorage.h:181
uint32_t entry
Definition: isohybrid.c:63
DWORD addresses[1]
Definition: nbnamecache.h:37
struct _NBNameCacheEntry NBNameCacheEntry
DWORD entryExpireTimeMS
Definition: nbnamecache.c:35
Definition: name.c:38