/* Copyright 1997 Acorn Computers Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /***************************************************/ /* File : URLutils.h */ /* */ /* Purpose: URL manipulation for the browser. */ /* */ /* Author : Merlyn Kline for Customer browser */ /* This source adapted by A.D.Hodgkinson */ /* from various original functions */ /* */ /* History: 06-Feb-97: Created. */ /***************************************************/ #include "URI.h" /* URI handler API, in URILib:h */ /* General definitions */ #define Internal_URL "!INTRNL!" /* Special string (i.e. hack...) to mark a URL as internal only. */ #define Int_URL_Len 8 /* Saves having to strlen(Internal_URL) in various places. */ #define ProtocolSeparator "//" #define FileMethod "file:" #define HTTPmethod "http:" #define FTPmethod "ftp:" #define ForExternalHImage "PExtImage" /* (With 'Go back') */ #define ForExternalNImage "PExtImNoH" /* (No 'Go back') */ #define ForScrapFile "ScrapFile" #define ForGoBack "GoBack" #define ForGoRecover "GoRecover" #define ForGoHome "GoHome" /* Structures */ /* If using the URI handler, need to keep an array of all */ /* URIs sent out so that if they get back to the browser */ /* and it can handle them, the browser_data struct (see */ /* below) that they were allocated for and various useful */ /* flags associated with the URI can be recovered. */ /* */ /* In practice, the items are stored in a linked list to */ /* allow easy removal of items without copying memory */ /* around all over the place. */ /* Flags definitions */ #define URIQueue_RecordInHistory (1u<<0) /* Structure for queue entries */ typedef struct uri_queue { unsigned int flags; browser_data * b; URI_handle_t uri_handle; struct uri_queue * prev; struct uri_queue * next; } uri_queue; /* Function prototypes */ void urlutils_pathname_to_url (char * path, int buffersize); void urlutils_url_to_pathname (char * url, int buffersize); void urlutils_translate_pathname (char * path); char * urlutils_leafname_from_url (char * url, char * leaf, int size); void urlutils_host_name_from_url (char * url, char * host, int size); void urlutils_create_hotlist_url (char * buffer, int size); void urlutils_create_home_url (char * buffer, int size); char * urlutils_fix_url (char * buffer, int buffersize); void urlutils_load_uri_file (char * buffer, size_t size, char * path); int urlutils_internal_extra (char * iurl); int urlutils_internal_tail (char * iurl); void urlutils_set_displayed (browser_data * b, char * iurl); int urlutils_check_protocols (char * url); _kernel_oserror * urlutils_dispatch (browser_data * b, char * uri, unsigned int flags); _kernel_oserror * urlutils_remove_from_queue (URI_handle_t uri_handle); uri_queue * urlutils_find_queue_entry (URI_handle_t uri_handle);