' URI parsing/building constants and optional helper declarations.
#IF NOT %DEF(PBX_URI_PBI)
#DEFINE PBX_URI_PBI
%EQUATE `URI_SCHEME_HTTP = "http"
%EQUATE `URI_SCHEME_HTTPS = "https"
%EQUATE `URI_SCHEME_WS = "ws"
%EQUATE `URI_SCHEME_WSS = "wss"
%EQUATE `URI_SCHEME_FILE = "file"
%EQUATE `URI_PART_SCHEME = 1
%EQUATE `URI_PART_USERINFO = 2
%EQUATE `URI_PART_HOST = 3
%EQUATE `URI_PART_PORT = 4
%EQUATE `URI_PART_PATH = 5
%EQUATE `URI_PART_QUERY = 6
%EQUATE `URI_PART_FRAGMENT = 7
%EQUATE `URI_FLAG_ENCODE_SPACE_AS_PLUS = &H00000001
%EQUATE `URI_FLAG_DECODE_PLUS_AS_SPACE = &H00000002
%EQUATE `URI_FLAG_STRICT = &H00000004
TYPE URI_PART_SPAN
    pText AS QUAD
    cbText AS QUAD
END TYPE
TYPE URI_COMPONENTS_UTF8
    schemePart AS URI_PART_SPAN
    userInfoPart AS URI_PART_SPAN
    hostPart AS URI_PART_SPAN
    portValue AS DWORD
    pathPart AS URI_PART_SPAN
    queryPart AS URI_PART_SPAN
    fragmentPart AS URI_PART_SPAN
END TYPE
DECLARE FUNCTION PBXUri_ParseUtf8 LIB "pbxapi64.dll" ALIAS "PBXUri_ParseUtf8" (BYVAL pUri AS QUAD, BYVAL cbUri AS QUAD, BYVAL flags AS DWORD, BYVAL pParts AS QUAD) AS LONG
DECLARE FUNCTION PBXUri_BuildUtf8 LIB "pbxapi64.dll" ALIAS "PBXUri_BuildUtf8" (BYVAL pParts AS QUAD, BYVAL flags AS DWORD, BYVAL ppUri AS QUAD, BYVAL pcbUri AS QUAD) AS LONG
#ENDIF
