home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 2 / amigaformatcd02.iso / comms / netsoftware / nethandler.lha / NetHandler / server / netdnet.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-09-16  |  2.1 KB  |  96 lines

  1. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
  2. * |_o_o|\\ Copyright (c) 1988 The Software Distillery.  All Rights Reserved *
  3. * |. o.| ||          Written by Doug Walker                                 *
  4. * | .  | ||          The Software Distillery                                *
  5. * | o  | ||          235 Trillingham Lane                                   *
  6. * |  . |//           Cary, NC 27513                                         *
  7. * ======             BBS:(919)-471-6436                                     *
  8. \* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  9.  
  10. #include "netdnet.h"
  11. #include "server.h"
  12.  
  13. #if CPR
  14. char *dbgwind = "CON:0/0/640/160/NETDNET-SERVER/a";
  15. #endif
  16.  
  17. #if 0
  18. int ReSync(global, ioptr)
  19. GLOBAL global;
  20. APTR ioptr;
  21. {
  22.    char c;
  23.    BUG(("ReSync: Entry\n"))
  24.  
  25.    if(ioptr)
  26.    {
  27.       DEof((struct DChannel *)ioptr);
  28.  
  29.       if(DRead((struct DChannel *)ioptr, &c, 1) == 1) return(0);
  30.    }
  31.    WaitPort(global->n.d.LisPort);
  32.    if(!(global->n.devptr = (APTR)DAccept(global->n.d.LisPort)) )
  33.    {
  34.       BUG(("Failed\n"))
  35.       return(1);
  36.    }
  37.    BUG(("Succeeded!\n"))
  38.    return(0);
  39. }
  40. #else
  41. int ReSync(global, ioptr)
  42. GLOBAL global;
  43. APTR ioptr;
  44. {
  45.    return(1);
  46. }
  47. #endif
  48.  
  49. int InitRDevice(global)
  50. GLOBAL global;
  51. {
  52.    BUGP("InitRDevice: Entry")
  53.  
  54.    global->n.d.LisPort = DListen(PORT_FHANDLER);
  55.  
  56.    WaitPort(global->n.port);
  57.    ReplyMsg(GetMsg(global->n.port));  /* Tell DNET we are here */
  58.  
  59.    if(!global->n.d.LisPort)
  60.    {
  61.       BUG(("InitRDevice: Can't init, LisPort %lx\n", global->n.d.LisPort));
  62.       BUGR("Null LisPort");
  63.       return(1);
  64.    }
  65.  
  66.    /* Wait for a DNET request */
  67.    Wait(1<<global->n.d.LisPort->mp_SigBit);
  68.  
  69.    if(!(global->n.devptr = (APTR)DAccept(global->n.d.LisPort)))
  70.    {
  71.       BUG(("InitRDevice: Can't DAccept\n"))
  72.       BUGR("No DAccept")
  73.    }
  74.  
  75.    global->n.histimeout = DNETTIMEOUT;
  76.    global->n.mytimeout  = 0;
  77.  
  78.    BUGP("InitRDevice: Exit")
  79.  
  80.    return(0);
  81. }
  82.  
  83. int TermRDevice(global)
  84. GLOBAL global;
  85. {
  86.    
  87.    if(global->n.d.LisPort)
  88.    {
  89.       DNAAccept(global->n.d.LisPort);
  90.       DUnListen(global->n.d.LisPort);
  91.    }
  92.    DeletePort(global->n.devport);
  93.    return(0);
  94. }
  95.  
  96.