This repository has been archived by the owner on Nov 10, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ffi.l
90 lines (68 loc) · 2.79 KB
/
ffi.l
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# ffi.l
#
# The MIT License (MIT)
#
# Copyright (c) 2015 Alexander Williams, Unscramble <license@unscramble.jp>
(de ne-sock-init ()
(native `*Https "ne_sock_init" 'I) )
(de ne-version-string ()
(native `*Https "ne_version_string" 'S) )
(de ne-has-support (Feature)
(native `*Https "ne_has_support" 'I Feature) )
(de ne-get-error (Session)
(native `*Https "ne_get_error" 'S Session) )
# returns the result in 'car', parsed URI in 'cdr'
[de ne-uri-parse (Uri &ne_uri)
(use Parsed
(cons
(native `*Https "ne_uri_parse" 'I Uri (list 'Parsed &ne_uri))
Parsed ]
(de ne-uri-defaultport (Scheme)
(native `*Https "ne_uri_defaultport" 'I Scheme) )
(de ne-add-request-header (Request Name Value)
(native `*Https "ne_add_request_header" NIL Request Name Value) )
(de ne-session-create (Scheme Hostname Port)
(native `*Https "ne_session_create" 'N Scheme Hostname Port) )
(de ne-ssl-trust-default-ca (Session)
(native `*Https "ne_ssl_trust_default_ca" NIL Session) )
(de ne-request-create (Session Method Path)
(native `*Https "ne_request_create" 'N Session Method Path) )
(de ne-begin-request (Request)
(native `*Https "ne_begin_request" 'I Request) )
(de ne-end-request (Request)
(native `*Https "ne_end_request" 'I Request) )
# returns the result in 'car', value of &buffer in 'cdr'
(de ne-read-response-block (Request &buffer Length)
(use Buf
(cons
(native `*Https "ne_read_response_block" 'I
Request
(cons 'Buf &buffer 0)
Length )
Buf ]
(de ne-read-response-to-fd (Request Fd)
(native `*Https "ne_read_response_to_fd" 'I Request Fd) )
(de ne-set-request-body-buffer (Request Buffer Size)
(native `*Https "ne_set_request_body_buffer" NIL Request Buffer Size) )
(de ne-request-destroy (Request)
(native `*Https "ne_request_destroy" NIL Request) )
(de ne-close-connection (Session)
(native `*Https "ne_close_connection" NIL Session) )
(de ne-session-destroy (Session)
(native `*Https "ne_session_destroy" NIL Session) )
(de ne-get-status (Request)
(native `*Https "ne_get_status" 'N Request) )
[de ne-response-header-iterate (Request Cursor &name &value)
(use (Name Value)
(list
(native `*Https "ne_response_header_iterate" 'N
Request
Cursor
(cons 'Name &name 0)
(cons 'Value &value 0) )
Name
Value ]
(de ne-set-server-auth (Session Creds_cb Userdata)
(native `*Https "ne_set_server_auth" NIL Session Creds_cb Userdata) )
(de ne-forget-auth (Session)
(native `*Https "ne_forget_auth" NIL Session) )