W

                                                                                                                                                                                                                                                                                                                                      Back to [Book]     [Topic]

Functions beginning with W

The following functions are discussed in this section:

write() Function

The write filter method is called when output data is to be sent. Filters that modify or consume outgoing data should implement the write filter method.

Upon receiving control, a write implementation should first process the data as necessary, and then pass it on to the next filter layer, for example, by calling net_write(layer->lower, ...,). If the filter buffers outgoing data, it should implement the flush filter method.

Syntax Return Values Parameters Example
int write(FilterLayer *layer, const void *buf, int amount);

The number of bytes consumed, which might be less than the requested amount if an error occurred. FilterLayer *layer is the filter layer in which the filter is installed.
const void *buf is the buffer that contains the outgoing data.
int amount is the number of bytes in the buffer.
int myfilter_write(FilterLayer *layer, const void *buf, int amount)
{
    return net_write(layer->lower, buf, amount);
}

See Also

writev() Function

The writev filter method is called when multiple buffers of output data are to be sent. Filters that modify or consume outgoing data can implement the writev filter method.

If a filter implements the write filter method but not the writev filter method, the server automatically translates net_writev calls to net_write calls. As a result, filters for the outgoing data stream do not need to implement the writev filter method. However, for performance reasons, filters that implement the write filter method should also implement the writev filter method.

Syntax Return Values Parameters Example
int writev(FilterLayer *layer, const struct iovec *iov, int iov_size);

The number of bytes consumed, which might be less than the requested amount if an error occurred. FilterLayer *layer is the filter layer the filter is installed in.
const struct iovec *iov is an array of iovec structures, each of which contains outgoing data.
int iov_size is the number of iovec structures in the iov array.
int myfilter_writev(FilterLayer *layer, const struct iovec *iov, int iov_size)
{
    return net_writev(layer->lower, iov, iov_size);
}

See Also

Labels

java java Delete
server server Delete
sun sun Delete
webserver webserver Delete
application application Delete
system system Delete
webtier webtier Delete
guide guide Delete
developers developers Delete
webserver70 webserver70 Delete
developersguide developersguide Delete
sunjava sunjava Delete
nsapi nsapi Delete
nsapidevelopersguide nsapidevelopersguide Delete
web web Delete
+nsapiguide +nsapiguide Delete
nsapiguide nsapiguide Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

Sign up or Log in to add a comment or watch this page.


The individuals who post here are part of the extended Sun Microsystems community and they might not be employed or in any way formally affiliated with Sun Microsystems. The opinions expressed here are their own, are not necessarily reviewed in advance by anyone but the individual authors, and neither Sun nor any other party necessarily agrees with them.

Copyright 1994-2009 Sun Microsystems, Inc.
Powered by Atlassian Confluence
Sun Guidelines on Public Discourse Privacy Policy Terms of Use Trademarks Site Map Employment Investor Relations Contact