You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
libsxmp/man/sxmsg_send.3

104 lines
3.3 KiB
Groff

.TH SXMSG_SEND 3 "20 July 2015" "SNTLLv2" "SNTL Library Manual"
.SH NAME
sxmsg_send \- Create and send a message within called thread context.
.br
sxmsg_send_pp \- Create and send a message in postponed mode.
.SH SYNOPSIS
.B #include <sntl/sntllv2.h>
.br
.sp
int sxmsg_send(chnl_t *channel, const char *data, size_t datalen, sxmsg_t **msg);
int sxmsg_send_pp(chnl_t *channel, const char *data, size_t datalen, sxmsg_t **msg);
void sxmsg_clean(sxmsg_t *msg);
.br
.sp
.SH DESCRIPTION
.B sxmsg_send
Will create and send message using channel pointed by
.B channel
with data pointed by
.B data
with length pointed in bytes using
.B datalen.
If message dialog will continue pointer to the message with reply will be pushed to
.B msg.
This message will be sent within context of the calling thread.
.br
.B sxmsg_send_pp
Will do exactly the same, but message sending will be postponed and sent by one of the thread serving the underlying connection link.
.br
Both calls will cause a sleep of the calling thread until reply or error will be returned. I.e. this call is blocking one. Also, message is actually atom of the dialog, that means one side sending a first message creates dialog, other side may or may not close this dialog with error code (actual a message without data) or with some data, you should track the message return code to correctly close dialogs.
.br
If dialogs will be not finished correctly the limit of active messages will be exceeded and you will be not able to create a new dialog while message poll is full with opened dialogs. It's a good practice to avoid long dialog queues in critical operations or operations required to send a lot of data, since each message can take a lot of time (SSL time, network time).
.br
.B sxmsg_clean
will clean up the data used for closed dialog message, it should be used in case of rapid reply to avoid memory leaks.
.SH RETURN VALUE
Dialog will be closed in all cases except the following error codes returns:
.sp
.B SNE_REPLYREQ
means other side waiting a reply for this message (i.e. dialog isn't closed).
.br
In other cases message will not set except
.B SNE_RAPIDMSG
error code, in this case to avoid memory leaks
.B sxmsg_clean
must be called after data is processed. In other cases a different and specific error code might be returned, but usual cases listed below:
.br
.B SNE_SUCCESS
will returns if message was processed and dialog is closed.
.br
.B SNE_FAILED
pointed data is invalid.
.br
.B SNE_ENOMEM
not available memory for operation.
.br
.B SNE_BADPROTO
bad protocol.
.br
.B SNE_ENORPC
No RPC call exists i.e. message sent contains an invalid RPC function name.
.br
.B SNE_TOOLONG
Data os too long to be sent with one message.
.br
.B SNE_NOSUCHCHAN
Pointed channel doesn't exists
.br
.B SNE_ETIMEDOUT
Other side timedout with replying to your message.
.br
.B SNE_LINKBROKEN
Connection link is broken during a message send.
.br
.B SNE_MMESSAGES
Limit for the active messages exceeded.
.br
.SH BUGS
Not known yet.
.SH EXAMPLE
None.
.SH APPLICATION USAGE
None.
.SH RATIONALE
None.
.SH SEE_ALSO
.BI connection_link(3)
,
.BI sxchannel_open(3)
,
.BI sxmsg_rreply(3)
,
.BI sxmsg_return(3)
,
.BI sxmsg_reply
.SH COPYRIGHT
This is a proprietary software. See COPYING for further details.
.br
(c) Askele Group 2013-2015 <http://askele.com>
.SH AUTHOR
Alexander Vdolainen (vdo@askele.com)