OpenMPI 0.1.1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

Data Structures | Macros | Functions
buffer_iocp.c File Reference

This module implements overlapped read and write functions for evbuffer objects on Windows. More...

`#include "event2/buffer.h"`
`#include "event2/buffer_compat.h"`
`#include "event2/util.h"`
`#include "event2/thread.h"`
`#include "event2/event-config.h"`
`#include "util-internal.h"`
`#include "evthread-internal.h"`
`#include "evbuffer-internal.h"`
`#include "iocp-internal.h"`
`#include "mm-internal.h"`
`#include <winsock2.h>`
`#include <windows.h>`
`#include <stdio.h>`

## Data Structures
struct | evbuffer_overlapped
| An evbuffer that can handle overlapped IO. More...

## Macros
#define | MAX_WSABUFS 16

## Functions
static struct evbuffer_overlapped * | upcast_evbuffer (struct evbuffer *buf)
| Given an evbuffer, return the correponding evbuffer structure, or NULL if the evbuffer isn't overlapped. More...
static void | pin_release (struct evbuffer_overlapped *eo, unsigned flag)
| Unpin all the chains noted as pinned in 'eo'. More...
void | evbuffer_commit_read (struct evbuffer *evbuf, ev_ssize_t nBytes)
| XXX document.
void | evbuffer_commit_write (struct evbuffer *evbuf, ev_ssize_t nBytes)
struct evbuffer * | evbuffer_overlapped_new (evutil_socket_t fd)
| Allocate and return a new evbuffer that supports overlapped IO on a given socket. More...
int | evbuffer_launch_write (struct evbuffer *buf, ev_ssize_t at_most, struct event_overlapped *ol)
| Start writing data from the start of an evbuffer. More...
int | evbuffer_launch_read (struct evbuffer *buf, size_t at_most, struct event_overlapped *ol)
| Start reading data onto the end of an overlapped evbuffer. More...
evutil_socket_t | _evbuffer_overlapped_get_fd (struct evbuffer *buf)
| XXXX Document (nickm)
void | _evbuffer_overlapped_set_fd (struct evbuffer *buf, evutil_socket_t fd)

## Detailed Description

This module implements overlapped read and write functions for evbuffer objects on Windows.

## Function Documentation

int evbuffer_launch_read | ( | struct evbuffer * | buf,
|  | size_t | n,
|  | struct event_overlapped * | ol
| ) |  |

Start reading data onto the end of an overlapped evbuffer.

An evbuffer can only have one read pending at a time. While the read is in progress, no other data may be added to the end of the buffer. The buffer must be created with event_overlapped_init(). evbuffer_commit_read() must be called in the completion callback.

Parameters

  buf | The buffer to read onto
  n | The number of bytes to try to read.
  ol | Overlapped object with associated completion callback.

Returns
  0 on success, -1 on error.

References evbuffer_free(), evbuffer_freeze(), evbuffer_unfreeze(), evbuffer_overlapped::fd, evbuffer_overlapped::first_pinned, evbuffer_chain::flags, evbuffer::freeze_end, evbuffer_overlapped::n_buffers, evbuffer_chain::next, pin_release(), evbuffer_overlapped::read_in_progress, and upcast_evbuffer().

int evbuffer_launch_write | ( | struct evbuffer * | buf,
|  | ev_ssize_t | n,
|  | struct event_overlapped * | ol
| ) |  |

Start writing data from the start of an evbuffer.

An evbuffer can only have one write pending at a time. While the write is in progress, no other data may be removed from the front of the buffer. The buffer must be created with event_overlapped_init(). evbuffer_commit_write() must be called in the completion callback.

Parameters

  buf | The buffer to read onto
  n | The number of bytes to try to read.
  ol | Overlapped object with associated completion callback.

Returns
  0 on success, -1 on error.

References evbuffer_free(), evbuffer_freeze(), evbuffer_unfreeze(), evbuffer_overlapped::fd, evbuffer::first, evbuffer_overlapped::first_pinned, evbuffer::freeze_start, evbuffer_overlapped::n_buffers, evbuffer_chain::next, pin_release(), evbuffer_overlapped::read_in_progress, evbuffer::total_len, and upcast_evbuffer().

struct evbuffer* evbuffer_overlapped_new | ( | evutil_socket_t | fd | ) |

Allocate and return a new evbuffer that supports overlapped IO on a given socket.

The socket must be associated with an IO completion port using event_iocp_port_associate.

References evbuffer_overlapped::fd, evbuffer::first, evbuffer::last_with_datap, and evbuffer::refcnt.

static void pin_release | ( | struct evbuffer_overlapped * | eo,
|  | unsigned | flag
| ) |  |
| static

Unpin all the chains noted as pinned in 'eo'.

References evbuffer_overlapped::first_pinned, evbuffer_overlapped::n_buffers, and evbuffer_chain::next.

Referenced by evbuffer_commit_read(), evbuffer_launch_read(), and evbuffer_launch_write().

static struct evbuffer_overlapped* upcast_evbuffer | ( | struct evbuffer * | buf | ) |
| static

Given an evbuffer, return the correponding evbuffer structure, or NULL if the evbuffer isn't overlapped.

Referenced by _evbuffer_overlapped_get_fd(), evbuffer_commit_read(), evbuffer_launch_read(), and evbuffer_launch_write().