home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / Linux / Magazine / wwwoffle-2.1.tar.gz / wwwoffle-2.1 / proto.h < prev    next >
C/C++ Source or Header  |  1998-02-10  |  3KB  |  76 lines

  1. /***************************************
  2.   $Header: /home/amb/wwwoffle/RCS/proto.h 1.7 1998/02/10 19:17:33 amb Exp $
  3.  
  4.   WWWOFFLE - World Wide Web Offline Explorer - Version 2.1.
  5.   Information about the protocols that wwwoffle supports.
  6.   ******************/ /******************
  7.   Written by Andrew M. Bishop
  8.  
  9.   This file Copyright 1997,98 Andrew M. Bishop
  10.   It may be distributed under the GNU Public License, version 2, or
  11.   any higher version.  See section COPYING of the GNU Public license
  12.   for conditions under which this file may be redistributed.
  13.   ***************************************/
  14.  
  15.  
  16. #ifndef PROTO_H
  17. #define PROTO_H    /*+ To stop multiple inclusions. +*/
  18.  
  19. #include "misc.h"
  20.  
  21. /*+ A type to contain the information that is required for a particular protocol. +*/
  22. typedef struct _Protocol
  23. {
  24.  int number;                    /*+ The protocol number. +*/
  25.  char *name;                    /*+ The protocol name. +*/
  26.  
  27.  int defport;                   /*+ The default port number. +*/
  28.  
  29.  int proxyable;                 /*+ Set to true if any known proxies can understand this. +*/
  30.  
  31.  char*(*open)(URL*);            /*+ A function to open a connection to a remote server. +*/
  32.  char*(*request)(URL*,char*,char*); /*+ A function to make a request to the remote server. +*/
  33.  char*(*readhead)(char*);       /*+ A function to read a line of data from the reply header. +*/
  34.  int(*readbody)(char*,int);     /*+ A function to read the data from the reply body. +*/
  35.  int(*close)(void);             /*+ A function to close the connection to the remote server. +*/
  36. }
  37. Protocol;
  38.  
  39. #define Protocol_HTTP    0      /*+ The http protocol. +*/
  40. #define Protocol_FTP     1      /*+ The ftp protocol. +*/
  41. #define Protocol_Finger  2      /*+ The finger protocol. +*/
  42.  
  43. /* In proto.c */
  44.  
  45. /*+ The list of protocols. +*/
  46. extern Protocol Protocols[];
  47.  
  48. /*+ The number of protocols. +*/
  49. extern int NProtocols;
  50.  
  51. /* In http.c */
  52.  
  53. char *HTTP_Open(URL *Url);
  54. char *HTTP_Request(URL *Url,char *request_head,char *request_body);
  55. char *HTTP_ReadHead(char *line);
  56. int   HTTP_ReadBody(char *s,int n);
  57. int   HTTP_Close(void);
  58.  
  59. /* In ftp.c */
  60.  
  61. char *FTP_Open(URL *Url);
  62. char *FTP_Request(URL *Url,char *request_head,char *request_body);
  63. char *FTP_ReadHead(char *line);
  64. int   FTP_ReadBody(char *s,int n);
  65. int   FTP_Close(void);
  66.  
  67. /* In finger.c */
  68.  
  69. char *Finger_Open(URL *Url);
  70. char *Finger_Request(URL *Url,char *request_head,char *request_body);
  71. char *Finger_ReadHead(char *line);
  72. int   Finger_ReadBody(char *s,int n);
  73. int   Finger_Close(void);
  74.  
  75. #endif /* PROTO_H */
  76.