'\" t .\" Title: xs_getmsgopt .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 .\" Date: 06/13/2012 .\" Manual: Crossroads I/O Manual .\" Source: Crossroads I/O 1.2.0 .\" Language: English .\" .TH "XS_GETMSGOPT" "3" "06/13/2012" "Crossroads I/O 1\&.2\&.0" "Crossroads I/O Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" xs_getmsgopt \- retrieve message option .SH "SYNOPSIS" .sp \fBint xs_getmsgopt (xs_msg_t \fR\fB\fI*message\fR\fR\fB, int \fR\fB\fIoption_name\fR\fR\fB, void \fR\fB\fI*option_value\fR\fR\fB, size_t \fR\fB\fI*option_len\fR\fR\fB);\fR .SH "DESCRIPTION" .sp The \fIxs_getmsgopt()\fR function shall retrieve the value for the option specified by the \fIoption_name\fR argument for the message pointed to by the \fImessage\fR argument, and store it in the buffer pointed to by the \fIoption_value\fR argument\&. The \fIoption_len\fR argument is the size in bytes of the buffer pointed to by \fIoption_value\fR; upon successful completion \fIxs_getsockopt()\fR shall modify the \fIoption_len\fR argument to indicate the actual size of the option value stored in the buffer\&. .sp The following options can be retrieved with the \fIxs_getmsgopt()\fR function: .PP \fBXS_MORE\fR .RS 4 Indicates that there are more message parts to follow after the \fImessage\fR\&. The type of this option is int\&. 0 means that this is the last message part of a multipart message\&. 1 means that more message parts will follow\&. .RE .SH "RETURN VALUE" .sp The \fIxs_getmsgopt()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. .SH "ERRORS" .PP \fBEINVAL\fR .RS 4 The requested option \fIoption_name\fR is unknown, or the requested \fIoption_size\fR or \fIoption_value\fR is invalid, or the size of the buffer pointed to by \fIoption_value\fR, as specified by \fIoption_len\fR, is insufficient for storing the option value\&. .RE .SH "EXAMPLE" .PP \fBReceiving a multi-part message\fR. .sp .if n \{\ .RS 4 .\} .nf xs_msg_t part; int more; size_t more_size = sizeof (more); while (true) { /* Create an empty message to hold the message part */ int rc = xs_msg_init (&part); assert (rc == 0); /* Block until a message is available to be received from socket */ rc = xs_recvmsg (socket, &part, 0); assert (rc != \-1); rc = getmsgopt (&part, XS_MORE, &more, &more_size); assert (rc == 0); if (more) { fprintf (stderr, "more\en"); } else { fprintf (stderr, "end\en"); break; } xs_msg_close (part); } .fi .if n \{\ .RE .\} .sp .SH "SEE ALSO" .sp \fBxs_msg_data\fR(3) \fBxs_msg_init\fR(3) \fBxs_msg_init_size\fR(3) \fBxs_msg_init_data\fR(3) \fBxs_msg_close\fR(3) \fBxs\fR(7) .SH "AUTHORS" .sp This manual page was written by Chuck Remes <\m[blue]\fBcremes@mac\&.com\fR\m[]\&\s-2\u[1]\d\s+2>\&. .SH "NOTES" .IP " 1." 4 cremes@mac.com .RS 4 \%mailto:cremes@mac.com .RE