Main Page   Compound List   File List   Compound Members   File Members  

lib/gobj/stream.h File Reference

Stream implementation. More...

#include <gobjconfig.h>
#include <gobj/context.h>
#include <gobj/types.h>
#include <gobj/decls.h>
#include <gobj/iface.h>

Defines

#define Gj_stream_writeInt(ctx, stream, value)    Gj_stream_writeI32((ctx), (stream), (value))
 Write an int to the stream. More...

#define Gj_stream_writeDouble(ctx, stream, value)    Gj_stream_writeF64((ctx), (stream), (value))
 Write a double to the stream. More...

#define Gj_stream_writeChar(ctx, stream, value)    Gj_stream_writeI8((ctx), (stream), (value))
 Write a char to the stream. More...

#define Gj_stream_writeWchar(ctx, stream, value)    Gj_stream_writeI32((ctx), (stream), (value))
 Write a wchar_t to the stream. More...

#define Gj_stream_writeBool(ctx, stream, value)    Gj_stream_writeI8((ctx), (stream), (value))
 Write a Gj_Bool to the stream. More...

#define Gj_stream_readInt(ctx, stream, value)    Gj_stream_readI32((ctx), (stream), (value))
 Read a int from the stream. More...

#define Gj_stream_readDouble(ctx, stream, value)    Gj_stream_readF64((ctx), (stream), (value))
 Read a double from the stream. More...

#define Gj_stream_readChar(ctx, stream, value)    Gj_stream_readI8((ctx), (stream), (value))
 Read a char from the stream. More...

#define Gj_stream_readWchar(ctx, stream, value)    Gj_stream_readI32((ctx), (stream), (value))
 Read a wchar_t from the stream. More...

#define Gj_stream_readBool(ctx, stream, value)    Gj_stream_readI8((ctx), (stream), (value))
 Read a Gj_Bool from the stream. More...


Functions

Gj_StreamGj_stream_new (Gj_Ctx* ctx, Gj_Id* iface, char* addr)
 Create a new stream. More...

Gj_StreamGj_stream_newFromIncomingConn (Gj_Ctx* ctx, Gj_IfaceIncomingConn* conn)
 Create a new stream from a Gj_IfaceIncomingConn. More...

int Gj_stream_delete (Gj_Ctx* ctx, Gj_Stream* stream)
 Destroy a stream. More...

char* Gj_stream_getAddr (Gj_Ctx* ctx, Gj_Stream* stream)
 Get the address of a stream. More...

int Gj_stream_open (Gj_Ctx* ctx, Gj_Stream* stream)
 Open the stream. More...

int Gj_stream_close (Gj_Ctx* ctx, Gj_Stream* stream)
 Close the stream. More...

int Gj_stream_flush (Gj_Ctx* ctx, Gj_Stream* stream)
 Flush the stream. More...

int Gj_stream_writeI32 (Gj_Ctx* ctx, Gj_Stream* stream, Gj_Si32 value)
 Write a 32-bit integer value to the stream. More...

int Gj_stream_writeI16 (Gj_Ctx* ctx, Gj_Stream* stream, Gj_Si16 value)
 Write a 16-bit integer value to the stream. More...

int Gj_stream_writeI8 (Gj_Ctx* ctx, Gj_Stream* stream, Gj_Si8 value)
 Write a 8-bit integer value to the stream. More...

int Gj_stream_writeF64 (Gj_Ctx* ctx, Gj_Stream* stream, Gj_F64 value)
 Write a 64-bit float value to the stream. More...

int Gj_stream_writeF32 (Gj_Ctx* ctx, Gj_Stream* stream, Gj_F32 value)
 Write a 32-bit float value to the stream. More...

int Gj_stream_writeStr (Gj_Ctx* ctx, Gj_Stream* stream, char* string)
 Write a string to the stream. More...

int Gj_stream_readI32 (Gj_Ctx* ctx, Gj_Stream* stream, Gj_Si32* value)
 Read a 32-bit integer value from the stream. More...

int Gj_stream_readI16 (Gj_Ctx* ctx, Gj_Stream* stream, Gj_Si16* value)
 Read a 16-bit integer value from the stream. More...

int Gj_stream_readI8 (Gj_Ctx* ctx, Gj_Stream* stream, Gj_Si8* value)
 Read a 8-bit integer value from the stream. More...

int Gj_stream_readF64 (Gj_Ctx* ctx, Gj_Stream* stream, Gj_F64* value)
 Read a 64-bit float value from the stream. More...

int Gj_stream_readF32 (Gj_Ctx* ctx, Gj_Stream* stream, Gj_F32* value)
 Read a 32-bit float value from the stream. More...

int Gj_stream_readStr (Gj_Ctx* ctx, Gj_Stream* stream, char** string)
 Read a string from the stream. More...

int gj_stream_readLow (Gj_Ctx* ctx, Gj_Stream* stream, void* ptr, int size)
 Read size bytes from the lower layers and write them to the given memory location. More...

int gj_stream_writeLow (Gj_Ctx* ctx, Gj_Stream* stream, void* ptr, int size)
 Write size bytes from the given memory location to the lower layers. More...


Detailed Description

Stream implementation.


Define Documentation

#define Gj_stream_writeInt( ctx, stream, value )   Gj_stream_writeI32((ctx), (stream), (value))
 

Write an int to the stream.

Returns:
0 on success, -1 otherwise.

#define Gj_stream_writeDouble( ctx, stream, value )   Gj_stream_writeF64((ctx), (stream), (value))
 

Write a double to the stream.

Returns:
0 on success, -1 otherwise.

#define Gj_stream_writeChar( ctx, stream, value )   Gj_stream_writeI8((ctx), (stream), (value))
 

Write a char to the stream.

Returns:
0 on success, -1 otherwise.

#define Gj_stream_writeWchar( ctx, stream, value )   Gj_stream_writeI32((ctx), (stream), (value))
 

Write a wchar_t to the stream.

Returns:
0 on success, -1 otherwise.

#define Gj_stream_writeBool( ctx, stream, value )   Gj_stream_writeI8((ctx), (stream), (value))
 

Write a Gj_Bool to the stream.

Returns:
0 on success, -1 otherwise.

#define Gj_stream_readInt( ctx, stream, value )   Gj_stream_readI32((ctx), (stream), (value))
 

Read a int from the stream.

Returns:
0 on success, -1 otherwise.

#define Gj_stream_readDouble( ctx, stream, value )   Gj_stream_readF64((ctx), (stream), (value))
 

Read a double from the stream.

Returns:
0 on success, -1 otherwise.

#define Gj_stream_readChar( ctx, stream, value )   Gj_stream_readI8((ctx), (stream), (value))
 

Read a char from the stream.

Returns:
0 on success, -1 otherwise.

#define Gj_stream_readWchar( ctx, stream, value )   Gj_stream_readI32((ctx), (stream), (value))
 

Read a wchar_t from the stream.

Returns:
0 on success, -1 otherwise.

#define Gj_stream_readBool( ctx, stream, value )   Gj_stream_readI8((ctx), (stream), (value))
 

Read a Gj_Bool from the stream.

Returns:
0 on success, -1 otherwise.


Function Documentation

Gj_Stream * Gj_stream_new ( Gj_Ctx * ctx,
Gj_Id * iface,
char * addr )
 

Create a new stream.

Parameters:
ctx   The context.
iface   The iface id.
addr   The destination address (is NOT being DUPLICATED and not deleted on destruction, too).

Returns:
The pointer to the new stream on success, 0 otherwise.

Gj_Stream * Gj_stream_newFromIncomingConn ( Gj_Ctx * ctx,
Gj_IfaceIncomingConn * conn )
 

Create a new stream from a Gj_IfaceIncomingConn.

The port of the connection must not be closed anymore - this is done by the stream. The clientaddr has still to be freed on destruction of the connection.

Parameters:
ctx   The context (of the connection).
conn   The incoming connection (including the context of the listening function).

Returns:
The pointer to the new stream on success, 0 otherwise.

int Gj_stream_delete ( Gj_Ctx * ctx,
Gj_Stream * ptr )
 

Destroy a stream.

The address is not deleted.

Parameters:
ctx   The context.
stream   The stream.

Returns:
0 on success, -1 otherwise.

char * Gj_stream_getAddr ( Gj_Ctx * ctx,
Gj_Stream * stream )
 

Get the address of a stream.

Parameters:
ctx   The context.
stream   The stream.

Returns:
The address (not duplicated).

int Gj_stream_open ( Gj_Ctx * ctx,
Gj_Stream * stream )
 

Open the stream.

Returns:
0 on success, -1 otherwise .

int Gj_stream_close ( Gj_Ctx * ctx,
Gj_Stream * stream )
 

Close the stream.

Returns:
0 on success, -1 otherwise.

int Gj_stream_flush ( Gj_Ctx * ctx,
Gj_Stream * stream )
 

Flush the stream.

Returns:
0 on success, -1 otherwise.

int Gj_stream_writeI32 ( Gj_Ctx * ctx,
Gj_Stream * stream,
Gj_Si32 value )
 

Write a 32-bit integer value to the stream.

Returns:
0 on success, -1 otherwise.

int Gj_stream_writeI16 ( Gj_Ctx * ctx,
Gj_Stream * stream,
Gj_Si16 value )
 

Write a 16-bit integer value to the stream.

Returns:
0 on success, -1 otherwise.

int Gj_stream_writeI8 ( Gj_Ctx * ctx,
Gj_Stream * stream,
Gj_Si8 value )
 

Write a 8-bit integer value to the stream.

Returns:
0 on success, -1 otherwise.

int Gj_stream_writeF64 ( Gj_Ctx * ctx,
Gj_Stream * stream,
Gj_F64 value )
 

Write a 64-bit float value to the stream.

Returns:
0 on success, -1 otherwise.

int Gj_stream_writeF32 ( Gj_Ctx * ctx,
Gj_Stream * stream,
Gj_F32 value )
 

Write a 32-bit float value to the stream.

Returns:
0 on success, -1 otherwise.

int Gj_stream_writeStr ( Gj_Ctx * ctx,
Gj_Stream * stream,
char * string )
 

Write a string to the stream.

Accepts

string == 0 
.

Returns:
0 on success, -1 otherwise.

int Gj_stream_readI32 ( Gj_Ctx * ctx,
Gj_Stream * stream,
Gj_Si32 * value )
 

Read a 32-bit integer value from the stream.

Returns:
0 on success, -1 otherwise.

int Gj_stream_readI16 ( Gj_Ctx * ctx,
Gj_Stream * stream,
Gj_Si16 * value )
 

Read a 16-bit integer value from the stream.

Returns:
0 on success, -1 otherwise.

int Gj_stream_readI8 ( Gj_Ctx * ctx,
Gj_Stream * stream,
Gj_Si8 * value )
 

Read a 8-bit integer value from the stream.

Returns:
0 on success, -1 otherwise.

int Gj_stream_readF64 ( Gj_Ctx * ctx,
Gj_Stream * stream,
Gj_F64 * value )
 

Read a 64-bit float value from the stream.

Returns:
0 on success, -1 otherwise.

int Gj_stream_readF32 ( Gj_Ctx * ctx,
Gj_Stream * stream,
Gj_F32 * value )
 

Read a 32-bit float value from the stream.

Returns:
0 on success, -1 otherwise.

int Gj_stream_readStr ( Gj_Ctx * ctx,
Gj_Stream * stream,
char ** string )
 

Read a string from the stream.

The string is allocated via Gj_alloc.

Returns:
0 on success, -1 otherwise.

int gj_stream_readLow ( Gj_Ctx * ctx,
Gj_Stream * stream,
void * ptr,
int size )
 

Read size bytes from the lower layers and write them to the given memory location.

Returns:
0 on success, -1 otherwise.

For internal use only.

int gj_stream_writeLow ( Gj_Ctx * ctx,
Gj_Stream * stream,
void * ptr,
int size )
 

Write size bytes from the given memory location to the lower layers.

Returns:
0 on success, -1 otherwise.

For internal use only.


Generated at Fri Aug 17 18:28:58 2001 for Gobj by doxygen1.2.1 written by Dimitri van Heesch, © 1997-2000