Correct the test for the ODS_SELECTED bit in the WM_DRAWITEM message
[wine] / dlls / netapi32 / nbnamecache.h
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16  */
17 #ifndef __WINE_NBNAMECACHE_H
18 #define __WINE_NBNAMECACHE_H
19
20 #include "winbase.h"
21 #include "nb30.h"
22
23 struct NBNameCache;
24
25 /* Represents an entry in the name cache.  If the NetBIOS name is known, it's
26  * in nbname.  Otherwise, nbname begins with '*'.  numAddresses defines the
27  * number of addresses in addresses.
28  * Notice that it allows multiple addresses per name, but doesn't explicitly
29  * allow group names.  That's because all names so far are unique; if a use for
30  * group names comes up, adding a flag here is simple enough.
31  * Also, only the first NCBNAMSZ - 1 bytes are considered significant.  This is
32  * because a name may have been resolved using DNS, and the suffix byte is
33  * always truncated for DNS lookups.
34  */
35 typedef struct _NBNameCacheEntry
36 {
37     UCHAR name[NCBNAMSZ];
38     UCHAR nbname[NCBNAMSZ];
39     DWORD numAddresses;
40     DWORD addresses[1];
41 } NBNameCacheEntry;
42
43 /* Functions that create, manipulate, and destroy a name cache.  Thread-safe,
44  * with the exception of NBNameCacheDestroy--ensure that no other threads are
45  * manipulating the cache before destoying it.
46  */
47
48 /* Allocates a new name cache from heap, and sets the expire time on new
49  * entries to entryExpireTimeMS after a cache entry is added.
50  */
51 struct NBNameCache *NBNameCacheCreate(HANDLE heap, DWORD entryExpireTimeMS);
52
53 /* Adds an entry to the cache.  The entry is assumed to have been allocated
54  * from the same heap as the name cache; the name cache will own the entry
55  * from now on.  The entry's expire time is initialized at this time to
56  * entryExpireTimeMS + the current time in MS.  If an existing entry with the
57  * same name was in the cache, the entry is replaced.  Returns TRUE on success
58  * or FALSE on failure.
59  */
60 BOOL NBNameCacheAddEntry(struct NBNameCache *cache, NBNameCacheEntry *entry);
61
62 /* Finds the entry with name name in the cache and returns a pointer to it, or
63  * NULL if it isn't found.
64  */
65 const NBNameCacheEntry *NBNameCacheFindEntry(struct NBNameCache *cache,
66  const UCHAR name[NCBNAMSZ]);
67
68 /* If the entry with name name is in the cache, updates its nbname member to
69  * nbname.  The entry's expire time is implicitly updated to entryExpireTimeMS
70  * + the current time in MS, since getting the NetBIOS name meant validating
71  * the name and address anyway.
72  * Returns TRUE on success or FALSE on failure.
73  */
74 BOOL NBNameCacheUpdateNBName(struct NBNameCache *cache,
75  const UCHAR name[NCBNAMSZ], const UCHAR nbname[NCBNAMSZ]);
76
77 void NBNameCacheDestroy(struct NBNameCache *cache);
78
79 #endif /* ndef __WINE_NBNAMECACHE_H */