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

netbios.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_NETBIOS_H__
00018 #define __WINE_NETBIOS_H__
00019 
00020 #include <stdarg.h>
00021 #include "windef.h"
00022 #include "winbase.h"
00023 #include "lm.h"
00024 #include "nb30.h"
00025 
00026 /* This file describes the interface WINE's NetBIOS implementation uses to
00027  * interact with a transport implementation (where a transport might be
00028  * NetBIOS-over-TCP/IP (aka NetBT, NBT), NetBIOS-over-IPX, etc.)
00029  */
00030 
00035 void NetBIOSInit(void);
00036 void NetBIOSShutdown(void);
00037 
00038 struct _NetBIOSTransport;
00039 
00040 /* A transport should register itself during its init function (see below) with
00041  * a unique id (the transport_id of ACTION_HEADER, for example) and an
00042  * implementation.  Returns TRUE on success, and FALSE on failure.
00043  */
00044 BOOL NetBIOSRegisterTransport(ULONG id, struct _NetBIOSTransport *transport);
00045 
00046 /* Registers an adapter with the given transport and ifIndex with NetBIOS.
00047  * ifIndex is an interface index usable by the IpHlpApi.  ifIndex is not
00048  * required to be unique, but is required so that NetWkstaTransportEnum can use
00049  * GetIfEntry to get the name and hardware address of the adapter.
00050  * Returns TRUE on success, FALSE on failure.
00051  * FIXME: need functions for retrieving the name and hardware index, rather
00052  * than assuming a correlation with IpHlpApi.
00053  */
00054 BOOL NetBIOSRegisterAdapter(ULONG transport, DWORD ifIndex, void *adapter);
00055 
00056 /* During enumeration, all adapters from your transport are disabled
00057  * internally.  If an adapter is still valid, reenable it with this function.
00058  * Adapters you don't enable will have their transport's NetBIOSCleanupAdapter
00059  * function (see below) called on them, and will be removed from the table.
00060  * (This is to deal with lack of plug-and-play--sorry.)
00061  */
00062 void NetBIOSEnableAdapter(UCHAR lana);
00063 
00064 /* Gets a quick count of the number of NetBIOS adapters.  Not guaranteed not
00065  * to change from one call to the next, depending on what's been enumerated
00066  * lately.  See also NetBIOSEnumAdapters.
00067  */
00068 UCHAR NetBIOSNumAdapters(void);
00069 
00070 typedef struct _NetBIOSAdapterImpl {
00071     UCHAR lana;
00072     DWORD ifIndex;
00073     void *data;
00074 } NetBIOSAdapterImpl;
00075 
00076 typedef BOOL (*NetBIOSEnumAdaptersCallback)(UCHAR totalLANAs, UCHAR lanaIndex,
00077  ULONG transport, const NetBIOSAdapterImpl *data, void *closure);
00078 
00079 /* Enumerates all NetBIOS adapters for the transport transport, or for all
00080  * transports if transport is ALL_TRANSPORTS.  Your callback will be called
00081  * once for every enumerated adapter, with a count of how many adapters have
00082  * been enumerated, a 0-based index relative to that count, the adapter's
00083  * transport, and its ifIndex.
00084  * Your callback should return FALSE if it no longer wishes to be called.
00085  */
00086 void NetBIOSEnumAdapters(ULONG transport, NetBIOSEnumAdaptersCallback cb,
00087  void *closure);
00088 
00089 /* Hangs up the session identified in the NCB; the NCB need not be a NCBHANGUP.
00090  * Will result in the transport's hangup function being called, so release any
00091  * locks you own before calling to avoid deadlock.
00092  * This function is intended for use by a transport, if the session is closed
00093  * by some error in the transport layer.
00094  */
00095 void NetBIOSHangupSession(const NCB *ncb);
00096 
00101 /* This function is called to ask a transport implementation to enumerate any
00102  * LANAs into the NetBIOS adapter table by:
00103  * - calling NetBIOSRegisterAdapter for any new adapters
00104  * - calling NetBIOSEnableAdapter for any existing adapters
00105  * NetBIOSEnumAdapters (see) may be of use to determine which adapters already
00106  * exist.
00107  * A transport can assume no other thread is modifying the NetBIOS adapter
00108  * table during the lifetime of its NetBIOSEnum function (and, therefore, that
00109  * this function won't be called reentrantly).
00110  */
00111 typedef UCHAR (*NetBIOSEnum)(void);
00112 
00113 /* A cleanup function for a transport.  This is the last function called on a
00114  * transport.
00115  */
00116 typedef void (*NetBIOSCleanup)(void);
00117 
00118 /* Adapter functions */
00119 
00120 /* Functions with direct mappings to the Netbios interface.  These functions
00121  * are expected to be synchronous, although the first four bytes of the
00122  * reserved member of the ncb are a cancel flag.  A long-running function
00123  * should check whether this is not FALSE from time to time (see the
00124  * NCB_CANCELLED macro), and return NRC_CMDCAN if it's been cancelled.  (The
00125  * remainder of the NCB's reserved field is, well, reserved.)
00126  */
00127 
00128 /* Used to see whether the pointer to an NCB has been cancelled.  The NetBIOS
00129  * interface designates certain functions as non-cancellable functions, but I
00130  * use this flag for all NCBs.  Support it if you can.
00131  * FIXME: this isn't enough, need to support an EVENT or some such, because
00132  * some calls (recv) will block indefinitely, so a reset, shutdown, etc. will
00133  * never occur.
00134  */
00135 #define NCB_CANCELLED(pncb) *(const BOOL *)((pncb)->ncb_reserve)
00136 
00137 typedef UCHAR (*NetBIOSAstat)(void *adapter, PNCB ncb);
00138 typedef UCHAR (*NetBIOSFindName)(void *adapter, PNCB ncb);
00139 
00140 /* Functions to support the session service */
00141 
00142 /* Implement to support the NCBCALL command.  If you need data stored for the
00143  * session, return it in *session.  You can clean it up in your NetBIOSHangup
00144  * function (see).
00145  */
00146 typedef UCHAR (*NetBIOSCall)(void *adapter, PNCB ncb, void **session);
00147 typedef UCHAR (*NetBIOSSend)(void *adapter, void *session, PNCB ncb);
00148 typedef UCHAR (*NetBIOSRecv)(void *adapter, void *session, PNCB ncb);
00149 typedef UCHAR (*NetBIOSHangup)(void *adapter, void *session);
00150 
00151 /* The last function called on an adapter; it is not called reentrantly, and
00152  * no new calls will be made on the adapter once this has been entered.  Clean
00153  * up any resources allocated for the adapter here.
00154  */
00155 typedef void (*NetBIOSCleanupAdapter)(void *adapter);
00156 
00157 typedef struct _NetBIOSTransport
00158 {
00159     NetBIOSEnum           enumerate;
00160     NetBIOSAstat          astat;
00161     NetBIOSFindName       findName;
00162     NetBIOSCall           call;
00163     NetBIOSSend           send;
00164     NetBIOSRecv           recv;
00165     NetBIOSHangup         hangup;
00166     NetBIOSCleanupAdapter cleanupAdapter;
00167     NetBIOSCleanup        cleanup;
00168 } NetBIOSTransport;
00169 
00170 /* Transport-specific functions.  When adding a transport, add a call to its
00171  * init function in netapi32's DllMain.  The transport can do any global
00172  * initialization it needs here.  It should call NetBIOSRegisterTransport to
00173  * register itself with NetBIOS.
00174  */
00175 
00176 /* NetBIOS-over-TCP/IP (NetBT) functions */
00177 
00178 /* Not defined by MS, so make my own private define: */
00179 #define TRANSPORT_NBT "MNBT"
00180 
00181 void NetBTInit(void);
00182 
00183 #endif /* ndef __WINE_NETBIOS_H__ */

Generated on Sun May 27 2012 04:25:27 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.