Copied missing files from the subversion repository.
[collectd.git] / src / libping / url.h
1 /**
2  * URL support
3  *
4  * Copyright (C) 2000, 2001 Jeffrey Fulmer <jdfulmer@armstrong.com>
5  * This file is part of Siege
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20  * --
21  */
22 #ifndef  URL_H
23 #define  URL_H
24
25 typedef enum
26 {
27   HTTP    = 1,
28   HTTPS   = 2,
29   ECHO    = 4,
30   SMTP    = 8,
31   POP3    = 16,
32   UNSPRTD = 32
33 } PROTOCOL; 
34
35 /**
36  * enum DIRECTIVE
37  * HTTP request directive
38  */
39 typedef enum
40 {
41   URL_GET   = 0,
42   URL_POST  = 1
43 } DIRECTIVE;
44
45 /**
46  * URL struct URL
47  */
48 typedef struct
49 {
50   PROTOCOL protocol;       /* currently only http/https   */
51   char *hostname;          /* DNS entry or IP address     */
52   int  port;               /* tcp port num, defs: 80, 443 */
53   char *pathname;          /* path to http resource.      */
54   DIRECTIVE calltype;      /* request: GET/POST/HEAD etc. */
55   size_t postlen;
56   char *postdata;
57   char *posttemp;
58 } URL;
59
60 int  protocol_length( char *url ); 
61 int  is_supported( char* url );
62 int  get_default_port( PROTOCOL p );
63 PROTOCOL get_protocol( const char *url );
64 void insert_childid( URL *U, int mypid );
65 char *process_post_data( char *datap );
66 URL  build_url( char *url );
67 URL  add_url( char *url );
68
69 #endif/*URL_H*/