ReactOS  0.4.13-dev-73-gcfe54aa
netbios.c File Reference
#include "netapi32.h"
#include "nbcmdqueue.h"
Include dependency graph for netbios.c:

Go to the source code of this file.

Classes

struct  _NetBIOSTransportTableEntry
 
struct  _NetBIOSSession
 
struct  _NetBIOSAdapter
 
struct  _NetBIOSAdapterTable
 

Macros

#define ADAPTERS_INCR   8
 
#define DEFAULT_NUM_SESSIONS   16
 

Typedefs

typedef struct _NetBIOSTransportTableEntry NetBIOSTransportTableEntry
 
typedef struct _NetBIOSSession NetBIOSSession
 
typedef struct _NetBIOSAdapter NetBIOSAdapter
 
typedef struct _NetBIOSAdapterTable NetBIOSAdapterTable
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (netbios)
 
static UCHAR nbResizeAdapterTable (UCHAR newSize)
 
void NetBIOSInit (void)
 
void NetBIOSShutdown (void)
 
BOOL NetBIOSRegisterTransport (ULONG id, NetBIOSTransport *transport)
 
BOOL NetBIOSRegisterAdapter (ULONG transport, DWORD ifIndex, void *data)
 
void NetBIOSEnableAdapter (UCHAR lana)
 
static void nbShutdownAdapter (NetBIOSAdapter *adapter)
 
static void nbInternalEnum (void)
 
UCHAR NetBIOSNumAdapters (void)
 
void NetBIOSEnumAdapters (ULONG transport, NetBIOSEnumAdaptersCallback cb, void *closure)
 
static NetBIOSAdapternbGetAdapter (UCHAR lana)
 
static UCHAR nbEnum (PNCB ncb)
 
static UCHAR nbInternalHangup (NetBIOSAdapter *adapter, NetBIOSSession *session)
 
static UCHAR nbCancel (NetBIOSAdapter *adapter, PNCB ncb)
 
static UCHAR nbResizeAdapter (NetBIOSAdapter *adapter, UCHAR sessionsLen)
 
static UCHAR nbReset (NetBIOSAdapter *adapter, PNCB ncb)
 
static UCHAR nbSStat (NetBIOSAdapter *adapter, PNCB ncb)
 
static UCHAR nbCall (NetBIOSAdapter *adapter, PNCB ncb)
 
static UCHAR nbSend (NetBIOSAdapter *adapter, PNCB ncb)
 
static UCHAR nbRecv (NetBIOSAdapter *adapter, PNCB ncb)
 
static UCHAR nbHangup (NetBIOSAdapter *adapter, const NCB *ncb)
 
void NetBIOSHangupSession (const NCB *ncb)
 
static UCHAR nbAStat (NetBIOSAdapter *adapter, PNCB ncb)
 
static UCHAR nbDispatch (NetBIOSAdapter *adapter, PNCB ncb)
 
static DWORD WINAPI nbCmdThread (LPVOID lpVoid)
 
UCHAR WINAPI Netbios (PNCB ncb)
 
DWORD WINAPI NetpNetBiosStatusToApiStatus (DWORD nrc)
 

Variables

static NetBIOSTransportTableEntry gTransports [1]
 
static UCHAR gNumTransports = 0
 
static NetBIOSAdapterTable gNBTable
 

Macro Definition Documentation

◆ ADAPTERS_INCR

#define ADAPTERS_INCR   8

Definition at line 29 of file netbios.c.

◆ DEFAULT_NUM_SESSIONS

#define DEFAULT_NUM_SESSIONS   16

Definition at line 30 of file netbios.c.

Typedef Documentation

◆ NetBIOSAdapter

◆ NetBIOSAdapterTable

◆ NetBIOSSession

◆ NetBIOSTransportTableEntry

Function Documentation

◆ nbAStat()

static UCHAR nbAStat ( NetBIOSAdapter adapter,
PNCB  ncb 
)
static

Definition at line 679 of file netbios.c.

680 {
681  UCHAR ret;
682 
683  if (!adapter) return NRC_BRIDGE;
684  if (!adapter->transport->astat) return NRC_ILLCMD;
685  if (!ncb) return NRC_INVADDRESS;
686  if (!ncb->ncb_buffer) return NRC_BADDR;
687  if (ncb->ncb_length < sizeof(ADAPTER_STATUS)) return NRC_BUFLEN;
688 
689  ret = adapter->transport->astat(adapter->impl.data, ncb);
690  if (ncb->ncb_callname[0] == '*')
691  {
693 
694  astat->max_sess = astat->max_cfg_sess = adapter->sessionsLen;
695  }
696  return ret;
697 }
NetBIOSAstat astat
Definition: netbios.h:154
#define NRC_ILLCMD
Definition: nb30.h:54
UCHAR ncb_callname[NCBNAMSZ]
Definition: nb30.h:155
struct _ADAPTER_STATUS * PADAPTER_STATUS
WORD ncb_length
Definition: nb30.h:154
NetBIOSTransport * transport
Definition: netbios.c:61
unsigned char UCHAR
Definition: xmlstorage.h:181
int ret
#define NRC_BRIDGE
Definition: nb30.h:76
#define NRC_BUFLEN
Definition: nb30.h:53
PUCHAR ncb_buffer
Definition: nb30.h:153
#define NRC_BADDR
Definition: nb30.h:57
WORD max_sess
Definition: nb30.h:122
DWORD sessionsLen
Definition: netbios.c:65
NetBIOSAdapterImpl impl
Definition: netbios.c:62
#define NRC_INVADDRESS
Definition: nb30.h:85
WORD max_cfg_sess
Definition: nb30.h:121

Referenced by nbDispatch().

◆ nbCall()

static UCHAR nbCall ( NetBIOSAdapter adapter,
PNCB  ncb 
)
static

Definition at line 541 of file netbios.c.

542 {
543  UCHAR ret, i;
544 
545  TRACE(": adapter %p, NCB %p\n", adapter, ncb);
546 
547  if (!adapter) return NRC_BRIDGE;
548  if (adapter->sessionsLen == 0) return NRC_ENVNOTDEF;
549  if (!adapter->transport->call) return NRC_ILLCMD;
550  if (!ncb) return NRC_INVADDRESS;
551 
552  EnterCriticalSection(&adapter->cs);
553  for (i = 0; i < adapter->sessionsLen && adapter->sessions[i].inUse; i++)
554  ;
555  if (i < adapter->sessionsLen)
556  {
557  adapter->sessions[i].inUse = TRUE;
558  adapter->sessions[i].state = CALL_PENDING;
559  memcpy(adapter->sessions[i].local_name, ncb->ncb_name, NCBNAMSZ);
560  memcpy(adapter->sessions[i].remote_name, ncb->ncb_callname, NCBNAMSZ);
561  ret = NRC_GOODRET;
562  }
563  else
564  ret = NRC_LOCTFUL;
565  LeaveCriticalSection(&adapter->cs);
566 
567  if (ret == NRC_GOODRET)
568  {
569  ret = adapter->transport->call(adapter->impl.data, ncb,
570  &adapter->sessions[i].data);
571  if (ret == NRC_GOODRET)
572  {
573  ncb->ncb_lsn = i;
574  adapter->sessions[i].state = SESSION_ESTABLISHED;
575  }
576  else
577  {
578  adapter->sessions[i].inUse = FALSE;
579  adapter->sessions[i].state = 0;
580  }
581  }
582  TRACE("returning 0x%02x\n", ret);
583  return ret;
584 }
#define TRUE
Definition: types.h:120
#define NRC_GOODRET
Definition: nb30.h:52
#define NRC_ILLCMD
Definition: nb30.h:54
UCHAR ncb_callname[NCBNAMSZ]
Definition: nb30.h:155
CRITICAL_SECTION cs
Definition: netbios.c:64
#define SESSION_ESTABLISHED
Definition: nb30.h:19
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
UCHAR state
Definition: netbios.c:41
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define NRC_ENVNOTDEF
Definition: nb30.h:80
#define CALL_PENDING
Definition: nb30.h:18
#define NCBNAMSZ
Definition: nb30.h:7
NetBIOSCall call
Definition: netbios.h:156
#define TRACE(s)
Definition: solgame.cpp:4
NetBIOSTransport * transport
Definition: netbios.c:61
unsigned char UCHAR
Definition: xmlstorage.h:181
int ret
UCHAR remote_name[NCBNAMSZ]
Definition: netbios.c:43
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
NetBIOSSession * sessions
Definition: netbios.c:66
UCHAR local_name[NCBNAMSZ]
Definition: netbios.c:42
#define NRC_BRIDGE
Definition: nb30.h:76
void * data
Definition: netbios.c:44
DWORD sessionsLen
Definition: netbios.c:65
NetBIOSAdapterImpl impl
Definition: netbios.c:62
UCHAR ncb_name[NCBNAMSZ]
Definition: nb30.h:156
#define NRC_LOCTFUL
Definition: nb30.h:65
UCHAR ncb_lsn
Definition: nb30.h:151
#define NRC_INVADDRESS
Definition: nb30.h:85
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

Referenced by nbDispatch().

◆ nbCancel()

static UCHAR nbCancel ( NetBIOSAdapter adapter,
PNCB  ncb 
)
static

Definition at line 371 of file netbios.c.

372 {
373  UCHAR ret;
374 
375  TRACE(": adapter %p, ncb %p\n", adapter, ncb);
376 
377  if (!adapter) return NRC_BRIDGE;
378  if (!ncb) return NRC_INVADDRESS;
379 
380  switch (ncb->ncb_command & 0x7f)
381  {
382  case NCBCANCEL:
383  case NCBADDNAME:
384  case NCBADDGRNAME:
385  case NCBDELNAME:
386  case NCBRESET:
387  case NCBSSTAT:
388  ret = NRC_CANCEL;
389  break;
390 
391  /* NCBCALL, NCBCHAINSEND/NCBSEND, NCBHANGUP all close the associated
392  * session if cancelled */
393  case NCBCALL:
394  case NCBSEND:
395  case NCBCHAINSEND:
396  case NCBSENDNA:
397  case NCBCHAINSENDNA:
398  case NCBHANGUP:
399  {
400  if (ncb->ncb_lsn >= adapter->sessionsLen)
401  ret = NRC_SNUMOUT;
402  else if (!adapter->sessions[ncb->ncb_lsn].inUse)
403  ret = NRC_SNUMOUT;
404  else
405  {
406  ret = NBCmdQueueCancel(adapter->cmdQueue, ncb);
407  if (ret == NRC_CMDCAN || ret == NRC_CANOCCR)
408  nbInternalHangup(adapter, &adapter->sessions[ncb->ncb_lsn]);
409  }
410  break;
411  }
412 
413  default:
414  ret = NBCmdQueueCancel(adapter->cmdQueue, ncb);
415  }
416  TRACE("returning 0x%02x\n", ret);
417  return ret;
418 }
#define NRC_CANCEL
Definition: nb30.h:78
#define NRC_CANOCCR
Definition: nb30.h:77
UCHAR NBCmdQueueCancel(struct NBCmdQueue *queue, PNCB ncb)
Definition: nbcmdqueue.c:106
#define NCBCHAINSENDNA
Definition: nb30.h:46
#define NCBCANCEL
Definition: nb30.h:41
#define NCBSENDNA
Definition: nb30.h:45
#define NCBDELNAME
Definition: nb30.h:37
#define NCBADDNAME
Definition: nb30.h:36
#define NCBSSTAT
Definition: nb30.h:40
struct NBCmdQueue * cmdQueue
Definition: netbios.c:63
#define NCBRESET
Definition: nb30.h:38
static UCHAR nbInternalHangup(NetBIOSAdapter *adapter, NetBIOSSession *session)
Definition: netbios.c:626
#define TRACE(s)
Definition: solgame.cpp:4
#define NCBSEND
Definition: nb30.h:28
#define NRC_CMDCAN
Definition: nb30.h:61
#define NCBADDGRNAME
Definition: nb30.h:42
unsigned char UCHAR
Definition: xmlstorage.h:181
#define NRC_SNUMOUT
Definition: nb30.h:58
int ret
NetBIOSSession * sessions
Definition: netbios.c:66
#define NRC_BRIDGE
Definition: nb30.h:76
#define NCBCALL
Definition: nb30.h:25
#define NCBCHAINSEND
Definition: nb30.h:31
DWORD sessionsLen
Definition: netbios.c:65
#define NCBHANGUP
Definition: nb30.h:27
UCHAR ncb_lsn
Definition: nb30.h:151
#define NRC_INVADDRESS
Definition: nb30.h:85
UCHAR ncb_command
Definition: nb30.h:149

Referenced by Netbios().

◆ nbCmdThread()

static DWORD WINAPI nbCmdThread ( LPVOID  lpVoid)
static

Definition at line 763 of file netbios.c.

764 {
765  PNCB ncb = lpVoid;
766 
767  if (ncb)
768  {
769  UCHAR ret;
770  NetBIOSAdapter *adapter = nbGetAdapter(ncb->ncb_lana_num);
771 
772  if (adapter)
773  ret = nbDispatch(adapter, ncb);
774  else
775  ret = NRC_BRIDGE;
776  ncb->ncb_retcode = ncb->ncb_cmd_cplt = ret;
777  if (ncb->ncb_post)
778  ncb->ncb_post(ncb);
779  else if (ncb->ncb_event)
780  SetEvent(ncb->ncb_event);
781  }
782  return 0;
783 }
static NetBIOSAdapter * nbGetAdapter(UCHAR lana)
Definition: netbios.c:330
Definition: nb30.h:148
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:679
unsigned char UCHAR
Definition: xmlstorage.h:181
int ret
HANDLE ncb_event
Definition: nb30.h:167
UCHAR ncb_lana_num
Definition: nb30.h:160
static UCHAR nbDispatch(NetBIOSAdapter *adapter, PNCB ncb)
Definition: netbios.c:699
#define NRC_BRIDGE
Definition: nb30.h:76
UCHAR ncb_cmd_cplt
Definition: nb30.h:161
UCHAR ncb_retcode
Definition: nb30.h:150

Referenced by Netbios().

◆ nbDispatch()

static UCHAR nbDispatch ( NetBIOSAdapter adapter,
PNCB  ncb 
)
static

Definition at line 699 of file netbios.c.

700 {
701  UCHAR ret, cmd;
702 
703  TRACE(": adapter %p, ncb %p\n", adapter, ncb);
704 
705  if (!adapter) return NRC_BRIDGE;
706  if (!ncb) return NRC_INVADDRESS;
707 
708  cmd = ncb->ncb_command & 0x7f;
709  if (cmd == NCBRESET)
710  ret = nbReset(adapter, ncb);
711  else
712  {
713  ret = NBCmdQueueAdd(adapter->cmdQueue, ncb);
714  if (ret == NRC_GOODRET)
715  {
716  switch (cmd)
717  {
718  case NCBCALL:
719  ret = nbCall(adapter, ncb);
720  break;
721 
722  /* WinNT doesn't chain sends, it always sends immediately.
723  * Doubt there's any real significance to the NA variants.
724  */
725  case NCBSEND:
726  case NCBSENDNA:
727  case NCBCHAINSEND:
728  case NCBCHAINSENDNA:
729  ret = nbSend(adapter, ncb);
730  break;
731 
732  case NCBRECV:
733  ret = nbRecv(adapter, ncb);
734  break;
735 
736  case NCBHANGUP:
737  ret = nbHangup(adapter, ncb);
738  break;
739 
740  case NCBASTAT:
741  ret = nbAStat(adapter, ncb);
742  break;
743 
744  case NCBFINDNAME:
745  if (adapter->transport->findName)
746  ret = adapter->transport->findName(adapter->impl.data,
747  ncb);
748  else
749  ret = NRC_ILLCMD;
750  break;
751 
752  default:
753  FIXME("(%p): command code 0x%02x\n", ncb, ncb->ncb_command);
754  ret = NRC_ILLCMD;
755  }
756  NBCmdQueueComplete(adapter->cmdQueue, ncb, ret);
757  }
758  }
759  TRACE("returning 0x%02x\n", ret);
760  return ret;
761 }
NetBIOSFindName findName
Definition: netbios.h:155
#define NRC_GOODRET
Definition: nb30.h:52
#define NRC_ILLCMD
Definition: nb30.h:54
Definition: ftp_var.h:139
static UCHAR nbCall(NetBIOSAdapter *adapter, PNCB ncb)
Definition: netbios.c:541
#define NCBCHAINSENDNA
Definition: nb30.h:46
char * cmd
Definition: vfdcmd.c:85
static UCHAR nbAStat(NetBIOSAdapter *adapter, PNCB ncb)
Definition: netbios.c:679
static UCHAR nbRecv(NetBIOSAdapter *adapter, PNCB ncb)
Definition: netbios.c:606
#define NCBSENDNA
Definition: nb30.h:45
UCHAR NBCmdQueueComplete(struct NBCmdQueue *queue, PNCB ncb, UCHAR retcode)
Definition: nbcmdqueue.c:138
#define FIXME(fmt,...)
Definition: debug.h:110
static UCHAR nbReset(NetBIOSAdapter *adapter, PNCB ncb)
Definition: netbios.c:453
static UCHAR nbSend(NetBIOSAdapter *adapter, PNCB ncb)
Definition: netbios.c:586
struct NBCmdQueue * cmdQueue
Definition: netbios.c:63
#define NCBASTAT
Definition: nb30.h:39
#define NCBRESET
Definition: nb30.h:38
#define NCBRECV
Definition: nb30.h:29
#define TRACE(s)
Definition: solgame.cpp:4
NetBIOSTransport * transport
Definition: netbios.c:61
#define NCBSEND
Definition: nb30.h:28
unsigned char UCHAR
Definition: xmlstorage.h:181
int ret
#define NRC_BRIDGE
Definition: nb30.h:76
#define NCBCALL
Definition: nb30.h:25
#define NCBCHAINSEND
Definition: nb30.h:31
NetBIOSAdapterImpl impl
Definition: netbios.c:62
#define NCBHANGUP
Definition: nb30.h:27
#define NRC_INVADDRESS
Definition: nb30.h:85
UCHAR ncb_command
Definition: nb30.h:149
static UCHAR nbHangup(NetBIOSAdapter *adapter, const NCB *ncb)
Definition: netbios.c:643
#define NCBFINDNAME
Definition: nb30.h:49
UCHAR NBCmdQueueAdd(struct NBCmdQueue *queue, PNCB ncb)
Definition: nbcmdqueue.c:70

Referenced by nbCmdThread(), and Netbios().

◆ nbEnum()

static UCHAR nbEnum ( PNCB  ncb)
static

Definition at line 342 of file netbios.c.

343 {
344  PLANA_ENUM lanas = (PLANA_ENUM)ncb->ncb_buffer;
345  UCHAR i, ret;
346 
347  TRACE(": ncb %p\n", ncb);
348 
349  if (!lanas)
350  ret = NRC_BUFLEN;
351  else if (ncb->ncb_length < sizeof(LANA_ENUM))
352  ret = NRC_BUFLEN;
353  else
354  {
355  nbInternalEnum();
356  lanas->length = 0;
357  for (i = 0; i < gNBTable.tableSize; i++)
358  if (gNBTable.table[i].transport)
359  {
360  lanas->length++;
361  lanas->lana[i] = i;
362  }
363  ret = NRC_GOODRET;
364  }
365  TRACE("returning 0x%02x\n", ret);
366  return ret;
367 }
struct _LANA_ENUM * PLANA_ENUM
#define NRC_GOODRET
Definition: nb30.h:52
NetBIOSAdapter * table
Definition: netbios.c:74
UCHAR length
Definition: nb30.h:140
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static void nbInternalEnum(void)
Definition: netbios.c:258
#define TRACE(s)
Definition: solgame.cpp:4
WORD ncb_length
Definition: nb30.h:154
NetBIOSTransport * transport
Definition: netbios.c:61
static NetBIOSAdapterTable gNBTable
Definition: netbios.c:80
unsigned char UCHAR
Definition: xmlstorage.h:181
int ret
#define NRC_BUFLEN
Definition: nb30.h:53
UCHAR lana[MAX_LANA+1]
Definition: nb30.h:141
PUCHAR ncb_buffer
Definition: nb30.h:153

Referenced by Netbios().

◆ nbGetAdapter()

static NetBIOSAdapter* nbGetAdapter ( UCHAR  lana)
static

Definition at line 330 of file netbios.c.

331 {
333 
334  TRACE(": lana %d, num allocated adapters %d\n", lana, gNBTable.tableSize);
335  if (lana < gNBTable.tableSize && gNBTable.table[lana].transport_id != 0
336  && gNBTable.table[lana].transport)
337  ret = &gNBTable.table[lana];
338  TRACE("returning %p\n", ret);
339  return ret;
340 }
ULONG transport_id
Definition: netbios.c:60
NetBIOSAdapter * table
Definition: netbios.c:74
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
NetBIOSTransport * transport
Definition: netbios.c:61
static NetBIOSAdapterTable gNBTable
Definition: netbios.c:80
int ret

Referenced by nbCmdThread(), Netbios(), and NetBIOSHangupSession().

◆ nbHangup()

static UCHAR nbHangup ( NetBIOSAdapter adapter,
const NCB ncb 
)
static

Definition at line 643 of file netbios.c.

644 {
645  UCHAR ret;
646  NetBIOSSession *session;
647 
648  if (!adapter) return NRC_BRIDGE;
649  if (!ncb) return NRC_INVADDRESS;
650  if (ncb->ncb_lsn >= adapter->sessionsLen) return NRC_SNUMOUT;
651  if (!adapter->sessions[ncb->ncb_lsn].inUse) return NRC_SNUMOUT;
652 
653  session = &adapter->sessions[ncb->ncb_lsn];
654  if (session->state != SESSION_ESTABLISHED)
655  ret = NRC_SNUMOUT;
656  else
657  {
658  session->state = HANGUP_PENDING;
659  ret = nbInternalHangup(adapter, session);
660  }
661  return ret;
662 }
#define SESSION_ESTABLISHED
Definition: nb30.h:19
UCHAR state
Definition: netbios.c:41
#define HANGUP_PENDING
Definition: nb30.h:20
static UCHAR nbInternalHangup(NetBIOSAdapter *adapter, NetBIOSSession *session)
Definition: netbios.c:626
unsigned char UCHAR
Definition: xmlstorage.h:181
#define NRC_SNUMOUT
Definition: nb30.h:58
int ret
NetBIOSSession * sessions
Definition: netbios.c:66
#define NRC_BRIDGE
Definition: nb30.h:76
DWORD sessionsLen
Definition: netbios.c:65
UCHAR ncb_lsn
Definition: nb30.h:151
#define NRC_INVADDRESS
Definition: nb30.h:85

Referenced by nbDispatch(), and NetBIOSHangupSession().

◆ nbInternalEnum()

static void nbInternalEnum ( void  )
static

Definition at line 258 of file netbios.c.

259 {
260  UCHAR i;
261 
263  TRACE("before mark\n");
264  /* mark: */
265  for (i = 0; i < gNBTable.tableSize; i++)
268 
269  TRACE("marked, before store, %d transports\n", gNumTransports);
270  /* store adapters: */
271  for (i = 0; i < gNumTransports; i++)
272  if (gTransports[i].transport.enumerate)
274 
275  TRACE("before sweep\n");
276  /* sweep: */
277  for (i = 0; i < gNBTable.tableSize; i++)
278  if (!gNBTable.table[i].enabled && gNBTable.table[i].transport != 0)
282 }
static NetBIOSTransportTableEntry gTransports[1]
Definition: netbios.c:78
#define TRUE
Definition: types.h:120
NetBIOSAdapter * table
Definition: netbios.c:74
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
CRITICAL_SECTION cs
Definition: netbios.c:70
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define TRACE(s)
Definition: solgame.cpp:4
NetBIOSTransport * transport
Definition: netbios.c:61
static NetBIOSAdapterTable gNBTable
Definition: netbios.c:80
unsigned char UCHAR
Definition: xmlstorage.h:181
static UCHAR gNumTransports
Definition: netbios.c:79
static void nbShutdownAdapter(NetBIOSAdapter *adapter)
Definition: netbios.c:243
NetBIOSTransport transport
Definition: netbios.c:35
NetBIOSEnum enumerate
Definition: netbios.h:153
BOOL enabled
Definition: netbios.c:57
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

Referenced by nbEnum(), Netbios(), NetBIOSEnumAdapters(), and NetBIOSNumAdapters().

◆ nbInternalHangup()

static UCHAR nbInternalHangup ( NetBIOSAdapter adapter,
NetBIOSSession session 
)
static

Definition at line 626 of file netbios.c.

627 {
628  UCHAR ret;
629 
630  if (!adapter) return NRC_BRIDGE;
631  if (!session) return NRC_SNUMOUT;
632 
633  if (adapter->transport->hangup)
634  ret = adapter->transport->hangup(adapter->impl.data, session->data);
635  else
636  ret = NRC_ILLCMD;
637  EnterCriticalSection(&adapter->cs);
638  memset(session, 0, sizeof(NetBIOSSession));
639  LeaveCriticalSection(&adapter->cs);
640  return ret;
641 }
#define NRC_ILLCMD
Definition: nb30.h:54
CRITICAL_SECTION cs
Definition: netbios.c:64
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
NetBIOSHangup hangup
Definition: netbios.h:159
NetBIOSTransport * transport
Definition: netbios.c:61
unsigned char UCHAR
Definition: xmlstorage.h:181
#define NRC_SNUMOUT
Definition: nb30.h:58
int ret
#define NRC_BRIDGE
Definition: nb30.h:76
void * data
Definition: netbios.c:44
NetBIOSAdapterImpl impl
Definition: netbios.c:62
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define memset(x, y, z)
Definition: compat.h:39

Referenced by nbCancel(), nbHangup(), and nbReset().

◆ nbRecv()

static UCHAR nbRecv ( NetBIOSAdapter adapter,
PNCB  ncb 
)
static

Definition at line 606 of file netbios.c.

607 {
608  UCHAR ret;
609  NetBIOSSession *session;
610 
611  if (!adapter) return NRC_BRIDGE;
612  if (!adapter->transport->recv) return NRC_ILLCMD;
613  if (!ncb) return NRC_INVADDRESS;
614  if (ncb->ncb_lsn >= adapter->sessionsLen) return NRC_SNUMOUT;
615  if (!adapter->sessions[ncb->ncb_lsn].inUse) return NRC_SNUMOUT;
616  if (!ncb->ncb_buffer) return NRC_BADDR;
617 
618  session = &adapter->sessions[ncb->ncb_lsn];
619  if (session->state != SESSION_ESTABLISHED)
620  ret = NRC_SNUMOUT;
621  else
622  ret = adapter->transport->recv(adapter->impl.data, session->data, ncb);
623  return ret;
624 }
#define NRC_ILLCMD
Definition: nb30.h:54
#define SESSION_ESTABLISHED
Definition: nb30.h:19
UCHAR state
Definition: netbios.c:41
NetBIOSRecv recv
Definition: netbios.h:158
NetBIOSTransport * transport
Definition: netbios.c:61
unsigned char UCHAR
Definition: xmlstorage.h:181
#define NRC_SNUMOUT
Definition: nb30.h:58
int ret
NetBIOSSession * sessions
Definition: netbios.c:66
#define NRC_BRIDGE
Definition: nb30.h:76
void * data
Definition: netbios.c:44
PUCHAR ncb_buffer
Definition: nb30.h:153
#define NRC_BADDR
Definition: nb30.h:57
DWORD sessionsLen
Definition: netbios.c:65
NetBIOSAdapterImpl impl
Definition: netbios.c:62
UCHAR ncb_lsn
Definition: nb30.h:151
#define NRC_INVADDRESS
Definition: nb30.h:85

Referenced by nbDispatch().

◆ nbReset()

static UCHAR nbReset ( NetBIOSAdapter adapter,
PNCB  ncb 
)
static

Definition at line 453 of file netbios.c.

454 {
455  UCHAR ret;
456 
457  TRACE(": adapter %p, ncb %p\n", adapter, ncb);
458 
459  if (!adapter) return NRC_BRIDGE;
460  if (!ncb) return NRC_INVADDRESS;
461 
462  if (InterlockedIncrement(&adapter->resetting) == 1)
463  {
464  UCHAR i, resizeTo;
465 
466  NBCmdQueueCancelAll(adapter->cmdQueue);
467 
468  EnterCriticalSection(&adapter->cs);
469  for (i = 0; i < adapter->sessionsLen; i++)
470  if (adapter->sessions[i].inUse)
471  nbInternalHangup(adapter, &adapter->sessions[i]);
472  if (!ncb->ncb_lsn)
473  resizeTo = ncb->ncb_callname[0] == 0 ? DEFAULT_NUM_SESSIONS :
474  ncb->ncb_callname[0];
475  else if (adapter->sessionsLen == 0)
476  resizeTo = DEFAULT_NUM_SESSIONS;
477  else
478  resizeTo = 0;
479  if (resizeTo > 0)
480  ret = nbResizeAdapter(adapter, resizeTo);
481  else
482  ret = NRC_GOODRET;
483  LeaveCriticalSection(&adapter->cs);
484  }
485  else
486  ret = NRC_TOOMANY;
487  InterlockedDecrement(&adapter->resetting);
488  TRACE("returning 0x%02x\n", ret);
489  return ret;
490 }
#define NRC_GOODRET
Definition: nb30.h:52
UCHAR ncb_callname[NCBNAMSZ]
Definition: nb30.h:155
CRITICAL_SECTION cs
Definition: netbios.c:64
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static UCHAR nbResizeAdapter(NetBIOSAdapter *adapter, UCHAR sessionsLen)
Definition: netbios.c:427
UCHAR NBCmdQueueCancelAll(struct NBCmdQueue *queue)
Definition: nbcmdqueue.c:167
struct NBCmdQueue * cmdQueue
Definition: netbios.c:63
static UCHAR nbInternalHangup(NetBIOSAdapter *adapter, NetBIOSSession *session)
Definition: netbios.c:626
#define TRACE(s)
Definition: solgame.cpp:4
#define NRC_TOOMANY
Definition: nb30.h:75
unsigned char UCHAR
Definition: xmlstorage.h:181
int ret
#define InterlockedDecrement
Definition: armddk.h:52
NetBIOSSession * sessions
Definition: netbios.c:66
#define NRC_BRIDGE
Definition: nb30.h:76
LONG resetting
Definition: netbios.c:59
#define InterlockedIncrement
Definition: armddk.h:53
DWORD sessionsLen
Definition: netbios.c:65
UCHAR ncb_lsn
Definition: nb30.h:151
#define NRC_INVADDRESS
Definition: nb30.h:85
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define DEFAULT_NUM_SESSIONS
Definition: netbios.c:30

Referenced by nbDispatch().

◆ nbResizeAdapter()

static UCHAR nbResizeAdapter ( NetBIOSAdapter adapter,
UCHAR  sessionsLen 
)
static

Definition at line 427 of file netbios.c.

428 {
430 
431  if (adapter && adapter->sessionsLen < sessionsLen)
432  {
433  NetBIOSSession *newSessions;
434 
435  if (adapter->sessions)
436  newSessions = HeapReAlloc(GetProcessHeap(),
437  HEAP_ZERO_MEMORY, adapter->sessions, sessionsLen *
438  sizeof(NetBIOSSession));
439  else
440  newSessions = HeapAlloc(GetProcessHeap(),
441  HEAP_ZERO_MEMORY, sessionsLen * sizeof(NetBIOSSession));
442  if (newSessions)
443  {
444  adapter->sessions = newSessions;
445  adapter->sessionsLen = sessionsLen;
446  }
447  else
449  }
450  return ret;
451 }
#define NRC_GOODRET
Definition: nb30.h:52
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned char UCHAR
Definition: xmlstorage.h:181
int ret
NetBIOSSession * sessions
Definition: netbios.c:66
#define HeapReAlloc
Definition: compat.h:393
DWORD sessionsLen
Definition: netbios.c:65
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define NRC_OSRESNOTAV
Definition: nb30.h:81

Referenced by nbReset().

◆ nbResizeAdapterTable()

static UCHAR nbResizeAdapterTable ( UCHAR  newSize)
static

Definition at line 82 of file netbios.c.

83 {
84  UCHAR ret;
85 
86  if (gNBTable.table)
89  newSize * sizeof(NetBIOSAdapter));
90  else
92  HEAP_ZERO_MEMORY, newSize * sizeof(NetBIOSAdapter));
93  if (gNBTable.table)
94  {
95  gNBTable.tableSize = newSize;
96  ret = NRC_GOODRET;
97  }
98  else
100  return ret;
101 }
#define NRC_GOODRET
Definition: nb30.h:52
NetBIOSAdapter * table
Definition: netbios.c:74
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static NetBIOSAdapterTable gNBTable
Definition: netbios.c:80
unsigned char UCHAR
Definition: xmlstorage.h:181
int ret
#define HeapReAlloc
Definition: compat.h:393
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define NRC_OSRESNOTAV
Definition: nb30.h:81

Referenced by NetBIOSRegisterAdapter().

◆ nbSend()

static UCHAR nbSend ( NetBIOSAdapter adapter,
PNCB  ncb 
)
static

Definition at line 586 of file netbios.c.

587 {
588  UCHAR ret;
589  NetBIOSSession *session;
590 
591  if (!adapter) return NRC_BRIDGE;
592  if (!adapter->transport->send) return NRC_ILLCMD;
593  if (!ncb) return NRC_INVADDRESS;
594  if (ncb->ncb_lsn >= adapter->sessionsLen) return NRC_SNUMOUT;
595  if (!adapter->sessions[ncb->ncb_lsn].inUse) return NRC_SNUMOUT;
596  if (!ncb->ncb_buffer) return NRC_BADDR;
597 
598  session = &adapter->sessions[ncb->ncb_lsn];
599  if (session->state != SESSION_ESTABLISHED)
600  ret = NRC_SNUMOUT;
601  else
602  ret = adapter->transport->send(adapter->impl.data, session->data, ncb);
603  return ret;
604 }
#define NRC_ILLCMD
Definition: nb30.h:54
#define SESSION_ESTABLISHED
Definition: nb30.h:19
UCHAR state
Definition: netbios.c:41
NetBIOSSend send
Definition: netbios.h:157
NetBIOSTransport * transport
Definition: netbios.c:61
unsigned char UCHAR
Definition: xmlstorage.h:181
#define NRC_SNUMOUT
Definition: nb30.h:58
int ret
NetBIOSSession * sessions
Definition: netbios.c:66
#define NRC_BRIDGE
Definition: nb30.h:76
void * data
Definition: netbios.c:44
PUCHAR ncb_buffer
Definition: nb30.h:153
#define NRC_BADDR
Definition: nb30.h:57
DWORD sessionsLen
Definition: netbios.c:65
NetBIOSAdapterImpl impl
Definition: netbios.c:62
UCHAR ncb_lsn
Definition: nb30.h:151
#define NRC_INVADDRESS
Definition: nb30.h:85

Referenced by nbDispatch().

◆ nbShutdownAdapter()

static void nbShutdownAdapter ( NetBIOSAdapter adapter)
static

Definition at line 243 of file netbios.c.

244 {
245  if (adapter)
246  {
247  adapter->shuttingDown = TRUE;
248  NBCmdQueueCancelAll(adapter->cmdQueue);
249  if (adapter->transport->cleanupAdapter)
250  adapter->transport->cleanupAdapter(adapter->impl.data);
251  NBCmdQueueDestroy(adapter->cmdQueue);
252  adapter->cs.DebugInfo->Spare[0] = 0;
253  DeleteCriticalSection(&adapter->cs);
254  memset(adapter, 0, sizeof(NetBIOSAdapter));
255  }
256 }
void NBCmdQueueDestroy(struct NBCmdQueue *queue)
Definition: nbcmdqueue.c:189
#define TRUE
Definition: types.h:120
CRITICAL_SECTION cs
Definition: netbios.c:64
UCHAR NBCmdQueueCancelAll(struct NBCmdQueue *queue)
Definition: nbcmdqueue.c:167
struct NBCmdQueue * cmdQueue
Definition: netbios.c:63
NetBIOSCleanupAdapter cleanupAdapter
Definition: netbios.h:160
BOOL shuttingDown
Definition: netbios.c:58
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
NetBIOSTransport * transport
Definition: netbios.c:61
PCRITICAL_SECTION_DEBUG DebugInfo
Definition: winbase.h:859
NetBIOSAdapterImpl impl
Definition: netbios.c:62
#define memset(x, y, z)
Definition: compat.h:39
DWORD_PTR Spare[8/sizeof(DWORD_PTR)]
Definition: winbase.h:852

Referenced by nbInternalEnum().

◆ nbSStat()

static UCHAR nbSStat ( NetBIOSAdapter adapter,
PNCB  ncb 
)
static

Definition at line 492 of file netbios.c.

493 {
494  UCHAR ret, i, spaceFor;
495  PSESSION_HEADER sstat;
496 
497  TRACE(": adapter %p, NCB %p\n", adapter, ncb);
498 
499  if (!adapter) return NRC_BADDR;
500  if (adapter->sessionsLen == 0) return NRC_ENVNOTDEF;
501  if (!ncb) return NRC_INVADDRESS;
502  if (!ncb->ncb_buffer) return NRC_BADDR;
503  if (ncb->ncb_length < sizeof(SESSION_HEADER)) return NRC_BUFLEN;
504 
505  sstat = (PSESSION_HEADER)ncb->ncb_buffer;
506  ret = NRC_GOODRET;
507  memset(sstat, 0, sizeof(SESSION_HEADER));
508  spaceFor = (ncb->ncb_length - sizeof(SESSION_HEADER)) /
509  sizeof(SESSION_BUFFER);
510  EnterCriticalSection(&adapter->cs);
511  for (i = 0; ret == NRC_GOODRET && i < adapter->sessionsLen; i++)
512  {
513  if (adapter->sessions[i].inUse && (ncb->ncb_name[0] == '*' ||
514  !memcmp(ncb->ncb_name, adapter->sessions[i].local_name, NCBNAMSZ)))
515  {
516  if (sstat->num_sess < spaceFor)
517  {
519 
520  buf = (PSESSION_BUFFER)((PUCHAR)sstat + sizeof(SESSION_HEADER)
521  + sstat->num_sess * sizeof(SESSION_BUFFER));
522  buf->lsn = i;
523  buf->state = adapter->sessions[i].state;
524  memcpy(buf->local_name, adapter->sessions[i].local_name,
525  NCBNAMSZ);
526  memcpy(buf->remote_name, adapter->sessions[i].remote_name,
527  NCBNAMSZ);
528  buf->rcvs_outstanding = buf->sends_outstanding = 0;
529  sstat->num_sess++;
530  }
531  else
532  ret = NRC_BUFLEN;
533  }
534  }
535  LeaveCriticalSection(&adapter->cs);
536 
537  TRACE("returning 0x%02x\n", ret);
538  return ret;
539 }
#define NRC_GOODRET
Definition: nb30.h:52
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
CRITICAL_SECTION cs
Definition: netbios.c:64
unsigned char * PUCHAR
Definition: retypes.h:3
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
UCHAR state
Definition: netbios.c:41
struct _SESSION_HEADER * PSESSION_HEADER
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define NRC_ENVNOTDEF
Definition: nb30.h:80
#define NCBNAMSZ
Definition: nb30.h:7
#define TRACE(s)
Definition: solgame.cpp:4
WORD ncb_length
Definition: nb30.h:154
struct _SESSION_HEADER SESSION_HEADER
unsigned char UCHAR
Definition: xmlstorage.h:181
int ret
UCHAR remote_name[NCBNAMSZ]
Definition: netbios.c:43
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
NetBIOSSession * sessions
Definition: netbios.c:66
UCHAR local_name[NCBNAMSZ]
Definition: netbios.c:42
struct _SESSION_BUFFER SESSION_BUFFER
#define NRC_BUFLEN
Definition: nb30.h:53
PUCHAR ncb_buffer
Definition: nb30.h:153
#define NRC_BADDR
Definition: nb30.h:57
DWORD sessionsLen
Definition: netbios.c:65
UCHAR ncb_name[NCBNAMSZ]
Definition: nb30.h:156
struct _SESSION_BUFFER * PSESSION_BUFFER
#define NRC_INVADDRESS
Definition: nb30.h:85
UCHAR num_sess
Definition: nb30.h:179
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define memset(x, y, z)
Definition: compat.h:39

Referenced by Netbios().

◆ Netbios()

UCHAR WINAPI Netbios ( PNCB  ncb)

Definition at line 785 of file netbios.c.

786 {
787  UCHAR ret, cmd;
788 
789  TRACE("ncb = %p\n", ncb);
790 
791  if (!ncb) return NRC_INVADDRESS;
792 
793  TRACE("ncb_command 0x%02x, ncb_lana_num %d, ncb_buffer %p, ncb_length %d\n",
794  ncb->ncb_command, ncb->ncb_lana_num, ncb->ncb_buffer, ncb->ncb_length);
795  cmd = ncb->ncb_command & 0x7f;
796 
797  if (cmd == NCBENUM)
798  ncb->ncb_retcode = ncb->ncb_cmd_cplt = ret = nbEnum(ncb);
799  else if (cmd == NCBADDNAME)
800  {
801  FIXME("NCBADDNAME: stub, returning success\n");
802  ncb->ncb_retcode = ncb->ncb_cmd_cplt = ret = NRC_GOODRET;
803  }
804  else
805  {
806  NetBIOSAdapter *adapter;
807 
808  /* Apps not specifically written for WinNT won't do an NCBENUM first,
809  * so make sure the table has been enumerated at least once
810  */
811  if (!gNBTable.enumerated)
812  nbInternalEnum();
813  adapter = nbGetAdapter(ncb->ncb_lana_num);
814  if (!adapter)
815  ret = NRC_BRIDGE;
816  else
817  {
818  if (adapter->shuttingDown)
819  ret = NRC_IFBUSY;
820  else if (adapter->resetting)
821  ret = NRC_TOOMANY;
822  else
823  {
824  /* non-asynch commands first */
825  if (cmd == NCBCANCEL)
826  ncb->ncb_retcode = ncb->ncb_cmd_cplt = ret =
827  nbCancel(adapter, ncb);
828  else if (cmd == NCBSSTAT)
829  ncb->ncb_retcode = ncb->ncb_cmd_cplt = ret =
830  nbSStat(adapter, ncb);
831  else
832  {
833  if (ncb->ncb_command & ASYNCH)
834  {
837 
838  if (thread != NULL)
839  {
840  ncb->ncb_retcode = ncb->ncb_cmd_cplt = NRC_PENDING;
841  if (ncb->ncb_event)
842  ResetEvent(ncb->ncb_event);
845  ret = NRC_GOODRET;
846  }
847  else
848  ncb->ncb_retcode = ncb->ncb_cmd_cplt = ret =
850  }
851  else
852  ncb->ncb_retcode = ncb->ncb_cmd_cplt = ret =
853  nbDispatch(adapter, ncb);
854  }
855  }
856  }
857  }
858  TRACE("returning 0x%02x\n", ret);
859  return ret;
860 }
#define NRC_IFBUSY
Definition: nb30.h:74
#define CloseHandle
Definition: compat.h:398
static UCHAR nbSStat(NetBIOSAdapter *adapter, PNCB ncb)
Definition: netbios.c:492
#define NRC_GOODRET
Definition: nb30.h:52
#define NCBENUM
Definition: nb30.h:43
Definition: ftp_var.h:139
static NetBIOSAdapter * nbGetAdapter(UCHAR lana)
Definition: netbios.c:330
char * cmd
Definition: vfdcmd.c:85
#define NCBCANCEL
Definition: nb30.h:41
#define NCBADDNAME
Definition: nb30.h:36
#define CREATE_SUSPENDED
Definition: winbase.h:178
#define NCBSSTAT
Definition: nb30.h:40
static void nbInternalEnum(void)
Definition: netbios.c:258
#define FIXME(fmt,...)
Definition: debug.h:110
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:112
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
BOOL shuttingDown
Definition: netbios.c:58
#define ASYNCH
Definition: nb30.h:51
#define NRC_PENDING
Definition: nb30.h:90
WORD ncb_length
Definition: nb30.h:154
#define NRC_TOOMANY
Definition: nb30.h:75
static NetBIOSAdapterTable gNBTable
Definition: netbios.c:80
static DWORD WINAPI nbCmdThread(LPVOID lpVoid)
Definition: netbios.c:763
static HANDLE thread
Definition: service.c:33
unsigned char UCHAR
Definition: xmlstorage.h:181
int ret
HANDLE ncb_event
Definition: nb30.h:167
UCHAR ncb_lana_num
Definition: nb30.h:160
static UCHAR nbDispatch(NetBIOSAdapter *adapter, PNCB ncb)
Definition: netbios.c:699
#define NRC_BRIDGE
Definition: nb30.h:76
LONG resetting
Definition: netbios.c:59
UCHAR ncb_cmd_cplt
Definition: nb30.h:161
static UCHAR nbEnum(PNCB ncb)
Definition: netbios.c:342
static UCHAR nbCancel(NetBIOSAdapter *adapter, PNCB ncb)
Definition: netbios.c:371
PUCHAR ncb_buffer
Definition: nb30.h:153
BOOL WINAPI DECLSPEC_HOTPATCH ResetEvent(IN HANDLE hEvent)
Definition: synch.c:660
#define NRC_INVADDRESS
Definition: nb30.h:85
DWORD WINAPI ResumeThread(IN HANDLE hThread)
Definition: thread.c:529
UCHAR ncb_command
Definition: nb30.h:149
#define NRC_OSRESNOTAV
Definition: nb30.h:81
UCHAR ncb_retcode
Definition: nb30.h:150

Referenced by SvcNetBiosReset().

◆ NetBIOSEnableAdapter()

void NetBIOSEnableAdapter ( UCHAR  lana)

Definition at line 231 of file netbios.c.

232 {
233  TRACE(": %d\n", lana);
234  if (lana < gNBTable.tableSize)
235  {
237  if (gNBTable.table[lana].transport != 0)
238  gNBTable.table[lana].enabled = TRUE;
240  }
241 }
#define TRUE
Definition: types.h:120
NetBIOSAdapter * table
Definition: netbios.c:74
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
CRITICAL_SECTION cs
Definition: netbios.c:70
#define TRACE(s)
Definition: solgame.cpp:4
NetBIOSTransport * transport
Definition: netbios.c:61
static NetBIOSAdapterTable gNBTable
Definition: netbios.c:80
BOOL enabled
Definition: netbios.c:57
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

Referenced by NetBTEnumCallback().

◆ NetBIOSEnumAdapters()

void NetBIOSEnumAdapters ( ULONG  transport,
NetBIOSEnumAdaptersCallback  cb,
void closure 
)

Definition at line 296 of file netbios.c.

298 {
299  TRACE("transport 0x%08x, callback %p, closure %p\n", transport, cb,
300  closure);
301  if (cb)
302  {
303  BOOL enumAll = memcmp(&transport, ALL_TRANSPORTS, sizeof(ULONG)) == 0;
304  UCHAR i, numLANAs = 0;
305 
307  if (!gNBTable.enumerating)
308  {
310  nbInternalEnum();
312  }
313  for (i = 0; i < gNBTable.tableSize; i++)
314  if (enumAll || gNBTable.table[i].transport_id == transport)
315  numLANAs++;
316  if (numLANAs > 0)
317  {
318  UCHAR lanaIndex = 0;
319 
320  for (i = 0; i < gNBTable.tableSize; i++)
321  if (gNBTable.table[i].transport_id != 0 &&
322  (enumAll || gNBTable.table[i].transport_id == transport))
323  cb(numLANAs, lanaIndex++, gNBTable.table[i].transport_id,
324  &gNBTable.table[i].impl, closure);
325  }
327  }
328 }
ULONG transport_id
Definition: netbios.c:60
#define TRUE
Definition: types.h:120
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
NetBIOSAdapter * table
Definition: netbios.c:74
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
CRITICAL_SECTION cs
Definition: netbios.c:70
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int BOOL
Definition: ntddk_ex.h:94
static void nbInternalEnum(void)
Definition: netbios.c:258
#define TRACE(s)
Definition: solgame.cpp:4
static NetBIOSAdapterTable gNBTable
Definition: netbios.c:80
static DWORD cb
Definition: integrity.c:41
unsigned char UCHAR
Definition: xmlstorage.h:181
NetBIOSAdapterImpl impl
Definition: netbios.c:62
unsigned int ULONG
Definition: retypes.h:1
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define ALL_TRANSPORTS
Definition: nb30.h:23

Referenced by NetBTEnum(), and NetWkstaTransportEnum().

◆ NetBIOSHangupSession()

void NetBIOSHangupSession ( const NCB ncb)

Definition at line 664 of file netbios.c.

665 {
666  NetBIOSAdapter *adapter;
667 
668  if (!ncb) return;
669 
670  adapter = nbGetAdapter(ncb->ncb_lana_num);
671  if (adapter)
672  {
673  if (ncb->ncb_lsn < adapter->sessionsLen &&
674  adapter->sessions[ncb->ncb_lsn].inUse)
675  nbHangup(adapter, ncb);
676  }
677 }
static NetBIOSAdapter * nbGetAdapter(UCHAR lana)
Definition: netbios.c:330
UCHAR ncb_lana_num
Definition: nb30.h:160
NetBIOSSession * sessions
Definition: netbios.c:66
DWORD sessionsLen
Definition: netbios.c:65
UCHAR ncb_lsn
Definition: nb30.h:151
static UCHAR nbHangup(NetBIOSAdapter *adapter, const NCB *ncb)
Definition: netbios.c:643

Referenced by NetBTRecv(), and NetBTSend().

◆ NetBIOSInit()

void NetBIOSInit ( void  )

Public functions

Definition at line 103 of file netbios.c.

104 {
105  memset(&gNBTable, 0, sizeof(gNBTable));
107  gNBTable.cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": NetBIOSAdapterTable.cs");
108 }
#define DWORD_PTR
Definition: treelist.c:76
CRITICAL_SECTION cs
Definition: netbios.c:70
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:697
static NetBIOSAdapterTable gNBTable
Definition: netbios.c:80
PCRITICAL_SECTION_DEBUG DebugInfo
Definition: winbase.h:859
#define memset(x, y, z)
Definition: compat.h:39
DWORD_PTR Spare[8/sizeof(DWORD_PTR)]
Definition: winbase.h:852

Referenced by DllMain().

◆ NetBIOSNumAdapters()

UCHAR NetBIOSNumAdapters ( void  )

Definition at line 284 of file netbios.c.

285 {
286  UCHAR ret, i;
287 
288  if (!gNBTable.enumerated)
289  nbInternalEnum();
290  for (i = 0, ret = 0; i < gNBTable.tableSize; i++)
291  if (gNBTable.table[i].transport != 0)
292  ret++;
293  return ret;
294 }
NetBIOSAdapter * table
Definition: netbios.c:74
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static void nbInternalEnum(void)
Definition: netbios.c:258
NetBIOSTransport * transport
Definition: netbios.c:61
static NetBIOSAdapterTable gNBTable
Definition: netbios.c:80
unsigned char UCHAR
Definition: xmlstorage.h:181
int ret

Referenced by NetWkstaTransportEnum().

◆ NetBIOSRegisterAdapter()

BOOL NetBIOSRegisterAdapter ( ULONG  transport,
DWORD  ifIndex,
void data 
)

Definition at line 175 of file netbios.c.

176 {
177  BOOL ret;
178  UCHAR i;
179 
180  TRACE(": transport 0x%08x, ifIndex 0x%08x, data %p\n", transport, ifIndex,
181  data);
182  for (i = 0; i < gNumTransports && gTransports[i].id != transport; i++)
183  ;
184  if ((i < gNumTransports) && gTransports[i].id == transport)
185  {
186  NetBIOSTransport *transportPtr = &gTransports[i].transport;
187 
188  TRACE(": found transport %p for id 0x%08x\n", transportPtr, transport);
189 
191  ret = FALSE;
192  for (i = 0; i < gNBTable.tableSize &&
193  gNBTable.table[i].transport != 0; i++)
194  ;
195  if (i == gNBTable.tableSize && gNBTable.tableSize < MAX_LANA + 1)
196  {
197  UCHAR newSize;
198 
200  newSize = gNBTable.tableSize + ADAPTERS_INCR;
201  else
202  newSize = MAX_LANA + 1;
203  nbResizeAdapterTable(newSize);
204  }
205  if (i < gNBTable.tableSize && gNBTable.table[i].transport == 0)
206  {
207  TRACE(": registering as LANA %d\n", i);
208  gNBTable.table[i].transport_id = transport;
209  gNBTable.table[i].transport = transportPtr;
210  gNBTable.table[i].impl.lana = i;
211  gNBTable.table[i].impl.ifIndex = ifIndex;
215  gNBTable.table[i].cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": NetBIOSAdapterTable.NetBIOSAdapter.cs");
217  ret = TRUE;
218  }
220  }
221  else
222  ret = FALSE;
223  TRACE("returning %d\n", ret);
224  return ret;
225 }
static NetBIOSTransportTableEntry gTransports[1]
Definition: netbios.c:78
struct NBCmdQueue * NBCmdQueueCreate(HANDLE heap)
Definition: nbcmdqueue.c:53
ULONG transport_id
Definition: netbios.c:60
#define TRUE
Definition: types.h:120
#define DWORD_PTR
Definition: treelist.c:76
CRITICAL_SECTION cs
Definition: netbios.c:64
#define MAX_LANA
Definition: nb30.h:8
NetBIOSAdapter * table
Definition: netbios.c:74
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
CRITICAL_SECTION cs
Definition: netbios.c:70
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int BOOL
Definition: ntddk_ex.h:94
struct NBCmdQueue * cmdQueue
Definition: netbios.c:63
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:697
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
NetBIOSTransport * transport
Definition: netbios.c:61
static NetBIOSAdapterTable gNBTable
Definition: netbios.c:80
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
PCRITICAL_SECTION_DEBUG DebugInfo
Definition: winbase.h:859
unsigned char UCHAR
Definition: xmlstorage.h:181
int ret
static UCHAR gNumTransports
Definition: netbios.c:79
NetBIOSTransport transport
Definition: netbios.c:35
NetBIOSAdapterImpl impl
Definition: netbios.c:62
BOOL enabled
Definition: netbios.c:57
static UCHAR nbResizeAdapterTable(UCHAR newSize)
Definition: netbios.c:82
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define ADAPTERS_INCR
Definition: netbios.c:29
DWORD_PTR Spare[8/sizeof(DWORD_PTR)]
Definition: winbase.h:852

Referenced by NetBTRegisterAdapter().

◆ NetBIOSRegisterTransport()

BOOL NetBIOSRegisterTransport ( ULONG  id,
NetBIOSTransport transport 
)

Definition at line 131 of file netbios.c.

132 {
133  BOOL ret;
134 
135  TRACE(": transport 0x%08x, p %p\n", id, transport);
136  if (!transport)
137  ret = FALSE;
138  else if (gNumTransports >= sizeof(gTransports) / sizeof(gTransports[0]))
139  {
140  FIXME("Too many transports %d\n", gNumTransports + 1);
141  ret = FALSE;
142  }
143  else
144  {
145  UCHAR i;
146 
147  ret = FALSE;
148  for (i = 0; !ret && i < gNumTransports; i++)
149  {
150  if (gTransports[i].id == id)
151  {
152  WARN("Replacing NetBIOS transport ID %d\n", id);
153  memcpy(&gTransports[i].transport, transport,
154  sizeof(NetBIOSTransport));
155  ret = TRUE;
156  }
157  }
158  if (!ret)
159  {
161  memcpy(&gTransports[gNumTransports].transport, transport,
162  sizeof(NetBIOSTransport));
163  gNumTransports++;
164  ret = TRUE;
165  }
166  }
167  TRACE("returning %d\n", ret);
168  return ret;
169 }
static NetBIOSTransportTableEntry gTransports[1]
Definition: netbios.c:78
#define TRUE
Definition: types.h:120
#define WARN(fmt,...)
Definition: debug.h:111
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int BOOL
Definition: ntddk_ex.h:94
#define FIXME(fmt,...)
Definition: debug.h:110
#define TRACE(s)
Definition: solgame.cpp:4
unsigned char UCHAR
Definition: xmlstorage.h:181
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static UCHAR gNumTransports
Definition: netbios.c:79
GLenum GLuint id
Definition: glext.h:5579

Referenced by NetBTInit().

◆ NetBIOSShutdown()

void NetBIOSShutdown ( void  )

Definition at line 110 of file netbios.c.

111 {
112  UCHAR i;
113 
115  for (i = 0; i < gNBTable.tableSize; i++)
116  {
117  if (gNBTable.table[i].transport &&
121  }
122  for (i = 0; i < gNumTransports; i++)
123  if (gTransports[i].transport.cleanup)
126  gNBTable.cs.DebugInfo->Spare[0] = 0;
129 }
static NetBIOSTransportTableEntry gTransports[1]
Definition: netbios.c:78
NetBIOSAdapter * table
Definition: netbios.c:74
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
CRITICAL_SECTION cs
Definition: netbios.c:70
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
NetBIOSCleanupAdapter cleanupAdapter
Definition: netbios.h:160
#define GetProcessHeap()
Definition: compat.h:395
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
NetBIOSTransport * transport
Definition: netbios.c:61
static NetBIOSAdapterTable gNBTable
Definition: netbios.c:80
PCRITICAL_SECTION_DEBUG DebugInfo
Definition: winbase.h:859
unsigned char UCHAR
Definition: xmlstorage.h:181
static UCHAR gNumTransports
Definition: netbios.c:79
NetBIOSCleanup cleanup
Definition: netbios.h:161
NetBIOSTransport transport
Definition: netbios.c:35
NetBIOSAdapterImpl impl
Definition: netbios.c:62
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define HeapFree(x, y, z)
Definition: compat.h:394
DWORD_PTR Spare[8/sizeof(DWORD_PTR)]
Definition: winbase.h:852

Referenced by DllMain().

◆ NetpNetBiosStatusToApiStatus()

DWORD WINAPI NetpNetBiosStatusToApiStatus ( DWORD  nrc)

Definition at line 862 of file netbios.c.

863 {
864  DWORD ret;
865 
866  switch (nrc)
867  {
868  case NRC_GOODRET:
869  ret = NO_ERROR;
870  break;
871  case NRC_NORES:
873  break;
874  case NRC_DUPNAME:
876  break;
877  case NRC_NAMTFUL:
879  break;
880  case NRC_ACTSES:
882  break;
883  case NRC_REMTFUL:
885  break;
886  case NRC_NOCALL:
888  break;
889  case NRC_NOWILD:
891  break;
892  case NRC_INUSE:
894  break;
895  case NRC_NAMERR:
897  break;
898  case NRC_NAMCONF:
900  break;
901  default:
903  }
904  return ret;
905 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define NRC_GOODRET
Definition: nb30.h:52
#define NRC_NAMTFUL
Definition: nb30.h:63
#define NERR_NameNotFound
Definition: lmerr.h:123
#define ERROR_REM_NOT_LIST
Definition: winerror.h:143
#define NERR_DuplicateName
Definition: lmerr.h:142
#define NO_ERROR
Definition: dderror.h:5
#define NRC_NAMCONF
Definition: nb30.h:73
#define NERR_AlreadyExists
Definition: lmerr.h:126
unsigned long DWORD
Definition: ntddk_ex.h:95
#define NRC_REMTFUL
Definition: nb30.h:66
int ret
#define NRC_NAMERR
Definition: nb30.h:71
#define NRC_NOWILD
Definition: nb30.h:69
#define NRC_DUPNAME
Definition: nb30.h:62
#define NERR_DeleteLater
Definition: lmerr.h:143
#define NRC_INUSE
Definition: nb30.h:70
#define NRC_ACTSES
Definition: nb30.h:64
#define NERR_TooManyNames
Definition: lmerr.h:127
#define NERR_NoNetworkResource
Definition: lmerr.h:10
#define NRC_NORES
Definition: nb30.h:59
#define NRC_NOCALL
Definition: nb30.h:68
#define NERR_NetworkError
Definition: lmerr.h:24

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( netbios  )

Variable Documentation

◆ gNBTable

◆ gNumTransports

UCHAR gNumTransports = 0
static

◆ gTransports

NetBIOSTransportTableEntry gTransports[1]
static