blob: 85ff4abdd93920e51c43a0dd7b3981791bff9e27 [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001SYNOPSIS
Zesstrad59c3892019-11-28 20:53:39 +01002 #include <erq.h>
3
Zesstra715ec202025-07-09 22:18:31 +02004 int send_erq(int request, bytes|int * data, closure callback)
MG Mud User88f12472016-06-24 23:31:02 +02005
Zesstra715ec202025-07-09 22:18:31 +02006DESCRIPTION
7 A request of given type (<request>, default is 0), equipped
8 with the given <data>, is sent to the erq. If <callback> is
9 set to a closure, it will be called when the response from the
10 erq (a status code) arrives, if the response carries enough data to
11 work on.
MG Mud User88f12472016-06-24 23:31:02 +020012
Zesstra715ec202025-07-09 22:18:31 +020013 <request> can be one of the request codes defined in <erq.h>.
14 The binary flag ERQ_CB_STRING defines whether the <callback>
15 closure expects the returned data packed into an array of
16 integers or as a string.
MG Mud User88f12472016-06-24 23:31:02 +020017
Zesstra715ec202025-07-09 22:18:31 +020018 <data> may be a byte sequence, or an array of integers which are
19 then interpreted as bytes.
MG Mud User88f12472016-06-24 23:31:02 +020020
Zesstra715ec202025-07-09 22:18:31 +020021 <callback>, if set, is a closure of either these forms:
MG Mud User88f12472016-06-24 23:31:02 +020022
Zesstra715ec202025-07-09 22:18:31 +020023 !ERQ_CB_STRING: void <closure>(int *response_data, int len)
24 ERQ_CB_STRING: void <closure>(string response_data)
MG Mud User88f12472016-06-24 23:31:02 +020025
Zesstra715ec202025-07-09 22:18:31 +020026 The result returned from the efun is 0 on failure to send the
27 data, or non-zero on a successful send.
Zesstrad59c3892019-11-28 20:53:39 +010028
Zesstra715ec202025-07-09 22:18:31 +020029 The function causes a privilege violation "erq".
30
31HISTORY
32 Introduced in 3.2.1@61.
33 Made a privileged function in 3.2.1@84
34 LDMud 3.3.318 introduced the ERQ_CB_STRING flag.
35
36SEE ALSO
MG Mud User88f12472016-06-24 23:31:02 +020037 attach_erq_demon(E), erq(C)