mythtv_plugin/myth_uri.h
branchtrunk
changeset 2 bd3829c2e9c9
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/mythtv_plugin/myth_uri.h	Wed Sep 20 23:59:48 2006 +0100
     1.3 @@ -0,0 +1,63 @@
     1.4 +/**
     1.5 + *
     1.6 + *	MythURI utils
     1.7 + *  - Extracts and parses a URI char string, in according with the RFC 2396 
     1.8 + *    [http://www.ietf.org/rfc/rfc2396.txt]
     1.9 + *
    1.10 + * @author Rosfran Borges (rosfran.borges@indt.org.br)
    1.11 + * 
    1.12 + */
    1.13 +
    1.14 +#ifndef _MYTH_URI_H_
    1.15 +#define _MYTH_URI_H_
    1.16 +
    1.17 +#include <glib.h>
    1.18 +
    1.19 +/****************************************
    1.20 +* Define
    1.21 +****************************************/
    1.22 +
    1.23 +#define MYTH_URI_KNKOWN_PORT (-1)
    1.24 +#define MYTH_URI_DEFAULT_HTTP_PORT 80
    1.25 +#define MYTH_URI_DEFAULT_FTP_PORT 21
    1.26 +#define MYTH_URI_DEFAULT_PATH "/"
    1.27 +#define MYTH_URI_MAXLEN 256
    1.28 +
    1.29 +#define MYTH_URI_PROTOCOL_DELIM "://"
    1.30 +#define MYTH_URI_USER_DELIM "@"
    1.31 +#define MYTH_URI_COLON_DELIM ":"
    1.32 +#define MYTH_URI_SLASH_DELIM "/"
    1.33 +#define MYTH_URI_SBLACET_DELIM "["
    1.34 +#define MYTH_URI_EBLACET_DELIM "]"
    1.35 +#define MYTH_URI_SHARP_DELIM "#"
    1.36 +#define MYTH_URI_QUESTION_DELIM "?"
    1.37 +#define MYTH_URI_ESCAPING_CHAR "%"
    1.38 +
    1.39 +#define MYTH_URI_PROTOCOL_MYTH "myth"
    1.40 +#define MYTH_URI_PROTOCOL_HTTP "http"
    1.41 +#define MYTH_URI_PROTOCOL_FTP "ftp"
    1.42 +
    1.43 +/****************************************
    1.44 +* Data Type
    1.45 +****************************************/
    1.46 +
    1.47 +typedef struct _MythURI {
    1.48 +	GString *uri;
    1.49 +	GString *host;
    1.50 +	gint port;
    1.51 +	GString *protocol;
    1.52 +	GString *path;
    1.53 +	GString *fragment;
    1.54 +	GString *user;
    1.55 +	GString *password;
    1.56 +	GString *query;
    1.57 +} MythURI;
    1.58 +
    1.59 +const MythURI *myth_uri_new( gchar *value );
    1.60 +
    1.61 +#define myth_uri_gethost(urip) (urip->host->str)
    1.62 +#define myth_uri_getport(urip) (urip->port)
    1.63 +#define myth_uri_getprotocol(urip) (urip->protocol->str)
    1.64 +#define myth_uri_getpath(urip) (urip->path->str)
    1.65 +
    1.66 +#endif