rosfran@41
|
1 |
/**
|
rosfran@139
|
2 |
* GMyth Library
|
rosfran@41
|
3 |
*
|
rosfran@139
|
4 |
* @file gmyth/gmyth_uri.h
|
rosfran@139
|
5 |
*
|
rosfran@139
|
6 |
* @brief <p> GMythURI utils
|
rosfran@41
|
7 |
* - Extracts and parses a URI char string, in according with the RFC 2396
|
rosfran@41
|
8 |
* [http://www.ietf.org/rfc/rfc2396.txt]
|
rosfran@139
|
9 |
*
|
rosfran@139
|
10 |
* Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia.
|
rosfran@139
|
11 |
* @author Rosfran Borges <rosfran.borges@indt.org.br>
|
rosfran@41
|
12 |
*
|
rosfran@701
|
13 |
*
|
rosfran@701
|
14 |
* This program is free software; you can redistribute it and/or modify
|
rosfran@701
|
15 |
* it under the terms of the GNU Lesser General Public License as published by
|
rosfran@701
|
16 |
* the Free Software Foundation; either version 2 of the License, or
|
rosfran@701
|
17 |
* (at your option) any later version.
|
rosfran@701
|
18 |
*
|
rosfran@701
|
19 |
* This program is distributed in the hope that it will be useful,
|
rosfran@701
|
20 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
rosfran@701
|
21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
rosfran@701
|
22 |
* GNU General Public License for more details.
|
rosfran@701
|
23 |
*
|
rosfran@701
|
24 |
* You should have received a copy of the GNU Lesser General Public License
|
rosfran@701
|
25 |
* along with this program; if not, write to the Free Software
|
rosfran@701
|
26 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
rosfran@701
|
27 |
*/
|
rosfran@41
|
28 |
|
rosfran@41
|
29 |
#ifndef _GMYTH_URI_H_
|
rosfran@41
|
30 |
#define _GMYTH_URI_H_
|
rosfran@41
|
31 |
|
rosfran@41
|
32 |
#include <glib.h>
|
rosfran@139
|
33 |
#include <glib-object.h>
|
rosfran@139
|
34 |
|
rosfran@139
|
35 |
#include <stdlib.h>
|
rosfran@139
|
36 |
#include <stdio.h>
|
rosfran@139
|
37 |
#include <string.h>
|
rosfran@139
|
38 |
|
rosfran@139
|
39 |
G_BEGIN_DECLS
|
rosfran@139
|
40 |
#define GMYTH_URI_TYPE (gmyth_uri_get_type ())
|
rosfran@139
|
41 |
#define GMYTH_URI(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_URI_TYPE, GMythURI))
|
rosfran@139
|
42 |
#define GMYTH_URI_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_URI_TYPE, GMythURIClass))
|
rosfran@545
|
43 |
#define IS_GMYTH_URI(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GMYTH_URI_TYPE))
|
rosfran@139
|
44 |
#define IS_GMYTH_URI_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_URI_TYPE))
|
rosfran@139
|
45 |
#define GMYTH_URI_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_URI_TYPE, GMythURIClass))
|
rosfran@698
|
46 |
typedef struct _GMythURI GMythURI;
|
rosfran@698
|
47 |
typedef struct _GMythURIClass GMythURIClass;
|
rosfran@41
|
48 |
|
renatofilho@750
|
49 |
/****************************************
|
rosfran@701
|
50 |
* Define
|
rosfran@701
|
51 |
****************************************/
|
rosfran@41
|
52 |
|
rosfran@529
|
53 |
#define GMYTH_URI_KNKOWN_PORT (-1)
|
rosfran@529
|
54 |
#define GMYTH_URI_DEFAULT_HTTP_PORT 80
|
rosfran@529
|
55 |
#define GMYTH_URI_DEFAULT_FTP_PORT 21
|
rosfran@139
|
56 |
#define GMYTH_URI_DEFAULT_PATH "/"
|
rosfran@529
|
57 |
#define GMYTH_URI_MAXLEN 256
|
rosfran@41
|
58 |
|
rosfran@139
|
59 |
#define GMYTH_URI_PROTOCOL_DELIM "://"
|
rosfran@139
|
60 |
#define GMYTH_URI_USER_DELIM "@"
|
rosfran@139
|
61 |
#define GMYTH_URI_COLON_DELIM ":"
|
rosfran@139
|
62 |
#define GMYTH_URI_SLASH_DELIM "/"
|
rosfran@139
|
63 |
#define GMYTH_URI_SBLACET_DELIM "["
|
rosfran@139
|
64 |
#define GMYTH_URI_EBLACET_DELIM "]"
|
rosfran@139
|
65 |
#define GMYTH_URI_SHARP_DELIM "#"
|
rosfran@139
|
66 |
#define GMYTH_URI_QUESTION_DELIM "?"
|
rosfran@279
|
67 |
#define GMYTH_URI_E_DELIM "&"
|
rosfran@139
|
68 |
#define GMYTH_URI_ESCAPING_CHAR "%"
|
rosfran@41
|
69 |
|
rosfran@139
|
70 |
#define GMYTH_URI_PROTOCOL_MYTH "myth"
|
rosfran@139
|
71 |
#define GMYTH_URI_PROTOCOL_HTTP "http"
|
rosfran@139
|
72 |
#define GMYTH_URI_PROTOCOL_FTP "ftp"
|
rosfran@41
|
73 |
|
renatofilho@750
|
74 |
/****************************************
|
rosfran@701
|
75 |
* Data Type
|
rosfran@701
|
76 |
****************************************/
|
rosfran@41
|
77 |
|
rosfran@139
|
78 |
struct _GMythURIClass
|
renatofilho@750
|
79 |
{
|
renatofilho@750
|
80 |
GObjectClass parent_class;
|
rosfran@139
|
81 |
|
renatofilho@750
|
82 |
/* callbacks */
|
renatofilho@750
|
83 |
/* no one for now */
|
renatofilho@750
|
84 |
};
|
rosfran@139
|
85 |
|
rosfran@698
|
86 |
struct _GMythURI
|
renatofilho@750
|
87 |
{
|
rosfran@698
|
88 |
|
renatofilho@750
|
89 |
GObject parent;
|
rosfran@698
|
90 |
|
renatofilho@750
|
91 |
GString *uri;
|
renatofilho@750
|
92 |
GString *host;
|
renatofilho@750
|
93 |
gint port;
|
renatofilho@750
|
94 |
GString *protocol;
|
renatofilho@750
|
95 |
GString *path;
|
renatofilho@750
|
96 |
GString *fragment;
|
renatofilho@750
|
97 |
GString *user;
|
renatofilho@750
|
98 |
GString *password;
|
renatofilho@750
|
99 |
GString *query;
|
rosfran@698
|
100 |
|
renatofilho@750
|
101 |
};
|
rosfran@41
|
102 |
|
renatofilho@750
|
103 |
GType gmyth_uri_get_type(void);
|
renatofilho@750
|
104 |
GMythURI *gmyth_uri_new(void);
|
renatofilho@750
|
105 |
GMythURI *gmyth_uri_new_with_value(const gchar * value);
|
renatofilho@750
|
106 |
gboolean gmyth_uri_is_equals(GMythURI * uri1, GMythURI * uri2);
|
renatofilho@750
|
107 |
gboolean gmyth_uri_is_livetv(GMythURI * uri);
|
renatofilho@750
|
108 |
gint gmyth_uri_get_channel_num(GMythURI * uri);
|
renatofilho@750
|
109 |
gchar *gmyth_uri_get_channel_name(GMythURI * uri);
|
renatofilho@750
|
110 |
char *gmyth_uri_to_string(const GMythURI * uri);
|
renatofilho@750
|
111 |
gboolean gmyth_uri_is_local_file(const GMythURI * uri);
|
rosfran@279
|
112 |
|
rosfran@529
|
113 |
#define gmyth_uri_get_host(urip) ( urip->host != NULL ? urip->host->str : "" )
|
rosfran@529
|
114 |
#define gmyth_uri_get_port(urip) ( urip->port )
|
rosfran@529
|
115 |
#define gmyth_uri_get_protocol(urip) ( urip->protocol != NULL ? urip->protocol->str : "" )
|
rosfran@529
|
116 |
#define gmyth_uri_get_path(urip) ( urip->path != NULL ? urip->path->str : "" )
|
rosfran@529
|
117 |
#define gmyth_uri_get_user(urip) ( urip->user != NULL ? urip->user->str : "" )
|
rosfran@157
|
118 |
#define gmyth_uri_get_password(urip) ( urip->password != NULL ? urip->password->str : "" )
|
rosfran@529
|
119 |
#define gmyth_uri_get_fragment(urip) ( urip->fragment != NULL ? urip->fragment->str : "" )
|
rosfran@529
|
120 |
#define gmyth_uri_get_query(urip) ( urip->query != NULL ? urip->query->str : "" )
|
rosfran@139
|
121 |
|
rosfran@139
|
122 |
G_END_DECLS
|
rosfran@139
|
123 |
#endif /* _GMYTH_URI_H_ */
|