home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 15 / CD_ASCQ_15_070894.iso / vrac / wsftp2.zip / WS_FTP.H < prev    next >
C/C++ Source or Header  |  1994-06-03  |  9KB  |  289 lines

  1. /***************************************************************************
  2.   Windows Sockets FTP Client Application Support Module
  3.  
  4.   Written by:
  5.       John A. Junod             Internet: <junodj@gordon-emh2.army.mil>
  6.       267 Hillwood Street                 <zj8549@trotter.usma.edu>
  7.       Martinez, GA 30907      Compuserve: 72321,366 
  8.  
  9.   This program executable and all source code is released into the public
  10.   domain.  It would be nice (but is not required) to give me a little 
  11.   credit for any use of this code.
  12.  
  13.   THE INFORMATION AND CODE PROVIDED IS PROVIDED AS IS WITHOUT WARRANTY 
  14.   OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO 
  15.   THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
  16.   PURPOSE. IN NO EVENT SHALL JOHN A. JUNOD BE LIABLE FOR ANY DAMAGES 
  17.   WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS 
  18.   OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF JOHN A. JUNOD HAS BEEN 
  19.   ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
  20.  
  21. *****************************************************************************/
  22. /*
  23.   MODULE: WS_FTP.H   (main program header file)
  24. */
  25.  
  26. #include <windows.h>
  27.  
  28. // **** Dialog box names
  29. // #define DLG_ABOUT                 510
  30. // #define DLG_HOST                  520
  31. // #define DLG_INPUT                 530
  32. // #define DLG_STATUS                540
  33.  
  34. // **** debug window menu definitions
  35. // may be used by other functions!
  36.  
  37. // under COMMAND popup menu
  38. #define CMD_CONNECT                 1010
  39. #define CMD_CLOSE                   1020
  40.  
  41. #define CMD_CWD                     1040
  42. #define CMD_DELE                    1050
  43. #define CMD_HELP                    1060
  44. #define CMD_LIST                    1070
  45. #define CMD_MKD                     1080
  46. #define CMD_NLST                    1090
  47. #define CMD_PWD                     1100
  48. #define CMD_QUOTE                   1110
  49. #define CMD_RETR                    1120
  50. #define CMD_RMD                     1130
  51. #define CMD_STATUS                  1140
  52. #define CMD_STOR                    1150
  53.  
  54. #define CMD_TYPE_I                  1170
  55. #define CMD_TYPE_A                  1180
  56.  
  57. #define CMD_SHFLAGS                 1200
  58.  
  59. // under OPTIONS popup menu
  60. #define OPT_SETVIEWER               1410
  61.  
  62. #define IDM_ABOUT                   1500
  63. #define IDM_EXIT                    1600
  64.  
  65. // **** main window child window identifiers
  66. // TXT = static text windows
  67. // LST = list boxes
  68. // BTN = push buttons
  69. // RB  = radio buttons
  70.  
  71. // local side child windows
  72. #define TXT_LDIRECTORY              2110
  73. #define LST_LDIRS                   2120
  74. #define LST_LFILES                  2130
  75. #define BTN_LCHANGE                 2140
  76. #define BTN_LMKDIR                  2150
  77. #define BTN_LRMDIR                  2160
  78. #define BTN_LDISPLAY                2170
  79. #define BTN_LRENAME                 2180
  80. #define BTN_LDELETE                 2190
  81.  
  82. // lgk new windows for directory selection
  83.  
  84. #define TXT_LDIRSEL                2191
  85. #define TXT_RDIRSEL                2192
  86.  
  87. // remote side child windows
  88. #define TXT_HOSTNAME                2200
  89. #define TXT_RDIRECTORY              2210
  90. #define LST_RDIRS                   2220
  91. #define LST_RFILES                  2230
  92. #define BTN_RCHANGE                 2240
  93. #define BTN_RMKDIR                  2250
  94. #define BTN_RRMDIR                  2260
  95. #define BTN_RDISPLAY                2270
  96. #define BTN_RRENAME                 2280
  97. #define BTN_RDELETE                 2290
  98.  
  99. // transfer buttons
  100. #define BTN_LOCAL_TO_REMOTE         2310
  101. #define BTN_REMOTE_TO_LOCAL         2320
  102.  
  103. // configuration buttons
  104. #define RB_ASCII                    2410
  105. #define RB_BINARY                   2411
  106. #define RB_L8                       2412
  107.  
  108. // information text windows
  109. #define TXT_STATUS                  2510
  110. #define TXT_RBYTES                  2520
  111. #define TXT_LBYTES                  2530
  112.  
  113. // control buttons
  114. #define BTN_CONNECT                 2610
  115. #define BTN_CLOSE                   2620
  116. // lgk new abort button
  117. #define BTN_ABORT                   2625
  118. #define BTN_LONG                    2630
  119. #define BTN_OPTION                  2635
  120. #define BTN_ABOUT                   2640
  121. #define BTN_EXIT                    2650
  122.  
  123. // input dialog controls
  124. #define DLG_PROMPT                  3010
  125. #define DLG_EDIT                    3020
  126.  
  127. // **** connect dialog box controls
  128. #define DLG_EDT_HOST                4010
  129. #define DLG_EDT_USERID              4020
  130. #define DLG_EDT_PASSWD              4030
  131. #define DLG_HOST_TIMEOUT            4040
  132.  
  133. // **** status dlg identifiers
  134. #define CKB_BELL                    5010
  135. #define CKB_CRSTRIP                 5020
  136. #define CKB_GLOBBING                5030
  137. #define CKB_HASH                    5040
  138. #define CKB_PROMPT                  5050
  139. #define CKB_INTERACTIVE             5060
  140. #define CKB_MCASE                   5070
  141. #define CKB_PORT_CMDS               5080
  142. #define CKB_RECV_UNIQUE             5090
  143. #define CKB_STOR_UNIQUE             5100
  144. #define CKB_VERBOSE                 5110
  145. #define CKB_AUTOSTART               5120
  146. #define BTN_OPTIONS                 5130
  147. #define DLG_MAILADDR                5250
  148.  
  149. #define RB_SHOWCHECKS 8100
  150.  
  151. // **** misc definitions
  152. #define TYPE_I 'I'
  153. #define TYPE_A 'A'
  154. #define TYPE_E 'E'
  155. #define TYPE_L 'L'
  156.  
  157. #define FORM_N 'N'
  158. #define FORM_T 'T'
  159. #define FORM_C 'C'
  160.  
  161. #define MODE_S 'S'
  162. #define MODE_B 'B'
  163. #define MODE_C 'C'
  164.  
  165. #define DBUGWNDCLASS "WSDBUGWNDCLASS"
  166.  
  167. struct win_info {
  168.   HWND hWnd;
  169.   int nLineHeight;
  170.   int nScreenRows;
  171.   int nMemPtr;
  172.   int nVpos;
  173.   GLOBALHANDLE hGMem[100];
  174. };
  175.  
  176. // **** function prototypes
  177.  
  178. int MakeLocalName(LPSTR,LPSTR,LPSTR);
  179. void SaveHostName(LPSTR);
  180. void LoadUserInfo(void);
  181. void DoMainPaint(HWND);
  182. void SaveUserInfo(void);
  183. int StdInput(LPSTR,LPSTR,...);
  184. int StdInputPassword(LPSTR,LPSTR,...);
  185. int GPPS(LPSTR,LPSTR,LPSTR,int);
  186. int WPPS(LPSTR,LPSTR);
  187.  
  188. // in ws_child.c
  189. int CreateSubWindows(HWND,HWND);
  190. int GetLocalDirForWnd(HWND);
  191. LPSTR FindName(LPSTR);
  192. int GetRemoteDirForWnd(HWND);
  193. void ShowOurFlags(void);
  194. int ReadProcessHelp(SOCKET);
  195. void ScrollStatus(int);
  196. void SetStatus(LPSTR);
  197.  
  198. // in ws_con.c
  199. int getreply(SOCKET,LPSTR);
  200. int command(SOCKET socket, char *fmt,...);
  201. char *onoff(BOOL);
  202. int DoSTAT(SOCKET);
  203. int DoCHMOD(SOCKET,LPSTR,LPSTR);
  204. int DoCWD(SOCKET,LPSTR);
  205. int DoDirList(SOCKET,LPSTR);
  206. int DoDELE(SOCKET,LPSTR);
  207. int DoMKD(SOCKET,LPSTR);
  208. int DoPWD(SOCKET);
  209. int DoQUOTE(SOCKET,LPSTR);
  210. int DoRMD(SOCKET,LPSTR);
  211. SOCKET DoConnect(LPSTR);
  212. int DoDirList(SOCKET,LPSTR);
  213. int SendFile(SOCKET,LPSTR,LPSTR,char);
  214. int RetrieveFile(SOCKET,LPSTR,LPSTR,LPSTR,char);
  215. SOCKET DoClose(SOCKET sockfd);
  216. int SendPacket(SOCKET,LPSTR);
  217. int ReadDisplayLine(SOCKET);
  218. int ReadLine(SOCKET);
  219. SOCKET GetFTPListenSocket(SOCKET sockfd);
  220. int SendMass(SOCKET,LPSTR filename,BOOL);
  221. int ReadMass(SOCKET,LPSTR filename,LPSTR shortname,BOOL);
  222.  
  223. // in ws_ip.c
  224. SOCKET connectsock(char *host,char *service,char *protocol);
  225. SOCKET connectTCP(char *host,char *service);
  226. SOCKET connectUDP(char *host,char *service);
  227. int sendstr(SOCKET sockfd,LPSTR ptr,int nbytes);
  228.  
  229. int CreateDebugWindow(HWND hMainWnd,HWND hInst);
  230. LRESULT CALLBACK DebugWndProc(HWND hWnd,UINT Message,WPARAM wParam,LPARAM lParam);
  231.  
  232. // in ws_error.c
  233. LPSTR ReturnWSError(UINT Err,LPSTR lpszBuf);
  234. void ReportWSError(LPSTR lpszMsg,UINT Err);
  235. VOID ReportWindowWSError(struct win_info *Window,LPSTR lpszMsg,UINT nErr);
  236.  
  237. // in ws_main.c
  238. LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
  239. BOOL CALLBACK WS_AboutMsgProc(HWND, UINT, WPARAM, LPARAM);
  240. BOOL CALLBACK WS_HostMsgProc(HWND, UINT, WPARAM, LPARAM);
  241. BOOL CALLBACK WS_InputMsgProc(HWND, UINT, WPARAM, LPARAM);
  242. BOOL CALLBACK WS_StatMsgProc(HWND, UINT, WPARAM, LPARAM);
  243. int nCwRegisterClasses(void);
  244. void cwCenter(HWND, int);
  245. void CwUnRegisterClasses(void);
  246.  
  247. // in ws_paint.c
  248. int GetLocalInfo(void);
  249. void ReleaseDisplayMem(VOID);
  250. void ReleaseWindowMem(struct win_info *);
  251. void DoAddLine(LPSTR);
  252. void DoAddWindowLine(struct win_info *,LPSTR);
  253. void DoPrintf(char *fmt,...);
  254. void DoWindowPrintf(struct win_info *,char *,...);
  255. void DoWindowPaint(struct win_info *);
  256.  
  257. #define DLG_HOST_NAME               105
  258. #define DLG_HOST_ADDRESS            106
  259. #define DLG_HOST_TYPE               107
  260. #define DLG_HOST_USERID             108
  261. #define DLG_HOST_PASSWORD           109
  262. #define DLG_HOST_DIR                110
  263. #define DLG_HOST_ANONY              111
  264. #define DLG_HOST_SAVE               112
  265. #define DLG_HOST_PWD                113
  266. #define DLG_HOST_GATEWAY            114
  267.  
  268. #define HOST_TYPE_AUTO               6000
  269. #define HOST_TYPE_CHAMELEON          6001
  270. #define HOST_TYPE_PCTCP              6002
  271. #define HOST_TYPE_IBM_TCP            6003
  272. #define HOST_TYPE_IBM_VM             6004
  273. #define HOST_TYPE_NOS                6005
  274. #define HOST_TYPE_NCSA               6006
  275. #define HOST_TYPE_SINTFTPD           6007
  276. #define HOST_TYPE_SUPER              6008
  277. #define HOST_TYPE_U5000              6009
  278. #define HOST_TYPE_UNIX               6010
  279. #define HOST_TYPE_VMS_MULTINET       6011
  280. #define HOST_TYPE_VMS_UCX            6012
  281. #define HOST_TYPE_QVT                6013
  282. #define HOST_TYPE_WINDOWS_NT         6014
  283. #define HOST_TYPE_SOLARIS            6015
  284.  
  285.  
  286. #define DLG_BTN_SAVE                101
  287. #define DLG_BTN_DEL                 102
  288. #define IDC_STATIC                  -1
  289.