ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

nbnamecache.h
Go to the documentation of this file.
00001 /* Copyright (c) 2003 Juan Lang
00002  *
00003  * This library is free software; you can redistribute it and/or
00004  * modify it under the terms of the GNU Lesser General Public
00005  * License as published by the Free Software Foundation; either
00006  * version 2.1 of the License, or (at your option) any later version.
00007  *
00008  * This library is distributed in the hope that it will be useful,
00009  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011  * Lesser General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU Lesser General Public
00014  * License along with this library; if not, write to the Free Software
00015  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
00016  */
00017 #ifndef __WINE_NBNAMECACHE_H
00018 #define __WINE_NBNAMECACHE_H
00019 
00020 #include <stdarg.h>
00021 
00022 #include "windef.h"
00023 #include "winbase.h"
00024 #include "nb30.h"
00025 
00026 struct NBNameCache;
00027 
00028 /* Represents an entry in the name cache.  If the NetBIOS name is known, it's
00029  * in nbname.  Otherwise, nbname begins with '*'.  numAddresses defines the
00030  * number of addresses in addresses.
00031  * Notice that it allows multiple addresses per name, but doesn't explicitly
00032  * allow group names.  That's because all names so far are unique; if a use for
00033  * group names comes up, adding a flag here is simple enough.
00034  * Also, only the first NCBNAMSZ - 1 bytes are considered significant.  This is
00035  * because a name may have been resolved using DNS, and the suffix byte is
00036  * always truncated for DNS lookups.
00037  */
00038 typedef struct _NBNameCacheEntry
00039 {
00040     UCHAR name[NCBNAMSZ];
00041     UCHAR nbname[NCBNAMSZ];
00042     DWORD numAddresses;
00043     DWORD addresses[1];
00044 } NBNameCacheEntry;
00045 
00046 /* Functions that create, manipulate, and destroy a name cache.  Thread-safe,
00047  * with the exception of NBNameCacheDestroy--ensure that no other threads are
00048  * manipulating the cache before destroying it.
00049  */
00050 
00051 /* Allocates a new name cache from heap, and sets the expire time on new
00052  * entries to entryExpireTimeMS after a cache entry is added.
00053  */
00054 struct NBNameCache *NBNameCacheCreate(HANDLE heap, DWORD entryExpireTimeMS);
00055 
00056 /* Adds an entry to the cache.  The entry is assumed to have been allocated
00057  * from the same heap as the name cache; the name cache will own the entry
00058  * from now on.  The entry's expire time is initialized at this time to
00059  * entryExpireTimeMS + the current time in MS.  If an existing entry with the
00060  * same name was in the cache, the entry is replaced.  Returns TRUE on success
00061  * or FALSE on failure.
00062  */
00063 BOOL NBNameCacheAddEntry(struct NBNameCache *cache, NBNameCacheEntry *entry);
00064 
00065 /* Finds the entry with name name in the cache and returns a pointer to it, or
00066  * NULL if it isn't found.
00067  */
00068 const NBNameCacheEntry *NBNameCacheFindEntry(struct NBNameCache *cache,
00069  const UCHAR name[NCBNAMSZ]);
00070 
00071 void NBNameCacheDestroy(struct NBNameCache *cache);
00072 
00073 #endif /* ndef __WINE_NBNAMECACHE_H */

Generated on Sat May 26 2012 04:23:58 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.