char * axl_stream_get_until ( axlStream stream,
char *  valid_chars,
int *  chunk_matched,
bool  accept_terminator,
int  chunk_num,
  ... 
)

Returns the next chunk available on the stream.

This function allows to get next available chunk, validating it with provided valid_chars variable, until the chunk provided are found.

Currently, valid_chars is not used, so, the chunk returned is not validated against the value provided.

As an example if it is required to get the encoding content, you could do the next call:

 // reference to the allocated result
 char * result;
 
 // chunk matched variable
 int chunk_matched;
 
 // get the next chunk until a " or ' is found
 result = axl_stream_get_until (stream, NULL, &chunk_matched, TRUE, 2, "\"", "'");

Value returned from this function mustn't be deallocated. However, because the value returned is dinamically allocated by the function, you can avoid doing a double allocation operation by nullifying the internal reference to the result returned, making the caller the only owner of the reference returned. To do this use: axl_stream_nullify with LAST_CHUNK.

Parameters:
stream The stream were the chunk will be extracted.
valid_chars The valid set of characters, to validate content to be returned. Currently this is not implemented, so, you can provide a NULL value.
chunk_matched An optional pointer to an integer to notify the chunk matched by the function. Chunk matching notification starts from 0 up to number of chunks to match - 1. If the end of the stream is reached, -2 is returned.
accept_terminator While calling to this function, the terminator detected to stop the operation could also be accepted by the stream, making it not necessary to accept the terminator once the function have ended. However, this could be a problem while performing peeking code. You can provide a FALSE value to make the function to not accept the terminator found as to be consumed.
chunk_num The number of chunks to be checked as a valid terminators.
Returns:
The chunk recognizied, not including the terminator that have made this operation to stop.