ELinks 0.18.0
uri.h File Reference
#include "main/object.h"
#include "protocol/protocol.h"
Include dependency graph for uri.h:

Data Structures

struct  uri
 
struct  uri_list
 

Macros

#define POST_CHAR   1
 
#define POST_CHAR_S   "\001"
 
#define FILE_CHAR   '\002'
 
#define struri(uri)   ((uri)->string)
 
#define foreach_uri(uri, index, list)
 
#define LOWEST_PORT   0
 
#define HIGHEST_PORT   65535
 
#define uri_port_is_valid(port)    (LOWEST_PORT <= (port) && (port) <= HIGHEST_PORT)
 

Typedefs

typedef int uri_errno_T
 
typedef unsigned int uri_component_T
 

Enumerations

enum  uri_errno {
  URI_ERRNO_OK , URI_ERRNO_EMPTY , URI_ERRNO_INVALID_PROTOCOL , URI_ERRNO_NO_SLASHES ,
  URI_ERRNO_TOO_MANY_SLASHES , URI_ERRNO_TRAILING_DOTS , URI_ERRNO_NO_HOST , URI_ERRNO_NO_PORT_COLON ,
  URI_ERRNO_NO_HOST_SLASH , URI_ERRNO_IPV6_SECURITY , URI_ERRNO_INVALID_PORT , URI_ERRNO_INVALID_PORT_RANGE
}
 
enum  uri_component {
  URI_NONE = 0 , URI_PROTOCOL = (1 << 0) , URI_IP_FAMILY = (1 << 1) , URI_USER = (1 << 2) ,
  URI_PASSWORD = (1 << 3) , URI_HOST = (1 << 4) , URI_PORT = (1 << 5) , URI_DEFAULT_PORT = (1 << 6) ,
  URI_DATA = (1 << 7) , URI_FRAGMENT = (1 << 8) , URI_POST = (1 << 9) , URI_POST_INFO = (1 << 10) ,
  URI_IDN = (1 << 11) , URI_PATH = (1 << 12) , URI_FILENAME = (1 << 13) , URI_QUERY = (1 << 14) ,
  URI_SPECIAL = URI_DEFAULT_PORT | URI_PATH | URI_FILENAME | URI_QUERY , URI_RARE = URI_SPECIAL | URI_POST | URI_POST_INFO | URI_IDN , URI_PUBLIC = ~(URI_PASSWORD | URI_RARE) | URI_POST_INFO , URI_ORIGINAL = ~URI_RARE ,
  URI_BASE = ~(URI_RARE | URI_FRAGMENT) | URI_POST , URI_BASE_FRAGMENT = URI_BASE | URI_FRAGMENT , URI_SERVER = ~(URI_RARE | URI_DATA | URI_FRAGMENT) , URI_HTTP_AUTH = ~(URI_RARE | URI_USER | URI_PASSWORD | URI_DATA | URI_FRAGMENT) ,
  URI_HTTP_HOST = URI_HOST | URI_PORT | URI_IDN , URI_HTTP_REFERRER_HOST = URI_PROTOCOL | URI_HOST | URI_PORT , URI_HTTP_REFERRER = URI_HTTP_REFERRER_HOST | URI_DATA , URI_HTTP_CONNECT = URI_HOST | URI_PORT | URI_DEFAULT_PORT ,
  URI_DIR_LOCATION = URI_PROTOCOL | URI_HOST | URI_PORT | URI_IDN , URI_DNS_HOST = URI_HOST | URI_IDN , URI_HOST_PORT = URI_HOST | URI_PORT , URI_PROXY = ~(URI_RARE | URI_FRAGMENT) | URI_IDN ,
  URI_KEEPALIVE = URI_PROTOCOL | URI_USER | URI_PASSWORD | URI_HOST | URI_PORT , URI_FORM_GET = URI_SERVER | URI_PATH
}
 

Functions

uri_errno_T parse_uri (struct uri *uri, char *uristring)
 
struct uriadd_to_uri_list (struct uri_list *list, struct uri *uri)
 
void free_uri_list (struct uri_list *list)
 
struct uriget_uri (char *string, uri_component_T components)
 
void done_uri (struct uri *uri)
 
static struct uriget_uri_reference (struct uri *uri)
 
struct uriget_composed_uri (struct uri *uri, uri_component_T components)
 
struct uriget_translated_uri (char *uristring, char *cwd)
 
char * normalize_uri (struct uri *uri, char *uristring)
 
int compare_uri (const struct uri *uri1, const struct uri *uri2, uri_component_T components)
 
struct stringadd_uri_to_string (struct string *string, const struct uri *uri, uri_component_T components)
 
struct stringadd_string_uri_to_string (struct string *string, char *uristring, uri_component_T components)
 
char * get_uri_string (const struct uri *uri, uri_component_T components)
 
int get_uri_port (const struct uri *uri)
 
void encode_uri_string (struct string *string, const char *name, int namelen, int convert_slashes)
 
void encode_uri_string_percent (struct string *string, const char *name, int namelen)
 
void encode_win32_uri_string (struct string *string, char *name, int namelen)
 
void decode_uri_string (struct string *string)
 
void decode_uri (char *uristring)
 
void decode_uri_string_for_display (struct string *string)
 
void decode_uri_for_display (char *uristring)
 
char * get_extension_from_uri (struct uri *uri)
 
char * join_urls (struct uri *base, const char *relative)
 
int end_with_known_tld (const char *s, int slen)
 
static int get_real_uri_length (struct uri *uri)
 
int is_ip_address (const char *address, int addresslen)
 
int is_in_domain (char *domain, char *server, int server_len)
 

Macro Definition Documentation

◆ FILE_CHAR

#define FILE_CHAR   '\002'

◆ foreach_uri

#define foreach_uri ( uri,
index,
list )
Value:
for (index = 0; index < (list)->size; index++) \
if ((uri = (list)->uris[index]))
Definition uri.h:29

◆ HIGHEST_PORT

#define HIGHEST_PORT   65535

◆ LOWEST_PORT

#define LOWEST_PORT   0

◆ POST_CHAR

#define POST_CHAR   1

◆ POST_CHAR_S

#define POST_CHAR_S   "\001"

◆ struri

#define struri ( uri)    ((uri)->string)

◆ uri_port_is_valid

#define uri_port_is_valid ( port)     (LOWEST_PORT <= (port) && (port) <= HIGHEST_PORT)

Typedef Documentation

◆ uri_component_T

typedef unsigned int uri_component_T

◆ uri_errno_T

typedef int uri_errno_T

Enumeration Type Documentation

◆ uri_component

Enumerator
URI_NONE 
URI_PROTOCOL 
URI_IP_FAMILY 
URI_USER 
URI_PASSWORD 
URI_HOST 
URI_PORT 
URI_DEFAULT_PORT 
URI_DATA 
URI_FRAGMENT 
URI_POST 
URI_POST_INFO 
URI_IDN 
URI_PATH 
URI_FILENAME 
URI_QUERY 
URI_SPECIAL 
URI_RARE 
URI_PUBLIC 
URI_ORIGINAL 
URI_BASE 
URI_BASE_FRAGMENT 
URI_SERVER 
URI_HTTP_AUTH 
URI_HTTP_HOST 
URI_HTTP_REFERRER_HOST 
URI_HTTP_REFERRER 
URI_HTTP_CONNECT 
URI_DIR_LOCATION 
URI_DNS_HOST 
URI_HOST_PORT 
URI_PROXY 
URI_KEEPALIVE 
URI_FORM_GET 

◆ uri_errno

enum uri_errno
Enumerator
URI_ERRNO_OK 
URI_ERRNO_EMPTY 
URI_ERRNO_INVALID_PROTOCOL 
URI_ERRNO_NO_SLASHES 
URI_ERRNO_TOO_MANY_SLASHES 
URI_ERRNO_TRAILING_DOTS 
URI_ERRNO_NO_HOST 
URI_ERRNO_NO_PORT_COLON 
URI_ERRNO_NO_HOST_SLASH 
URI_ERRNO_IPV6_SECURITY 
URI_ERRNO_INVALID_PORT 
URI_ERRNO_INVALID_PORT_RANGE 

Function Documentation

◆ add_string_uri_to_string()

struct string * add_string_uri_to_string ( struct string * string,
char * uristring,
uri_component_T components )

◆ add_to_uri_list()

struct uri * add_to_uri_list ( struct uri_list * list,
struct uri * uri )

◆ add_uri_to_string()

struct string * add_uri_to_string ( struct string * string,
const struct uri * uri,
uri_component_T components )

◆ compare_uri()

int compare_uri ( const struct uri * uri1,
const struct uri * uri2,
uri_component_T components )

◆ decode_uri()

void decode_uri ( char * uristring)

◆ decode_uri_for_display()

void decode_uri_for_display ( char * uristring)

◆ decode_uri_string()

void decode_uri_string ( struct string * string)

◆ decode_uri_string_for_display()

void decode_uri_string_for_display ( struct string * string)

◆ done_uri()

void done_uri ( struct uri * uri)

◆ encode_uri_string()

void encode_uri_string ( struct string * string,
const char * name,
int namelen,
int convert_slashes )

◆ encode_uri_string_percent()

void encode_uri_string_percent ( struct string * string,
const char * name,
int namelen )

◆ encode_win32_uri_string()

void encode_win32_uri_string ( struct string * string,
char * name,
int namelen )

◆ end_with_known_tld()

int end_with_known_tld ( const char * s,
int slen )

◆ free_uri_list()

void free_uri_list ( struct uri_list * list)

◆ get_composed_uri()

struct uri * get_composed_uri ( struct uri * uri,
uri_component_T components )

◆ get_extension_from_uri()

char * get_extension_from_uri ( struct uri * uri)

◆ get_real_uri_length()

static int get_real_uri_length ( struct uri * uri)
inlinestatic

◆ get_translated_uri()

struct uri * get_translated_uri ( char * uristring,
char * cwd )

◆ get_uri()

struct uri * get_uri ( char * string,
uri_component_T components )

◆ get_uri_port()

int get_uri_port ( const struct uri * uri)

◆ get_uri_reference()

static struct uri * get_uri_reference ( struct uri * uri)
inlinestatic

◆ get_uri_string()

char * get_uri_string ( const struct uri * uri,
uri_component_T components )

◆ is_in_domain()

int is_in_domain ( char * domain,
char * server,
int server_len )

◆ is_ip_address()

int is_ip_address ( const char * address,
int addresslen )

◆ join_urls()

char * join_urls ( struct uri * base,
const char * relative )

◆ normalize_uri()

char * normalize_uri ( struct uri * uri,
char * uristring )

◆ parse_uri()

uri_errno_T parse_uri ( struct uri * uri,
char * uristring )