1 /********************************************************************
2  * $Author: jgoerzen $
3  * $Revision: 1.2 $
4  * $Date: 2000/12/20 01:19:20 $
5  * $Source: /home/jgoerzen/tmp/gopher-umn/gopher/head/object/url.h,v $
6  * $State: Exp $
7  *
8  * Paul Lindner, University of Minnesota CIS.
9  *
10  * Copyright 1991, 1992 by the Regents of the University of Minnesota
11  * see the file "Copyright" in the distribution for conditions of use.
12  *********************************************************************
13  * MODULE: url.h
14  * Simplified method of getting urls..
15  *********************************************************************
16  * Revision History:
17  * $Log: url.h,v $
18  * Revision 1.2  2000/12/20 01:19:20  jgoerzen
19  * Added patches from David Allen <s2mdalle@titan.vcu.edu>
20  *
21  * Revision 1.1.1.1  2000/08/19 00:28:56  jgoerzen
22  * Import from UMN Gopher 2.3.1 after GPLization
23  *
24  * Revision 3.5  1995/09/25  22:07:25  lindner
25  * Ansification
26  *
27  * Revision 3.4  1995/08/29  07:13:07  lindner
28  * Add tickets to urls
29  *
30  * Revision 3.3  1994/11/13  06:30:12  lindner
31  * Expanded URL parsing routines
32  *
33  * Revision 3.2  1993/11/02  06:14:11  lindner
34  * Add url html hack
35  *
36  *********************************************************************/
37 
38 #ifndef URL_H
39 #define URL_H
40 
41 #include "STRstring.h"
42 #include "util.h"
43 
44 typedef enum {gopher, http, ftp, telnet, tn3270, news, unset,unknown}
45   UrlServiceType;
46 
47 struct url_struct {
48      String*        url;
49      UrlServiceType service;
50 
51 
52      String*        Host;
53      int            Port;
54      String*        Path;
55 
56      String*        User;
57      String*        Pass;
58 
59      /** Gopher specific information **/
60      char           Gtype;
61 
62 };
63 
64 typedef struct url_struct Url;
65 
66 #define URLget(a)     (STRget((a)->url))
67 #define URLset(a,b)   (STRset((a)->url,(b)))
68 
69 #define URLsetGophType(a,b) ((a)->Gtype=(b))
70 #define URLsetPort(a,b)     ((a)->Port=(b))
71 #define URLsetPath(a,b)     (STRset((a)->Path, (b)))
72 #define URLsetHost(a,b)     (STRset((a)->Host, (b)))
73 #define URLsetUser(a,b)     (STRset((a)->User, (b)))
74 #define URLsetPass(a,b)     (STRset((a)->Pass, (b)))
75 #define URLsetService(a,b)  ((a)->service=(b))
76 
77 #include "GSgopherobj.h"
78 UrlServiceType URLgetService();
79 
80 Url  *URLnew();
81 void  URLdestroy();
82 void  URLfromGS(Url *url, GopherObj *gs, char *ticket);
83 void  URLmakeHTML(Url *url);
84 char *URLgetTransport(Url *url);
85 char *URLgetHost(Url *url);
86 int   URLgetPort(Url *url);
87 
88 char  URLgetGophType(Url *url);
89 char *URLgetPath(Url *url);
90 char *URLgetHost(Url *url);
91 int   URLgetPort(Url *url);
92 char *URLgetUser(Url *url);
93 char *URLgetPass(Url *url);
94 
95 #endif /* URL_H */
96