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