@ GNU AS assembler header file for URL
@ Written by DefMod (Dec  9 2012) on Sun Dec  9 15:46:01 2012
@ Tom Hughes, tom@compton.nu, 18 Apr 1999

@ OSLib---efficient, type-safe, transparent, extensible,
@ register-safe API coverage of RISC OS
@ 
@ Copyright (c) 1994-2012 Jonathan Coxhead and OSLib maintainers
@ 
@ Licence:
@ 
@    OSLib is free software; you can redistribute it and/or modify
@ it under the terms of the GNU General Public License as published by
@ the Free Software Foundation; either version 1, or (at your option)
@ any later version - and this with the following clarification and
@ special exception:
@ 
@    Linking this library statically or dynamically with other modules
@ is making a combined work based on this library. Thus, the terms
@ and conditions of the GNU General Public License cover the whole
@ combination.
@ 
@    As a special exception, the copyright holders of this library
@ give you permission to link this library with independent modules
@ to produce an executable, regardless of the license terms of these
@ independent modules, and to copy and distribute the resulting
@ executable under terms of your choice, provided that you also meet,
@ for each linked independent module, the terms and conditions of the
@ license of that module. An independent module is a module which is
@ not derived from or based on this library. If you modify this
@ library, you may extend this exception to your version of the library,
@ but you are not obliged to do so. If you do not wish to do so, delete
@ this exception statement from your version.
@ 
@    OSLib is distributed in the hope that it will be useful,
@ but WITHOUT ANY WARRANTY; without even the implied warranty of
@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
@ GNU General Public License for more details.
@ 
@    You should have received a copy of the GNU General Public License
@ along with this programme; if not, write to the Free Software
@ Foundation, Inc, 675 Mass Ave, Cambridge, MA 02139, USA.

#ifndef URL_Hdr
#  define URL_Hdr

#  ifndef Get_Types
#    define Get_Types
#    include "oslib/Types.Hdr"
#  endif

#  ifndef Get_OS
#    define Get_OS
#    include "oslib/OS.Hdr"
#  endif

@Symbols for constants
#  define URL_AllSessions 0x0
#  define URL_GetURLUserAgentSupplied 0x1
#  define URL_GetURLDataLengthSupplied 0x2
#  define URL_ParseURLDataLengthSupplied 0x1
#  define URL_ParseURLEscapeControlChars 0x2
#  define URL_MethodCODE 0xff
#  define URL_MethodCodeShift 0x8
#  define URL_MethodFLAGS 0xff00
#  define URL_MethodFlagsShift 0x10
#  define URL_GET 0x1
#  define URL_HEAD 0x2
#  define URL_OPTIONS 0x3
#  define URL_POST 0x4
#  define URL_TRACE 0x5
#  define URL_PUT 0x8
#  define URL_DELETE 0xc
#  define URL_RETR 0x1
#  define URL_LIST 0x1
#  define URL_STOR 0x8
#  define URL_MKD 0x9
#  define URL_RMD 0xa
#  define URL_RNFR 0xb
#  define URL_RNTO 0xb
#  define URL_DELE 0xc
#  define URL_STOU 0xd
#  define URL_Connected 0x1
#  define URL_SentRequest 0x2
#  define URL_SentData 0x4
#  define URL_ResponseReceived 0x8
#  define URL_TransferInProgress 0x10
#  define URL_AllDataReceived 0x20
#  define URL_TransferAborted 0x40
#  define URL_HasProtocolFlags 0x1
#  define URL_HasDefaultPort 0x2
#  define URL_NonUnixPath 0x1
#  define URL_DontParse 0x2
#  define URL_AllowUsername 0x4
#  define URL_AllowHashInHostname 0x8
#  define URL_NoHostname 0x10
#  define URL_RemoveLeadingUpComponents 0x20
#  define Error_URLBadSession 0x80de00
#  define Error_URLNoMemory 0x80de01
#  define Error_URLNoFetcher 0x80de02
#  define Error_URLUnknownSWI 0x80de03
#  define Error_URLBadFetch 0x80de04
#  define Error_URLFetchFinished 0x80de05
#  define Error_URLProtocolClaimed 0x80de06
#  define Error_URLNoFetch 0x80de07
#  define Error_URLBadMessage 0x80de08
#  define Error_URLNotParseable 0x80de0a

@Symbols for structure offsets and sizes
@ abstract type
#  define URL_S 4

        .struct 0
        .skip   Bits
URL_GetURLFlags                : 

        .struct 0
        .skip   Bits
URL_ParseURLFlags              : 

        .struct 0
        .skip   Bits
URL_Method                     : 

        .struct 0
        .skip   Int
URL_MethodCode                 : 

        .struct 0
        .skip   Bits
URL_MethodFlags                : 

        .struct 0
        .skip   Bits
URL_FetchStatus                : 

        .struct 0
URL_Components_full_url        : .skip   Ptr
URL_Components_scheme          : .skip   Ptr
URL_Components_host            : .skip   Ptr
URL_Components_port            : .skip   Ptr
URL_Components_user            : .skip   Ptr
URL_Components_password        : .skip   Ptr
URL_Components_account         : .skip   Ptr
URL_Components_path            : .skip   Ptr
URL_Components_query           : .skip   Ptr
URL_Components_fragment        : .skip   Ptr
URL_Components                 : 

        .struct 0
URL_ComponentSizes_full_url    : .skip   Int
URL_ComponentSizes_scheme      : .skip   Int
URL_ComponentSizes_host        : .skip   Int
URL_ComponentSizes_port        : .skip   Int
URL_ComponentSizes_user        : .skip   Int
URL_ComponentSizes_password    : .skip   Int
URL_ComponentSizes_account     : .skip   Int
URL_ComponentSizes_path        : .skip   Int
URL_ComponentSizes_query       : .skip   Int
URL_ComponentSizes_fragment    : .skip   Int
URL_ComponentSizes             : 

        .struct 0
        .skip   Bits
URL_ProtocolRegisterFlags      : 

        .struct 0
        .skip   Bits
URL_ProtocolFlags              : 


@Symbols for SWI's and SWI reason codes
.set XURL_Register,0xa3e00
.set URL_Register,0x83e00
   @Entry
   @  R0 = flags (Bits)
   @Exit
   @  R0 corrupted
   @  R1 = session (URL_S)

.set XURL_GetURL,0xa3e01
.set URL_GetURL,0x83e01
   @Entry
   @  R0 = flags (URL_GetURLFlags)
   @  R1 = session (URL_S)
   @  R2 = method (URL_Method)
   @  R3 -> url (String)
   @  R4 -> data (data)
   @  R5 = data_length (Int)
   @  R6 -> user_agent (String)
   @Exit
   @  R0 = status (URL_FetchStatus)

.set XURL_Status,0xa3e02
.set URL_Status,0x83e02
   @Entry
   @  R0 = flags (Bits)
   @  R1 = session (URL_S)
   @Exit
   @  R0 = status (URL_FetchStatus)
   @  R2 = response_code (Bits)
   @  R3 = bytes_read (Int)
   @  R4 = total_size (Int)

.set XURL_ReadData,0xa3e03
.set URL_ReadData,0x83e03
   @Entry
   @  R0 = flags (Bits)
   @  R1 = session (URL_S)
   @  R2 = buffer (pointer to data)
   @  R3 = buffer_size (Int)
   @Exit
   @  R0 = status (URL_FetchStatus)
   @  R4 = bytes_read (Int)
   @  R5 = bytes_remaining (Int)

.set XURL_SetProxy,0xa3e04
.set URL_SetProxy,0x83e04

#  define URL_SetProxy_Enable 0x0
   @Entry
   @  R0 = flags (Bits)
   @  R1 = session (URL_S)
   @  R2 -> proxy_url (String)
   @  R3 -> scheme (String)
   @  R4 = &0
   @Exit
   @  R0 = status (URL_FetchStatus)

#  define URL_SetProxy_Disable 0x1
   @Entry
   @  R0 = flags (Bits)
   @  R1 = session (URL_S)
   @  R2 -> proxy_url (String)
   @  R4 = &1
   @Exit
   @  R0 = status (URL_FetchStatus)

.set XURL_Stop,0xa3e05
.set URL_Stop,0x83e05
   @Entry
   @  R0 = flags (Bits)
   @  R1 = session (URL_S)
   @Exit
   @  R0 = status (URL_FetchStatus)
   @  R1 corrupted
   @  R2 corrupted
   @  R3 corrupted
   @  R4 corrupted
   @  R5 corrupted

.set XURL_Deregister,0xa3e06
.set URL_Deregister,0x83e06
   @Entry
   @  R0 = flags (Bits)
   @  R1 = session (URL_S)
   @Exit
   @  R0 = status (URL_FetchStatus)
   @  R1 corrupted
   @  R2 corrupted
   @  R3 corrupted
   @  R4 corrupted
   @  R5 corrupted

.set XURL_ParseURL,0xa3e07
.set URL_ParseURL,0x83e07

#  define URLParseURL_ReturnLengths 0x0
   @Entry
   @  R0 = flags (URL_ParseURLFlags)
   @  R1 = &0
   @  R2 -> base_url (String)
   @  R3 -> relative_url (String)
   @  R4 = block (pointer to URL_ComponentSizes)
   @  R5 = block_size (Int)
   @Exit
   @  R0 = flags_out (Bits)

#  define URLParseURL_ReturnData 0x1
   @Entry
   @  R0 = flags (URL_ParseURLFlags)
   @  R1 = &1
   @  R2 -> base_url (String)
   @  R3 -> relative_url (String)
   @  R4 -> block (URL_Components)
   @  R5 = block_size (Int)
   @Exit
   @  R0 = flags_out (Bits)

#  define URLParseURL_ComposeFromComponents 0x2
   @Entry
   @  R0 = flags (URL_ParseURLFlags)
   @  R1 = &2
   @  R2 = &0
   @  R3 = &0
   @  R4 -> block (URL_Components)
   @  R5 = block_size (Int)
   @Exit
   @  R0 = flags_out (Bits)

#  define URLParseURL_QuickResolve 0x3
   @Entry
   @  R0 = flags (URL_ParseURLFlags)
   @  R1 = &3
   @  R2 -> base_url (String)
   @  R3 -> relative_url (String)
   @  R4 = url_buffer (pointer to String)
   @  R5 = url_buffer_size (Int)
   @Exit
   @  R0 = flags_out (Bits)

.set XURL_EnumerateSchemes,0xa3e08
.set URL_EnumerateSchemes,0x83e08
   @Entry
   @  R0 = flags (Bits)
   @  R1 = context (Bits)
   @Exit
   @  R0 = status (Bits)
   @  R1 = context_out (Bits)
   @  R2 -> scheme (String)
   @  R3 -> description (String)
   @  R4 = swi_base (Bits)
   @  R5 = version (Bits)

.set XURL_EnumerateProxies,0xa3e09
.set URL_EnumerateProxies,0x83e09
   @Entry
   @  R0 = flags (Bits)
   @  R1 = session (URL_S)
   @  R2 = context (Bits)
   @Exit
   @  R0 = status (Bits)
   @  R2 = context_out (Bits)
   @  R3 -> scheme (String)
   @  R4 -> proxy_url (String)

.set XURL_ProtocolRegister,0xa3e20
.set URL_ProtocolRegister,0x83e20
   @Entry
   @  R0 = flags (URL_ProtocolRegisterFlags)
   @  R1 = swi_base (Bits)
   @  R2 -> scheme (String)
   @  R3 = version (Bits)
   @  R4 -> name (String)
   @  R5 = protocol_flags (URL_ProtocolFlags)
   @  R6 = default_port (Bits)
   @Exit
   @  R0 = flags_out (Int)

.set XURL_ProtocolDeregister,0xa3e21
.set URL_ProtocolDeregister,0x83e21
   @Entry
   @  R0 = flags (Bits)
   @  R1 = swi_base (Bits)
   @Exit
   @  R0 = flags_out (Bits)
   @  R1 = sessions_affected (Bits)

#  define Service_URLModule 0x83e00
   @Entry
   @  R0 = reason_code (Bits)
   @  R1 = &83E00
   @  R2 = version (Bits)

#  define Service_URLModuleStarted 0x0
   @Entry
   @  R0 = &0
   @  R1 = &83E00
   @  R2 = version (Bits)

#  define Service_URLModuleDying 0x1
   @Entry
   @  R0 = &1
   @  R1 = &83E00
   @  R2 = version (Bits)

#  define Service_URLProtocolModule 0x83e01
   @Entry
   @  R0 = reason_code (Bits)
   @  R1 = &83E01
   @  R2 -> scheme (String)
   @  R3 = swi_base (Bits)
   @  R4 -> description (String)

#  define Service_URLProtocolModuleStarted 0x0
   @Entry
   @  R0 = &0
   @  R1 = &83E01
   @  R2 -> scheme (String)
   @  R3 = swi_base (Bits)
   @  R4 -> description (String)

#  define Service_URLProtocolModuleDying 0x1
   @Entry
   @  R0 = &1
   @  R1 = &83E01
   @  R2 -> scheme (String)
   @  R3 = swi_base (Bits)
   @  R4 -> description (String)

#endif
