@ -15,6 +15,7 @@ Additional tools can be built by running `make all-ffi' in the libsipc/ director
Functions:
Functions:
;server functions
;server functions
sipc:bind(file) ;; Bind to socket `file'. Returns the socket descriptor on success and nil on fail (the socket must not already exist)
sipc:bind(file) ;; Bind to socket `file'. Returns the socket descriptor on success and nil on fail (the socket must not already exist)
sipc:timeout(socket sec) ;; Set read timeout (in seconds) to socket. (if value is NIL, nothing happens, if value is 0, set to infinite). (note: when something fails timeout it sends error :MESSAGE (invalid message).
sipc:release(socket) ;; Close socket
sipc:release(socket) ;; Close socket
sipc:hook(socket error-callback message-callback)
sipc:hook(socket error-callback message-callback)
;; start listening on `socket'. error-callback should be in format (lambda (error) ...). message-callback should be in format (lambda (type message )...).
;; start listening on `socket'. error-callback should be in format (lambda (error) ...). message-callback should be in format (lambda (type message )...).
@ -49,12 +52,15 @@ int si_bind(const char* file); //Returns sd, or -1 on failure.
intsi_listen(intsd,si_error_callbackon_error,si_callbackon_message);//Returns non-zero on clean exit, -1 on error.
intsi_listen(intsd,si_error_callbackon_error,si_callbackon_message);//Returns non-zero on clean exit, -1 on error.
voidsi_close(intsd);//Close sock (must be called after si_listen()
voidsi_close(intsd);//Close sock (must be called after si_listen()
voidsi_timeout(intsd,intseconds);//Set sock timeout (0 for infinite).
char*si_error_string(si_errorerr);
char*si_error_string(si_errorerr);
char*si_type_string(si_typety);
char*si_type_string(si_typety);
intsi_connect(constchar*file);//Returns sd, or -1 on failure.
intsi_connect(constchar*file);//Returns sd, or -1 on failure.
intsi_sendmsg_r(intsd,constsi_message*msg,si_message**response);//si_sendmmsg but optionally receive response (make sure to free() *response after you're done, NULL to discard response, if there is no response *response is not modified)
intsi_sendmsg_r(intsd,constsi_message*msg,si_message**response);//si_sendmmsg but optionally receive response (make sure to free() *response after you're done, NULL to discard response, if there is no response *response is not modified)
intsi_sendmsg(intsd,constsi_message*msg);//Returns 0 on okay, 1 if whole message could not be sent, -1 on send error, -2 on weird send error. (see SI_SEND_*)
intsi_sendmsg(intsd,constsi_message*msg);//Returns 0 on okay, 1 if whole message could not be sent, -1 on send error, -2 on weird send error. (see SI_SEND_*)
voidsi_sign(si_message*msg);//Sign message. Use this before sending one.