leo_sobral@2: /** leo_sobral@2: * rosfran@40: * GMythURI utils leo_sobral@2: * - Extracts and parses a URI char string, in according with the RFC 2396 leo_sobral@2: * [http://www.ietf.org/rfc/rfc2396.txt] leo_sobral@2: * leo_sobral@2: * @author Rosfran Borges (rosfran.borges@indt.org.br) leo_sobral@2: * leo_sobral@2: */ leo_sobral@2: rosfran@40: #ifndef _GMYTH_URI_H_ rosfran@40: #define _GMYTH_URI_H_ leo_sobral@2: leo_sobral@2: #include leo_sobral@2: leo_sobral@2: /**************************************** leo_sobral@2: * Define leo_sobral@2: ****************************************/ leo_sobral@2: rosfran@40: #define GMYTH_URI_KNKOWN_PORT (-1) rosfran@40: #define GMYTH_URI_DEFAULT_HTTP_PORT 80 rosfran@40: #define GMYTH_URI_DEFAULT_FTP_PORT 21 rosfran@40: #define GMYTH_URI_DEFAULT_PATH "/" rosfran@40: #define GMYTH_URI_MAXLEN 256 leo_sobral@2: rosfran@40: #define GMYTH_URI_PROTOCOL_DELIM "://" rosfran@40: #define GMYTH_URI_USER_DELIM "@" rosfran@40: #define GMYTH_URI_COLON_DELIM ":" rosfran@40: #define GMYTH_URI_SLASH_DELIM "/" rosfran@40: #define GMYTH_URI_SBLACET_DELIM "[" rosfran@40: #define GMYTH_URI_EBLACET_DELIM "]" rosfran@40: #define GMYTH_URI_SHARP_DELIM "#" rosfran@40: #define GMYTH_URI_QUESTION_DELIM "?" rosfran@40: #define GMYTH_URI_ESCAPING_CHAR "%" leo_sobral@2: rosfran@40: #define GMYTH_URI_PROTOCOL_MYTH "myth" rosfran@40: #define GMYTH_URI_PROTOCOL_HTTP "http" rosfran@40: #define GMYTH_URI_PROTOCOL_FTP "ftp" leo_sobral@2: leo_sobral@2: /**************************************** leo_sobral@2: * Data Type leo_sobral@2: ****************************************/ leo_sobral@2: rosfran@40: typedef struct _GMythURI { leo_sobral@2: GString *uri; leo_sobral@2: GString *host; leo_sobral@2: gint port; leo_sobral@2: GString *protocol; leo_sobral@2: GString *path; leo_sobral@2: GString *fragment; leo_sobral@2: GString *user; leo_sobral@2: GString *password; leo_sobral@2: GString *query; rosfran@40: } GMythURI; leo_sobral@2: rosfran@40: const GMythURI *gmyth_uri_new( gchar *value ); leo_sobral@2: rosfran@40: #define gmyth_uri_gethost(urip) (urip->host->str) rosfran@40: #define gmyth_uri_getport(urip) (urip->port) rosfran@40: #define gmyth_uri_getprotocol(urip) (urip->protocol->str) rosfran@40: #define gmyth_uri_getpath(urip) (urip->path->str) leo_sobral@2: leo_sobral@2: #endif