Main Page | Modules | Data Structures | Data Fields

Socket streams


Detailed Description

This API provides a functional interface to asynchronously processed socket streams. For simplicity, unlike other implementations, one stream instance can be readable and writable at the same time. Once configured, a stream must be scheduled with a task. The library will then notify the application using a notification callback, which will be called by one of the task's thread.


Modules

Stream common
 Creation methods and other common methods for socket streams.

Non-buffered operations
 Low level read/write primitives.

Line-mode operations
 Line-mode based stream methods.

Write-buffered operations
 Write-buffered stream methods.

Scheduling
 Scheduling task for streams.


Typedefs

typedef __peak_stream * peak_stream
 Opaque stream pointer type.

typedef void(* peak_stream_event_callback )(peak_stream s, int type, void *context)
 Stream client event callback.


Enumerations

enum  {
  PEAK_STREAM_OPT_DEFAULT = 0,
  PEAK_STREAM_OPT_DGRAM = 1 << 0,
  PEAK_STREAM_OPT_LISTEN = 1 << 1,
  PEAK_STREAM_OPT_LINEMODE = 1 << 2,
  PEAK_STREAM_OPT_AUTOSCHEDULE = 1 << 3
}
 Stream creation options. More...

enum  {
  PEAK_STREAM_EVT_NONE = 0,
  PEAK_STREAM_EVT_OPEN,
  PEAK_STREAM_EVT_ACCEPT,
  PEAK_STREAM_EVT_READ,
  PEAK_STREAM_EVT_WRITE,
  PEAK_STREAM_EVT_END,
  PEAK_STREAM_EVT_ERROR,
  PEAK_STREAM_EVT_TIMEDOUT
}
 Types of event passed to your stream event callback function. More...


Typedef Documentation

typedef void(* peak_stream_event_callback)(peak_stream s, int type, void *context)
 

Stream client event callback.

Defines a pointer to your notification callback function that handles interesting events that occur on a scheduled stream.


Enumeration Type Documentation

anonymous enum
 

Stream creation options.

Enumeration values:
PEAK_STREAM_OPT_DEFAULT  Default: SOCK_STREAM socket (reliable stream), ie. TCP.
PEAK_STREAM_OPT_DGRAM  UDP socket stream (not a reliable stream).
PEAK_STREAM_OPT_LISTEN  Listening socket stream. Will use the address argument as the local address (where to bind).
PEAK_STREAM_OPT_LINEMODE  Line mode, useful for line-based text streams; the callback is called for every line received.
PEAK_STREAM_OPT_AUTOSCHEDULE  Auto schedule, avoid a call to peak_stream_schedule. Useful for accepted socket.

anonymous enum
 

Types of event passed to your stream event callback function.

Enumeration values:
PEAK_STREAM_EVT_NONE  Never used.
PEAK_STREAM_EVT_OPEN  Open event. The stream is now open (connection established).
PEAK_STREAM_EVT_ACCEPT  Accept event. A new stream can be created using peak_stream_accept_create().
PEAK_STREAM_EVT_READ  Read event. There's something to read on the stream.

Until you don't really read it, you won't be notified again with this event type.

PEAK_STREAM_EVT_WRITE  Write event. You can efficiently write on the stream NOW.

Until you don't really write something, you won't be notified again with this event type.

PEAK_STREAM_EVT_END  End of stream event. No further bytes can be read/written.

You should release the stream with peak_release().

PEAK_STREAM_EVT_ERROR  An error occured on the stream's connection.

You should release the stream with peak_release().

PEAK_STREAM_EVT_TIMEDOUT  Stream's event timed out.

Sent only when you enable stream's event timeout checking with peak_stream_set_timeout(). You might release the stream with peak_release(). If you ignore it, another event of type PEAK_STREAM_EVT_TIMEDOUT will be sent after timeout seconds as defined in peak_stream_set_timeout().


Generated on Thu Jan 8 18:16:24 2004 for the PEAK Library by doxygen     SourceForge.net Logo