' URI parsing/building constants and optional helper declarations.
#IF NOT %DEF(PBX_URI_PBI)
#DEFINE PBX_URI_PBI
CONST URI_SCHEME_HTTP = "http"
CONST URI_SCHEME_HTTPS = "https"
CONST URI_SCHEME_WS = "ws"
CONST URI_SCHEME_WSS = "wss"
CONST URI_SCHEME_FILE = "file"
CONST URI_PART_SCHEME = 1
CONST URI_PART_USERINFO = 2
CONST URI_PART_HOST = 3
CONST URI_PART_PORT = 4
CONST URI_PART_PATH = 5
CONST URI_PART_QUERY = 6
CONST URI_PART_FRAGMENT = 7
CONST URI_FLAG_ENCODE_SPACE_AS_PLUS = &H00000001
CONST URI_FLAG_DECODE_PLUS_AS_SPACE = &H00000002
CONST 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
