; Assembler header file for URL
; Written by DefMod (Dec  9 2012) on Sun Dec  9 15:44:04 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.

        [       :LNOT: :DEF: URL_Hdr
        GBLS    URL_Hdr

        [       :LNOT: :DEF: Get_Types
        GBLS    Get_Types
        ]
        [       :LNOT: :DEF: Types_Hdr
Get_Types                       SETS    "GET oslib/Types.Hdr"
        |
Get_Types                       SETS    ""
        ]
        $Get_Types

        [       :LNOT: :DEF: Get_OS
        GBLS    Get_OS
        ]
        [       :LNOT: :DEF: OS_Hdr
Get_OS                          SETS    "GET oslib/OS.Hdr"
        |
Get_OS                          SETS    ""
        ]
        $Get_OS

;Symbols for constants
URL_AllSessions                 *       &0
URL_GetURLUserAgentSupplied     *       &1
URL_GetURLDataLengthSupplied    *       &2
URL_ParseURLDataLengthSupplied  *       &1
URL_ParseURLEscapeControlChars  *       &2
URL_MethodCODE                  *       &FF
URL_MethodCodeShift             *       8
URL_MethodFLAGS                 *       &FF00
URL_MethodFlagsShift            *       16
URL_GET                         *       &1
URL_HEAD                        *       &2
URL_OPTIONS                     *       &3
URL_POST                        *       &4
URL_TRACE                       *       &5
URL_PUT                         *       &8
URL_DELETE                      *       &C
URL_RETR                        *       &1
URL_LIST                        *       &1
URL_STOR                        *       &8
URL_MKD                         *       &9
URL_RMD                         *       &A
URL_RNFR                        *       &B
URL_RNTO                        *       &B
URL_DELE                        *       &C
URL_STOU                        *       &D
URL_Connected                   *       &1
URL_SentRequest                 *       &2
URL_SentData                    *       &4
URL_ResponseReceived            *       &8
URL_TransferInProgress          *       &10
URL_AllDataReceived             *       &20
URL_TransferAborted             *       &40
URL_HasProtocolFlags            *       &1
URL_HasDefaultPort              *       &2
URL_NonUnixPath                 *       &1
URL_DontParse                   *       &2
URL_AllowUsername               *       &4
URL_AllowHashInHostname         *       &8
URL_NoHostname                  *       &10
URL_RemoveLeadingUpComponents   *       &20
Error_URLBadSession             *       &80DE00
Error_URLNoMemory               *       &80DE01
Error_URLNoFetcher              *       &80DE02
Error_URLUnknownSWI             *       &80DE03
Error_URLBadFetch               *       &80DE04
Error_URLFetchFinished          *       &80DE05
Error_URLProtocolClaimed        *       &80DE06
Error_URLNoFetch                *       &80DE07
Error_URLBadMessage             *       &80DE08
Error_URLNotParseable           *       &80DE0A

;Symbols for structure offsets and sizes
URL_S                           *       4 ;abstract type
        ^       0
        #       Bits
URL_GetURLFlags                 *       @

        ^       0
        #       Bits
URL_ParseURLFlags               *       @

        ^       0
        #       Bits
URL_Method                      *       @

        ^       0
        #       Int
URL_MethodCode                  *       @

        ^       0
        #       Bits
URL_MethodFlags                 *       @

        ^       0
        #       Bits
URL_FetchStatus                 *       @

        ^       0
URL_Components_full_url         #       Ptr
URL_Components_scheme           #       Ptr
URL_Components_host             #       Ptr
URL_Components_port             #       Ptr
URL_Components_user             #       Ptr
URL_Components_password         #       Ptr
URL_Components_account          #       Ptr
URL_Components_path             #       Ptr
URL_Components_query            #       Ptr
URL_Components_fragment         #       Ptr
URL_Components                  *       @

        ^       0
URL_ComponentSizes_full_url     #       Int
URL_ComponentSizes_scheme       #       Int
URL_ComponentSizes_host         #       Int
URL_ComponentSizes_port         #       Int
URL_ComponentSizes_user         #       Int
URL_ComponentSizes_password     #       Int
URL_ComponentSizes_account      #       Int
URL_ComponentSizes_path         #       Int
URL_ComponentSizes_query        #       Int
URL_ComponentSizes_fragment     #       Int
URL_ComponentSizes              *       @

        ^       0
        #       Bits
URL_ProtocolRegisterFlags       *       @

        ^       0
        #       Bits
URL_ProtocolFlags               *       @


;Symbols for SWI's and SWI reason codes
XURL_Register                   *       &A3E00
URL_Register                    *       &83E00
   ;Entry
   ;  R0 = flags (Bits)
   ;Exit
   ;  R0 corrupted
   ;  R1 = session (URL_S)

XURL_GetURL                     *       &A3E01
URL_GetURL                      *       &83E01
   ;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)

XURL_Status                     *       &A3E02
URL_Status                      *       &83E02
   ;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)

XURL_ReadData                   *       &A3E03
URL_ReadData                    *       &83E03
   ;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)

XURL_SetProxy                   *       &A3E04
URL_SetProxy                    *       &83E04

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

URL_SetProxy_Disable            *       &1
   ;Entry
   ;  R0 = flags (Bits)
   ;  R1 = session (URL_S)
   ;  R2 -> proxy_url (String)
   ;  R4 = &1
   ;Exit
   ;  R0 = status (URL_FetchStatus)

XURL_Stop                       *       &A3E05
URL_Stop                        *       &83E05
   ;Entry
   ;  R0 = flags (Bits)
   ;  R1 = session (URL_S)
   ;Exit
   ;  R0 = status (URL_FetchStatus)
   ;  R1 corrupted
   ;  R2 corrupted
   ;  R3 corrupted
   ;  R4 corrupted
   ;  R5 corrupted

XURL_Deregister                 *       &A3E06
URL_Deregister                  *       &83E06
   ;Entry
   ;  R0 = flags (Bits)
   ;  R1 = session (URL_S)
   ;Exit
   ;  R0 = status (URL_FetchStatus)
   ;  R1 corrupted
   ;  R2 corrupted
   ;  R3 corrupted
   ;  R4 corrupted
   ;  R5 corrupted

XURL_ParseURL                   *       &A3E07
URL_ParseURL                    *       &83E07

URLParseURL_ReturnLengths       *       &0
   ;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)

URLParseURL_ReturnData          *       &1
   ;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)

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

URLParseURL_QuickResolve        *       &3
   ;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)

XURL_EnumerateSchemes           *       &A3E08
URL_EnumerateSchemes            *       &83E08
   ;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)

XURL_EnumerateProxies           *       &A3E09
URL_EnumerateProxies            *       &83E09
   ;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)

XURL_ProtocolRegister           *       &A3E20
URL_ProtocolRegister            *       &83E20
   ;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)

XURL_ProtocolDeregister         *       &A3E21
URL_ProtocolDeregister          *       &83E21
   ;Entry
   ;  R0 = flags (Bits)
   ;  R1 = swi_base (Bits)
   ;Exit
   ;  R0 = flags_out (Bits)
   ;  R1 = sessions_affected (Bits)

Service_URLModule               *       &83E00
   ;Entry
   ;  R0 = reason_code (Bits)
   ;  R1 = &83E00
   ;  R2 = version (Bits)

Service_URLModuleStarted        *       &0
   ;Entry
   ;  R0 = &0
   ;  R1 = &83E00
   ;  R2 = version (Bits)

Service_URLModuleDying          *       &1
   ;Entry
   ;  R0 = &1
   ;  R1 = &83E00
   ;  R2 = version (Bits)

Service_URLProtocolModule       *       &83E01
   ;Entry
   ;  R0 = reason_code (Bits)
   ;  R1 = &83E01
   ;  R2 -> scheme (String)
   ;  R3 = swi_base (Bits)
   ;  R4 -> description (String)

Service_URLProtocolModuleStarted *       &0
   ;Entry
   ;  R0 = &0
   ;  R1 = &83E01
   ;  R2 -> scheme (String)
   ;  R3 = swi_base (Bits)
   ;  R4 -> description (String)

Service_URLProtocolModuleDying  *       &1
   ;Entry
   ;  R0 = &1
   ;  R1 = &83E01
   ;  R2 -> scheme (String)
   ;  R3 = swi_base (Bits)
   ;  R4 -> description (String)

        ]
        END
