home *** CD-ROM | disk | FTP | other *** search
/ Borland Programmer's Resource / Borland_Programmers_Resource_CD_1995.iso / winsock / wsmtpd16 / net.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-19  |  4.1 KB  |  116 lines

  1. /* Net.H - Include file for NET.C */
  2. #ifndef NET_H
  3. #define NET_H
  4.  
  5. #include "WsmtpSrv.h"
  6.  
  7. /* Messages sent by WSA calls to NetProc */
  8. #define NET_BASE     1
  9. #define NET_ACTIVITY NET_BASE
  10. #define NET_NAME     NET_BASE+1
  11.  
  12. #define SMTP_NAME       "smtp"          /* try a database lookup first! */
  13. #define SMTP_PORT       IPPORT_SMTP     /* 25 - The one and only SMTP port */
  14.  
  15.  
  16. // Structure to hold the WSA error and its Resource String ID
  17. typedef struct
  18. {
  19.  int iError;
  20.  int iResourceID;
  21. } NETERROR;
  22.  
  23. // Structure that holds help topic Resource string
  24. typedef struct
  25. {
  26.  PSTR pTopic;
  27.  int  iResourceID;
  28. } HELPTOPIC;
  29.  
  30.  
  31. #ifdef NET_C
  32.  
  33. // Globals for Net.C only
  34.  
  35. static SOCKET sSocketMain;          // Main Accepting socket
  36. static char szNetworkClass[40];     // Network window class name
  37. static char szMainBuffer[MAXSNDBUFF];  // Temporary string buffer
  38.  
  39.     // Day/Month strings
  40. static LPSTR lpDaysOfTheWeek[] =
  41. {
  42.  "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat",
  43.  "Today"
  44. };
  45.  
  46. static LPSTR lpMonthsOfTheYear[] =
  47. {
  48.  "Jan", "Feb", "Mar", "Apr", "May", "June",
  49.  "July","Aug", "Sep", "Oct", "Nov", "Dec",
  50.  "This-Month"
  51. };
  52.  
  53. // Equivalence table for all net errors
  54. // Bad form, should have used the error number as the
  55. // actual resource ID... but I'm too lazy to go back
  56. // and change it.
  57. NETERROR netErrorTable[] =
  58. {
  59.  {WSANOTINITIALISED,     ERROR_WSANOTINITIALISED    },
  60.  {WSAENETDOWN,           ERROR_WSAENETDOWN          },
  61.  {WSAENETUNREACH,        ERROR_WSAENETUNREACH       },
  62.  {WSAENETRESET,          ERROR_WSAENETRESET         },
  63.  {WSAECONNABORTED,       ERROR_WSAECONNABORTED      },
  64.  {WSAECONNRESET,         ERROR_WSAECONNRESET        },
  65.  {WSAEACCES,             ERROR_WSAEACCES            },
  66.  {WSAEADDRINUSE,         ERROR_WSAEADDRINUSE        },
  67.  {WSAEADDRNOTAVAIL,      ERROR_WSAEADDRNOTAVAIL     },
  68.  {WSAEALREADY,           ERROR_WSAEALREADY          },
  69.  {WSAEDESTADDRREQ,       ERROR_WSAEDESTADDRREQ      },
  70.  {WSAEMSGSIZE,           ERROR_WSAEMSGSIZE          },
  71.  {WSAEBADF,              ERROR_WSAEBADF             },
  72.  {WSAEFAULT,             ERROR_WSAEFAULT            },
  73.  {WSAEINTR,              ERROR_WSAEINTR             },
  74.  {WSAEINPROGRESS,        ERROR_WSAEINPROGRESS       },
  75.  {WSAEAFNOSUPPORT,       ERROR_WSAEAFNOSUPPORT      },
  76.  {WSAEINVAL,             ERROR_WSAEINVAL            },
  77.  {WSAEMFILE,             ERROR_WSAEMFILE            },
  78.  {WSAENOBUFS,            ERROR_WSAENOBUFS           },
  79.  {WSAEISCONN,            ERROR_WSAEISCONN           },
  80.  {WSAENOTCONN,           ERROR_WSAENOTCONN          },
  81.  {WSAESHUTDOWN,          ERROR_WSAESHUTDOWN         },
  82.  {WSAETOOMANYREFS,       ERROR_WSAETOOMANYREFS      },
  83.  {WSAETIMEDOUT,          ERROR_WSAETIMEDOUT         },
  84.  {WSAECONNREFUSED,       ERROR_WSAECONNREFUSED      },
  85.  {WSAELOOP,              ERROR_WSAELOOP             },
  86.  {WSAENAMETOOLONG,       ERROR_WSAENAMETOOLONG      },
  87.  {WSAEHOSTDOWN,          ERROR_WSAEHOSTDOWN         },
  88.  {WSAEHOSTUNREACH,       ERROR_WSAEHOSTUNREACH      },
  89.  {WSASYSNOTREADY,        ERROR_WSASYSNOTREADY       },
  90.  {WSAVERNOTSUPPORTED,    ERROR_WSAVERNOTSUPPORTED   },
  91.  {WSAHOST_NOT_FOUND,     ERROR_WSAHOST_NOT_FOUND    },
  92.  {WSATRY_AGAIN,          ERROR_WSATRY_AGAIN         },
  93.  {WSANO_RECOVERY,        ERROR_WSANO_RECOVERY       },
  94.  {WSANO_DATA,            ERROR_WSANO_DATA           },
  95.  {WSAENOTSOCK,           ERROR_WSAENOTSOCK          },
  96.  {WSAEPROTOTYPE,         ERROR_WSAEPROTOTYPE        },
  97.  {WSAENOPROTOOPT,        ERROR_WSAENOPROTOOPT       },
  98.  {WSAEPROTONOSUPPORT,    ERROR_WSAEPROTONOSUPPORT   },
  99.  {WSAEOPNOTSUPP,         ERROR_WSAEOPNOTSUPP        },
  100.  {WSAEPFNOSUPPORT,       ERROR_WSAEPFNOSUPPORT      },
  101.  {WSAEWOULDBLOCK,        ERROR_WSAEWOULDBLOCK       },
  102.  {0,                     ERROR_UNKNOWN              }
  103. };
  104. #endif /* NET_C */
  105.  
  106.     /* PROTOTYPES */
  107. BOOL netInit(void);
  108. void netError(void);
  109. LRESULT CALLBACK NetProc(HWND, UINT, WPARAM, LPARAM);
  110. BOOL netGetTimeAndDate(LPSTR, int);
  111. int netSendData(struct tagSMTPCLIENT FAR *);
  112. int netReceiveData(struct tagSMTPCLIENT FAR *);
  113. void netClose(void);
  114.  
  115. #endif /* NET_H */
  116.