dc_Sun.h File Reference

Persistence layer. More...


Defines

#define SUN_OK   0
 No error.
#define SUN_EOS   1
 End of stream.
#define SUN_IMPL_ERROR   2
 Implementation-specific.
#define SUN_NO_RESOURCE   3
 Resource not found.

Functions

DC_RT_FMAC1 void * sun_write_init (void *implementation, const char *sun_id, unsigned long *len)
 Prepares a storage unit for stream writing.
DC_RT_FMAC1 void * sun_read_init (void *implementation, const char *sun_id)
 Prepares an existing storage unit for stream reading.
DC_RT_FMAC1 int sun_stream_read (void *in_stream, char *buf, unsigned long *size)
 Performs a stream reading operation.
DC_RT_FMAC1 int sun_stream_write (void *out_stream, const char *buf, unsigned long *size)
 Performs a stream writing operation.
DC_RT_FMAC1 int sun_get_error (void *stream)
 Retrieves an implementation-dependent error code.
DC_RT_FMAC1 int sun_close (void *stream)
 Close a reading or writing context.


Detailed Description

Persistence layer.

Although it could be used implemented on other implementations than regular files the Storage UNit layer is implemented by default on 'stdio'.


Define Documentation

#define SUN_OK   0

No error.

#define SUN_EOS   1

End of stream.

#define SUN_IMPL_ERROR   2

Implementation-specific.

#define SUN_NO_RESOURCE   3

Resource not found.


Function Documentation

DC_RT_FMAC1 void* sun_write_init ( void *  implementation,
const char *  sun_id,
unsigned long *  len 
)

Prepares a storage unit for stream writing.

If the id is not known by the implementation, a new storage unit is created, else it is overwritten. A fixed size can be asked for the storage unit.

Parameters:
implementation A pointer on the SUN implementation. Reserved for later use (using NULL will select the default implementation on top of the stdio lib meaning that sun_id will stand for a filename).
sun_id Storage unit implementation-dependent unique id.
len If specified, a fixed-length storage unit is required and the granted length is returned. If NULL is supplied, an unspecified length is required.
Returns:
An implementation-dependent processing context if the implementation was able to provide the requested storage unit, named the SUN stream.

DC_RT_FMAC1 void* sun_read_init ( void *  implementation,
const char *  sun_id 
)

Prepares an existing storage unit for stream reading.

Parameters:
implementation A pointer on the SUN implementation. Reserved for later use (using NULL will select the default implementation on top of the stdio lib meaning that sun_id will stand for a filename).
sun_id Storage unit implementation-dependent unique id.
Returns:
An implementation-dependent processing context if the storage unit could be found and can be processed, named the SUN stream.

DC_RT_FMAC1 int sun_stream_read ( void *  in_stream,
char *  buf,
unsigned long *  size 
)

Performs a stream reading operation.

Reads bytes from the storage unit from the position it has been stopped by the previous read operation and if possible the number or requested bytes.

Parameters:
in_stream A SUN input stream.
buf The byte buffer where the read data is copied.
[in,out] size The size of the buffer is initially passed and the actual read data is returned.
Returns:
SUN_OK or any SUN error code like SUN_MAX_LIMIT if the end of the storage unit is reached (which does not mean the data has not been read).

DC_RT_FMAC1 int sun_stream_write ( void *  out_stream,
const char *  buf,
unsigned long *  size 
)

Performs a stream writing operation.

Writes bytes contained in the passed buffer after the bytes passed the previous read operation and if possible the number or requested bytes.

Parameters:
out_stream A SUN output stream.
buf The byte buffer where the data to write is stored.
[in,out] size The size of the buffer is initially passed and the actual written data is returned.
Returns:
SUN_OK or any SUN error code like SUN_MAX_LIMIT if the end of the storage unit is reached (which does not mean the data has not been stored).

DC_RT_FMAC1 int sun_get_error ( void *  stream  ) 

Retrieves an implementation-dependent error code.

To use after an SUN_IMPL_ERROR error code has been returned by a SUN API.

Parameters:
stream A SUN stream.
Returns:
The mplementation-dependent error code.

DC_RT_FMAC1 int sun_close ( void *  stream  ) 

Close a reading or writing context.

Parameters:
stream A SUN stream.
Returns:
SUN_OK or any SUN error code.


Generated on Fri Apr 17 15:18:25 2009 for DPWSCore by  doxygen 1.5.8