Exemple #1
0
CMuxVirtualMiniport::CMuxVirtualMiniport(INetCfg *pnc,
                                         GUID    *pguidMiniport,
                                         GUID    *pguidAdapter)
{
    TraceMsg( L"-->CMuxVirtualMiniport::CMuxVirtualMiniport(Constructor).\n" );

    m_pnc = pnc;
    m_pnc->AddRef();

    CopyMemory( &m_guidAdapter,
                pguidAdapter,
                sizeof(GUID) );

    if ( pguidMiniport ) {

        CopyMemory( &m_guidMiniport,
                    pguidMiniport,
                    sizeof(GUID) );

    }
    else {

        ZeroMemory( &m_guidMiniport,
                    sizeof(GUID) );
    }

    TraceMsg( L"<--CMuxVirtualMiniport::CMuxVirtualMiniport(Constructor).\n" );
}
BOOL WINAPI DllMain (HINSTANCE hInstance,
                     DWORD dwReason,
                     LPVOID /*lpReserved*/)
{
	TraceMsg( L"-->DllMain.\n");

	if (dwReason == DLL_PROCESS_ATTACH) {

		TraceMsg( L"   Reason: Attach.\n");

		_Module.Init(ObjectMap, hInstance);

		DisableThreadLibraryCalls(hInstance);
	}
	else if (dwReason == DLL_PROCESS_DETACH) {

		TraceMsg( L"   Reason: Detach.\n");

		   _Module.Term();
	}

	TraceMsg( L"<--DllMain.\n");

	return TRUE;
}
void
ServerInit(TServer * const serverP) {
/*----------------------------------------------------------------------------
   Initialize a server to accept connections.

   Do not confuse this with creating the server -- ServerCreate().

   Not necessary or valid with a server that doesn't accept connections (i.e.
   user supplies the TCP connections).
-----------------------------------------------------------------------------*/
    struct _TServer * const srvP = serverP->srvP;
    abyss_bool success;
    
    if (!srvP->serverAcceptsConnections) {
        TraceMsg("ServerInit() is not valid on a server that doesn't "
                 "accept connections "
                 "(i.e. created with ServerCreateNoAccept)");
        success = FALSE;
    } else {
        if (!srvP->socketBound)
            createAndBindSocket(srvP);

        if (srvP->socketBound) {
            success = SocketListen(srvP->listenSocketP, MAX_CONN);

            if (!success)
                TraceMsg("Failed to listen on bound socket.");
        } else
            success = FALSE;
    }
    if (!success)
        exit(1);
}
static void
createAndBindSocket(struct _TServer * const srvP) {

    abyss_bool success;

    success = SocketInit();
    if (!success)
        TraceMsg("Can't initialize TCP sockets");
    else {
        TSocket * socketP;
        
        SocketUnixCreate(&socketP);
        
        if (!socketP)
            TraceMsg("Can't create a socket");
        else {
            abyss_bool success;
            
            success = SocketBind(socketP, NULL, srvP->port);
            
            if (!success)
                TraceMsg("Failed to bind listening socket to port number %u",
                         srvP->port);
            else {
                srvP->weCreatedListenSocket = TRUE;
                srvP->socketBound = TRUE;
                srvP->listenSocketP = socketP;
            }
            if (!success)
                SocketDestroy(socketP);
        }
    }
}
Exemple #5
0
Fichier : fm.c Projet : palmerc/lab
boolean FileGetSomeBytes (blkhdrtype   *BlkHdr,     farlongtype  FileOffset,
                          unsigned      SomeBytes,
                          ft F,lt Z,zz *Status,     addrtype     BytesAddr)
{
size_t  CheckCount  = 0;
int     SeekStatus  = 0;

    SeekStatus = fseek (BlkHdr->BlkFile, FileOffset, SEEK_SET);
    if (SeekStatus != 0)
    {
        sprintf  (Msg, TraceStr(9),
/* "***FileGetSomeBytes... SeekStatus= %u\n" */
                  SeekStatus);
        TraceMsg  (0,   Msg);
       *Status = File_BadDiskWrite;
    }

    CheckCount = fread (BytesAddr,       SomeBytes,  (size_t )1,
                        BlkHdr->BlkFile);
    if (CheckCount != (int )1)
    {
        sprintf  (Msg, TraceStr(10),
/* "***FileGetSomeBytes... CheckCount= %u\n" */
                  CheckCount);
        TraceMsg  (0,   Msg);
       *Status = File_BadDiskWrite;
    }

    if (SomeBytes == 0)
       *Status = Err_NoBytesMoved;

TRACK(TrackBak,"FileGetSomeBytes\n");
return(STAT);
}
HRESULT CMuxPhysicalAdapter::Remove (VOID)
{
    CMuxVirtualMiniport  *pMiniport = NULL;
    GUID                    guidMiniport;
    DWORD                   dwMiniportCount;
    DWORD                   i;

    TraceMsg( L"-->CMuxPhysicalAdapter::Remove.\n" );

    dwMiniportCount = m_MiniportList.ListCount();

    TraceMsg ( L"   Removing %d miniports.\n",
               dwMiniportCount );

    for (i=0; i < dwMiniportCount; ++i) {

        pMiniport = NULL;
        m_MiniportList.Remove( &pMiniport );
        pMiniport->GetMiniportGUID( &guidMiniport );
        m_MiniportsToRemove.Insert( pMiniport,
                                    guidMiniport );
        pMiniport->DeInstall();
    }

    TraceMsg( L"<--CMuxPhysicalAdapter::Remove(HRESULT = %x).\n",
              S_OK );

    return S_OK;
}
HRESULT CMuxPhysicalAdapter::CancelChanges (VOID)
{
    TraceMsg( L"-->CMuxPhysicalAdapter::CancelChanges.\n" );

    TraceMsg( L"<--CMuxPhysicalAdapter::CancelChanges(HRESULT = %x).\n",
              S_OK );

    return S_OK;
}
Exemple #8
0
CMuxVirtualMiniport::~CMuxVirtualMiniport(VOID)
{
    TraceMsg( L"-->CMuxVirtualMiniport::~CMuxVirtualMiniport(Destructor).\n" );

    ReleaseObj( m_pnc );

    TraceMsg( L"<--CMuxVirtualMiniport::~CMuxVirtualMiniport(Destructor).\n" );

}
Exemple #9
0
HRESULT CMuxVirtualMiniport::LoadConfiguration(VOID)
{
    TraceMsg( L"-->CMuxVirtualMiniport::LoadConfiguration.\n" );

    TraceMsg( L"<--CMuxVirtualMiniport::LoadConfiguration(HRESULT = %x).\n",
            S_OK );

    return S_OK;
}
Exemple #10
0
VOID CMuxVirtualMiniport::GetMiniportGUID (GUID *pguidMiniport)
{
    TraceMsg( L"-->CMuxVirtualMiniport::GetMiniportGUID.\n" );

    CopyMemory( pguidMiniport,
              &m_guidMiniport,
              sizeof(GUID) );

    TraceMsg( L"<--CMuxVirtualMiniport::GetMiniportGUID.\n" );
}
Exemple #11
0
VOID CMuxVirtualMiniport::GetAdapterGUID (GUID *pguidAdapter)
{
    TraceMsg( L"-->CMuxVirtualMiniport::GetAdapterGUID.\n" );

    CopyMemory( pguidAdapter,
                &m_guidAdapter,
                sizeof(GUID) );

    TraceMsg( L"<--CMuxVirtualMiniport::GetAdapterGUID.\n" );
}
VOID CMuxPhysicalAdapter::GetAdapterGUID (GUID *pguidAdapter)
{
    TraceMsg( L"-->CMuxPhysicalAdapter::GetAdapterGUID.\n" );

    CopyMemory( pguidAdapter,
                &m_guidAdapter,
                sizeof(GUID) );

    TraceMsg( L"<--CMuxPhysicalAdapter::GetAdapterGUID.\n" );
}
Exemple #13
0
void Mem_ShowXmemStats       (void)
{
   TraceMsg (0, " Dump of XmemBlkSizeChunk  ::    ");
   DumpChunkChunk (0, XmemBlkSizeChunk);

   TraceMsg (0, "\n Dump of XmemBlkDirChunk   ::    ");
   DumpChunkChunk (0, XmemBlkDirChunk);

return;
}
Exemple #14
0
static void
parsePidfile(const char *      const p,
             struct _TServer * const srvP) {
#ifdef _UNIX
    if (!FileOpenCreate(&srvP->pidfile, p, O_TRUNC | O_WRONLY)) {
        srvP->pidfile = -1;
        TraceMsg("Bad PidFile value '%s'", p);
    };
#else
    TraceMsg("PidFile option ignored");
#endif  /* _UNIX */
}
STDAPI DllCanUnloadNow(void)
{
	HRESULT hr;

	TraceMsg( L"-->DllCanUnloadNow.\n");

	hr = (_Module.GetLockCount() == 0) ? S_OK : S_FALSE;

	TraceMsg( L"-->DllCanUnloadNow(HRESULT = %x).\n",
	        hr );

	return hr;  
}
Exemple #16
0
static void
parsePidfile(const char *      const p,
             struct _TServer * const srvP) {
#ifdef _UNIX
    bool succeeded;
    succeeded = FileOpenCreate(&srvP->pidfileP, p, O_TRUNC | O_WRONLY);
    if (!succeeded) {
        srvP->pidfileP = NULL;
        TraceMsg("Bad PidFile value '%s'", p);
    };
#else
    TraceMsg("PidFile option ignored");
#endif  /* _UNIX */ 
}
Exemple #17
0
HRESULT CMuxVirtualMiniport::ApplyPnpChanges
                                 (INetCfgPnpReconfigCallback *pfCallback,
                                  ConfigAction eApplyAction)
{
    UNREFERENCED_PARAMETER(pfCallback);
    UNREFERENCED_PARAMETER(eApplyAction);

    TraceMsg( L"-->CMuxVirtualMiniport::ApplyPnpChanges.\n" );

    TraceMsg( L"<--CMuxVirtualMiniport::ApplyPnpChanges(HRESULT = %x).\n",
            S_OK );

    return S_OK;
}
/*     14.4.2                                                             */
boolean   List01_NextIn    (tokentype    *ListTkn,    tokentype  *CurrNodeTkn,
                          ft F,lt Z,zz *Status,     tokentype  *NodeTkn,
                          tokentype    *MemberTkn)
{
listheadtype *HeadObj         = NullPtr;
listnodetype *NodeObj         = NullPtr;

 *NodeTkn    = NullToken;
 *MemberTkn  = NullToken;

  if (Normal(*Status))
  if (ListTkn->Handle == NullHandle)
     *Status = List01_NullListTkn;
 
  if (Normal(*Status))
  if (OaGetObject (ListTkn,   McStat,   (addrtype *)&HeadObj))

  if (CurrNodeTkn->Handle == NullHandle)
     *Status = List01_EmptyList;
 
  if (Normal(*Status))
  if (OaGetObject (CurrNodeTkn,   McStat,   (addrtype *)&NodeObj))

  if (NodeObj->NextNode  == NullHandle)
  {
     HeadObj->CurrentNode  =  HeadObj->LastNode;
    *Status = List01_EndOfList;

  } else {
     NodeTkn->DbId   = ListTkn->DbId;
     if ((NodeTkn->Handle = NodeObj->NextNode) != NullHandle)
     if (OaGetObject (NodeTkn,   McStat,   (addrtype *)&NodeObj))
       *MemberTkn          =  NodeObj->NodeObject;

     HeadObj->CurrentNode  =  NodeTkn->Handle;

  }

  if (ListBug ||  DeBug)
  if (sprintf (Msg, "  ListNextOf... Current[%2u,%4u]  Next[%2u,%4u]\n",
               CurrNodeTkn->DbId,    CurrNodeTkn->Handle,
               NodeTkn->DbId,        NodeTkn->Handle))
  if (TraceMsg (0, Msg))
  if (sprintf (Msg, "                Member [%2u,%4u]\n",
               MemberTkn->DbId,      MemberTkn->Handle))
    TraceMsg (0, Msg);
 
TRACK(TrackBak,"List01_NextIn\n");
return (STAT);
}
CMuxPhysicalAdapter::CMuxPhysicalAdapter (INetCfg *pnc,
        GUID *pguidAdapter)
{

    TraceMsg( L"-->CMuxPhysicalAdapter::CMuxPhysicalAdapter(Constructor).\n" );

    m_pnc = pnc;
    m_pnc->AddRef();

    CopyMemory( &m_guidAdapter,
                pguidAdapter,
                sizeof(GUID) );

    TraceMsg( L"<--CMuxPhysicalAdapter::CMuxPhysicalAdapter(Constructor).\n" );
}
abyss_bool
ServerCreateSocket(TServer *    const serverP,
                   const char * const name,
                   TOsSocket    const socketFd,
                   const char * const filesPath,
                   const char * const logFileName) {

    abyss_bool success;
    TSocket * socketP;

    createSocketFromOsSocket(socketFd, &socketP);

    if (socketP) {
        abyss_bool const noAcceptFalse = FALSE;

        const char * error;

        createServer(&serverP->srvP, noAcceptFalse, socketP, 0, &error);

        if (error) {
            TraceMsg(error);
            success = FALSE;
            xmlrpc_strfree(error);
        } else {
            success = TRUE;
            
            setNamePathLog(serverP, name, filesPath, logFileName);
        }
    } else
        success = FALSE;

    return success;
}
abyss_bool
ServerCreate(TServer *    const serverP,
             const char * const name,
             uint16_t     const portNumber,
             const char * const filesPath,
             const char * const logFileName) {

    abyss_bool const noAcceptFalse = FALSE;

    abyss_bool success;
    const char * error;

    createServer(&serverP->srvP, noAcceptFalse, NULL, portNumber, &error);

    if (error) {
        TraceMsg(error);
        xmlrpc_strfree(error);
        success = FALSE;
    } else {
        success = TRUE;
    
        setNamePathLog(serverP, name, filesPath, logFileName);
    }

    return success;
}
boolean Domain_Omi0Invoke
         (char         *Dat_File,         char         *Msg_File,  
          char         *Out_File,         char         *Xmem_File,  
          farlongtype   CorePageSize,     farlongtype   CoreMaxOnPage,
          indextype     AllocFreeAddrs,   indextype     ExtendFreeAddrs,
          indextype     AllocChunks,      indextype     ExtendChunks,
          indextype     AllocXmemBlocks,  indextype     ExtendXmemBlocks,
          indextype     AllocHandles,     indextype     ExtendHandles,
          indextype     AllocVchunks,     indextype     ExtendVchunks,
          indextype     AllocGrps,        indextype     ExtendGrps,
          indextype     AllocDbBlocks,    indextype     ExtendDbBlocks,
          char         *ParmsBuf,         ft F,lt Z,zz *Status)
{
   Domain_OmiInvoke
         (Dat_File,         Msg_File,  
          Out_File,         Xmem_File,  
          CorePageSize,     CoreMaxOnPage,
          AllocFreeAddrs,   ExtendFreeAddrs,
          AllocChunks,      ExtendChunks,
          AllocXmemBlocks,  ExtendXmemBlocks,
          AllocHandles,     ExtendHandles,
          AllocVchunks,     ExtendVchunks,
          AllocGrps,        ExtendGrps,
          AllocDbBlocks,    ExtendDbBlocks,
          McStat);

   TraceMsg(0, ParmsBuf);

TRACK(TrackBak,"Domain_Omi0Invoke\n");
return (STAT);
}
Exemple #23
0
void RemoteGlob(LineListPtr fileList, char *pattern, char *lsFlags)
{
	char *cp;
	LinePtr lp;

	/* Note that we do attempt to use glob characters even if the remote
	 * host isn't UNIX.  Most non-UNIX remote FTP servers look for UNIX
	 * style wildcards.
	 */
	if (GLOBCHARSINSTR(pattern)) {
		/* Use NLST, which lists files one per line. */
		ListToMemory(fileList, "NLST", lsFlags, pattern);
		if ((fileList->first != NULL) && (fileList->first == fileList->last)) {
			/* If we have only one item in the list, see if it really was
			 * an error message we would recognize.
			 */
			cp = strchr(fileList->first->line, ':');
			if ((cp != NULL) && STREQ(cp, ": No such file or directory")) {
				RemoveLine(fileList, fileList->first);
			}
		}
		RemoteGlobCollapse(pattern, fileList);
		if (gTrace == kTracingOn) {
			for (lp=fileList->first; lp != NULL; lp = lp->next)
				TraceMsg("Rglob [%s]\n", lp->line);
		}
	} else {
		/* Or, if there were no globbing characters in 'pattern', then the
		 * pattern is really just a filename.  So for this case the
		 * file list is really just a single file.
		 */
		fileList->first = fileList->last = NULL;
		AddLine(fileList, pattern);
	}
}	/* RemoteGlob */
Exemple #24
0
/*+-----------------------------------------------------------------------+*
 ~L                           DEBUG    
 *+-----------------------------------------------------------------------+*/
boolean    DbmDumpVchunkVchunk
                           (tokentype    *Token,   ft F,lt Z,zz *Status)
{
vchunktkntype VchunkToken;
dbheader     *CoreDb       = NullPtr;

  if (Token->Handle == 0)
  {
     TraceMsg (0,  "  *** NULL Handle to Virtual Chunk.\n");
    *Status = Oa_VchunkNotExist;
  }

  if (Token->DbId    > CoreDbCount)
  {
    *Status = Oa_VchunkNotExist;
  }

  if (Normal(*Status))
  if (TmGetCoreDb      (Token,     McStat,            &CoreDb))
  if (DbmGetVchunkTkn  (Token,     McStat,            &VchunkToken))

  if (Normal(*Status))
  if (VchunkToken.InCore)
     DumpChunkChunk    (0, VchunkToken.InCore);

TRACK(TrackBak,"DbmDumpVchunkVchunk\n");
return (STAT);
}
Exemple #25
0
boolean NamedDrawObj_Create1
                         (tokentype    *Anchor,    numtype       ClassId,
                          nametype      Nam,
                          ft F,lt Z,zz *Status,    tokentype    *Token)
{
numtype        DrawId          = 0;

   if (DeBug || OaBug || ClassBug)
   if (sprintf (Msg,
               "\n NamedDrawObj:: Create Anchor[%3u:%8u];  ClassId=%4u\n",
                Anchor->DbId,  Anchor->Handle, ClassId))
       TraceMsg (0, Msg);

   if (DrawLib01)
      DrawId      =  ++DrawLib01->DrawId;

   if (Normal(*Status))
   if (Object_Create   (Anchor, ClassId,                McStat, Token))
   if (Attr_ValuePut   (Token,  Id_Attr,    (addrtype )&DrawId,     McStat))
   if (Attr_ValuePut   (Token,  Nam_Attr,   (addrtype  )Nam,        McStat))
   {
      if (DrawObjs_AddInto      (&LibTkn010,  Token,  McStat))
          NamedDrawObjs_AddInto (&LibTkn010,  Token,  McStat);
   }

TRACK(TrackBak,"NamedDrawObj_Create1\n");
return (STAT);
}
Exemple #26
0
static void
parseUser(const char *      const p, 
          struct _TServer * const srvP) {
#ifdef _WIN32
    /* *srvP has no 'uid' or 'gid' member; system has no getpwnam() */
    TraceMsg("User option ignored");
#else
    if (p[0] == '#') {
        int32_t n;
        
        if (!ConfReadInt(&p[1], &n, 0, 0))
            TraceExit("Bad user number '%s'", p);
        else
            srvP->uid = n;
    } else {
        struct passwd * pwd;

        if (!(pwd = getpwnam(p)))
            TraceExit("Unknown user '%s'", p);
        
        srvP->uid = pwd->pw_uid;
        if ((int)srvP->gid==(-1))
            srvP->gid = pwd->pw_gid;
    };
#endif
}
Exemple #27
0
boolean  NamedDrawObj_ExportFunc  
                         (tokentype    *Token,   indextype       IterNum,
                          ft F,lt Z,zz *Status)
{
numtype             j      = IterNum;
NamedDrawObj       *r010   = NullPtr;

   if (j == 0 || j % QueBug == 0)
   {
      sprintf (Msg, " Object %4d. Iterate [%3u:%8u]\n",
               IterNum, Token->DbId, Token->Handle);
      TraceMsg (0, Msg);
   }

   if (Object_IsA           (Token,  McStat)   == NamedDrawObj_Class)
   {
      r010 = NamedDrawObj_new2 (Token,              McStat);
      if (r010)
      if (DrawObj_export    ((DrawObj  *)r010,    McStat))
          DrawObj_delete    ((DrawObj **)&r010,   dbFree,    McStat);
   }

TRACK(TrackBak,"NamedDrawObj_ExportFunc\n");
return (STAT);
}
Exemple #28
0
DrawObj  *DrawObj_new1   (tokentype    *AnchorTkn, numtype       ClassId,
                          ft F,lt Z,zz *Status)
{
tokentype       Token  = NullToken;
DrawObj        *Image  = NullPtr;

   if (DeBug || OaBug || ClassBug)
   if (sprintf (Msg, "  DrawObj_New1 Anchor= [%4u:%6u]; ClassId=%4u\n",
                AnchorTkn->DbId, AnchorTkn->Handle, ClassId))
      TraceMsg (0, Msg);

   if (Object_Create   (AnchorTkn,    ClassId,          McStat,   &Token))

   if (Object_GetImage (&Token,       McStat,         (addrtype *)&Image))
   {
      if (DrawLib01)
         Image->Id       = ++DrawLib01->DrawId;
      Image->draw                = NULL;
      Image->area                = NULL;
      Image->destruct            = DrawObj_delete;
   }

   if (Normal(*Status))
      DrawObjs_AddInto (&LibTkn010,  &Token,  McStat);

STAT;
return (Image);
}
Exemple #29
0
abyss_bool
ServerCreateNoAccept(TServer *    const serverP,
                     const char * const name,
                     const char * const filesPath,
                     const char * const logFileName) {

    bool const noAcceptTrue = TRUE;
    bool const userChanSwitchFalse = FALSE;

    bool success;
    const char * error;

    createServer(&serverP->srvP, noAcceptTrue,
                 NULL, userChanSwitchFalse,
                 0, &error);

    if (error) {
        TraceMsg(error);
        success = FALSE;
        xmlrpc_strfree(error);
    } else {
        success = TRUE;
        
        setNamePathLog(serverP, name, filesPath, logFileName);
    }
    return success;
}
Exemple #30
0
boolean NamedDrawObj_Create0
                         (tokentype    *Anchor,
                          ft F,lt Z,zz *Status,    tokentype    *Token)
{
numtype    DrawId   =  0;
static
nametype   Nam      = {"Create0_"};

   if (DrawLib01)
      DrawId   =  ++DrawLib01->DrawId;

   Ut_IntToStr   ((int )DrawId, Nam);

   if (DeBug || OaBug || ClassBug)
   if (sprintf (Msg, "\n NamedDrawObj:: Create [%3u:%8u] = <%s>\n",
                Anchor->DbId,  Anchor->Handle, Nam))
       TraceMsg (0, Msg);

   if (Object_Create   (Anchor, NamedDrawObj_Class,     McStat,     Token))
   if (Attr_ValuePut   (Token,  Id_Attr,    (addrtype )&DrawId,     McStat))
       Attr_ValuePut   (Token,  Nam_Attr,   (addrtype )&Nam,        McStat);

   if (Normal(*Status))
   if (DrawObjs_AddInto      (&LibTkn010,  Token,  McStat))
       NamedDrawObjs_AddInto (&LibTkn010,  Token,  McStat);

TRACK(TrackBak,"NamedDrawObj_Create0\n");
return (STAT);
}