home *** CD-ROM | disk | FTP | other *** search
/ Super Net 1 / SUPERNET_1.iso / PC / OTROS / MSDOS / NCSA / TEL2307S.ZIP / NET14 / INIT14.C next >
Encoding:
C/C++ Source or Header  |  1993-11-11  |  2.8 KB  |  92 lines

  1. #ifdef __TURBOC__
  2. #include "turboc.h"
  3. #endif
  4. #include <stdio.h>
  5. #include <conio.h>
  6. #include <string.h>
  7. #include <stdlib.h>
  8. #include <malloc.h>
  9. #include <dos.h>
  10. #include <ctype.h>
  11. #include <errno.h>
  12. #ifdef MSC
  13. #include <direct.h>
  14. #include <signal.h>
  15. #include <time.h>
  16. #endif
  17.  
  18.  
  19. #ifdef MEMORY_DEBUG
  20. #include "memdebug.h"
  21. #endif
  22. #include "netevent.h"
  23. #include "hostform.h"
  24. #include "whatami.h"
  25. #include "version.h"
  26. #include "externs.h"
  27.  
  28. /* #define DEBUG */
  29.  
  30. /*
  31. *    Global variables
  32. */
  33. extern unsigned char buf[256];
  34. extern unsigned char myipnum[4];           /* the ip number for this machine */
  35.  
  36. #define SERIAL  0x14
  37. #define NUM_COMM_PORTS  4   /* the number of comm. ports supported, remember to change this variable in int14.asm also */
  38.  
  39. extern struct config def;   /* Default settings obtained from host file */
  40. #ifdef QAK
  41.  
  42. extern unsigned char initialized_flags;     /* flags indicating whether a port has been initialized */
  43. extern unsigned char connected_flags;       /* flags indicating whether a port is connected yet */
  44. extern unsigned char opening_flags;         /* flags indicating whether a port is negotiating an open connection */
  45. extern unsigned char port_buffer[NUM_COMM_PORTS][64];    /* four buffers to store the machine name to connect to */
  46. extern unsigned char buffer_offset[NUM_COMM_PORTS];      /* the offset into the buffer currently */
  47. extern int pnum[NUM_COMM_PORTS];                         /* the port number we are connected to */
  48.  
  49. #define PORT_DATA_SIZE      2048        /* this is sort of a guess, might need larger */
  50. #endif
  51.  
  52. /*
  53. *   int14init
  54. *
  55. *   Entry :  none
  56. *
  57. */
  58. int int14init(void)
  59. {
  60. #ifdef QAK
  61.     config = (getenv("CONFIG.TEL"));    /* check for a config.tel in the environment */
  62.     if(config)                  /* set a different config.tel file */
  63.         Shostfile(config);
  64. #endif
  65.  
  66.     puts("National Center for Supercomputing Applications");    /* put the banner on the screen */
  67.     puts("Interrupt 14h driver");
  68.     puts(N14_VERSION);
  69.  
  70.     if(Snetinit()) {            /* call session initialization */
  71. #ifdef QAK
  72.         errhandle();            /* Snetinit() reads config.tel file */
  73. #else
  74.         puts("Snetinit() failed");
  75. #endif
  76.         return(0);
  77.       }
  78.     netgetip(myipnum);          /* get my IP number (in case of BOOTP or RARP) */
  79.     Sgetconfig(&def);       /* get information provided in hosts file */
  80.  
  81. /*
  82. *  Display my Ethernet (or Appletelk) and IP address for the curious people
  83. */
  84.     pcgetaddr(&buf[200],def.address,def.ioaddr);
  85.     printf("My Ethernet address: %x:%x:%x:%x:%x:%x\r\n",buf[200],buf[201],buf[202],buf[203],buf[204],buf[205]);
  86.     printf("My IP address: %d.%d.%d.%d\r\n\n",myipnum[0],myipnum[1],myipnum[2],myipnum[3]);
  87.  
  88.     Stask();                    /* any packets for me? (return ARPs) */
  89.     return(1);      /* inidicate sucessful initialization */
  90. }   /* end int14init() */
  91.  
  92.