message.c File Reference

#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <netinet/in.h>
#include "lo_types_internal.h"
#include "lo_internal.h"
#include "lo/lo.h"

Defines

#define LO_DEF_TYPE_SIZE   8
#define LO_DEF_DATA_SIZE   8
#define lo_pow2_over(a, b)   a = ((b > a) ? (a << ((int)((log(((double)b/(double)a))/0.69315)+1))) : a);

Functions

static int lo_message_add_typechar (lo_message m, char t)
static void * lo_message_add_data (lo_message m, size_t s)
void lo_arg_pp_internal (lo_type type, void *data, int bigendian)
lo_message lo_message_new ()
 Create a new lo_message object.
void lo_message_free (lo_message m)
 Free memory allocated by lo_message_new() and any subsequent lo_message_add_int32 lo_message_add*() calls.
int lo_message_add_varargs_internal (lo_message msg, const char *types, va_list ap, const char *file, int line)
int lo_message_add (lo_message msg, const char *types,...)
 Append a number of arguments to a message.
int lo_message_add_int32 (lo_message m, int32_t a)
 Append a data item and typechar of the specified type to a message.
int lo_message_add_float (lo_message m, float a)
 Append a data item and typechar of the specified type to a message. See lo_message_add_int32() for details.
int lo_message_add_string (lo_message m, const char *a)
 Append a data item and typechar of the specified type to a message. See lo_message_add_int32() for details.
int lo_message_add_blob (lo_message m, lo_blob a)
 Append a data item and typechar of the specified type to a message. See lo_message_add_int32() for details.
int lo_message_add_int64 (lo_message m, int64_t a)
 Append a data item and typechar of the specified type to a message. See lo_message_add_int32() for details.
int lo_message_add_timetag (lo_message m, lo_timetag a)
 Append a data item and typechar of the specified type to a message. See lo_message_add_int32() for details.
int lo_message_add_double (lo_message m, double a)
 Append a data item and typechar of the specified type to a message. See lo_message_add_int32() for details.
int lo_message_add_symbol (lo_message m, const char *a)
 Append a data item and typechar of the specified type to a message. See lo_message_add_int32() for details.
int lo_message_add_char (lo_message m, char a)
 Append a data item and typechar of the specified type to a message. See lo_message_add_int32() for details.
int lo_message_add_midi (lo_message m, uint8_t a[4])
 Append a data item and typechar of the specified type to a message. See lo_message_add_int32() for details.
int lo_message_add_true (lo_message m)
 Append a data item and typechar of the specified type to a message. See lo_message_add_int32() for details.
int lo_message_add_false (lo_message m)
 Append a data item and typechar of the specified type to a message. See lo_message_add_int32() for details.
int lo_message_add_nil (lo_message m)
 Append a data item and typechar of the specified type to a message. See lo_message_add_int32() for details.
int lo_message_add_infinitum (lo_message m)
 Append a data item and typechar of the specified type to a message. See lo_message_add_int32() for details.
int lo_strsize (const char *s)
 A function to calculate the amount of OSC message space required by a C char *.
size_t lo_arg_size (lo_type type, void *data)
 Return the storage size, in bytes, of the given argument.
char * lo_get_path (void *data, ssize_t size)
 Given a raw OSC message, return the message path.
ssize_t lo_validate_string (void *data, ssize_t size)
 Validate raw OSC string data. Where applicable, data should be in network byte order.
ssize_t lo_validate_blob (void *data, ssize_t size)
 Validate raw OSC blob data. Where applicable, data should be in network byte order.
ssize_t lo_validate_bundle (void *data, ssize_t size)
 Validate raw OSC bundle data. Where applicable, data should be in network byte order.
ssize_t lo_validate_arg (lo_type type, void *data, ssize_t size)
 Validate raw OSC argument data. Where applicable, data should be in network byte order.
void lo_arg_host_endian (lo_type type, void *data)
 Convert the specified argument to host byte order where necessary.
void lo_arg_network_endian (lo_type type, void *data)
 Convert the specified argument to network byte order where necessary.
lo_address lo_message_get_source (lo_message m)
 Returns the source (lo_address) of an incoming message.
lo_timetag lo_message_get_timestamp (lo_message m)
 Returns the timestamp (lo_timetag *) of a bundled incoming message.
size_t lo_message_length (lo_message m, const char *path)
 Return the length of a message in bytes.
int lo_message_get_argc (lo_message m)
 Return the message argument count.
lo_arg ** lo_message_get_argv (lo_message m)
 Return the message arguments. Do not free the returned data.
char * lo_message_get_types (lo_message m)
 Return the message type tag string.
void * lo_message_serialise (lo_message m, const char *path, void *to, size_t *size)
 Serialise the lo_message object to an area of memory and return a pointer to the serialised form. Opposite of lo_message_deserialise().
lo_message lo_message_deserialise (void *data, size_t size, int *result)
 Deserialise a raw OSC message and return a new lo_message object. Opposite of lo_message_serialise().
void lo_message_pp (lo_message m)
 Pretty-print a lo_message object.
void lo_arg_pp (lo_type type, void *data)
 Pretty-print a set of typed arguments.
int lo_is_numerical_type (lo_type a)
 Return true if the type specified has a numerical value, such as LO_INT32, LO_FLOAT etc.
int lo_is_string_type (lo_type a)
 Return true if the type specified has a textual value, such as LO_STRING or LO_SYMBOL.
int lo_coerce (lo_type type_to, lo_arg *to, lo_type type_from, lo_arg *from)
 Attempt to convert one OSC type to another.
lo_hires lo_hires_val (lo_type type, lo_arg *p)
 Return the numerical value of the given argument with the maximum native system precision.

Variables

static char lo_numerical_types []
static char lo_string_types []


Define Documentation

#define LO_DEF_TYPE_SIZE   8
 

#define LO_DEF_DATA_SIZE   8
 

#define lo_pow2_over a,
 )     a = ((b > a) ? (a << ((int)((log(((double)b/(double)a))/0.69315)+1))) : a);
 


Function Documentation

static int lo_message_add_typechar lo_message  m,
char  t
[static]
 

static void * lo_message_add_data lo_message  m,
size_t  s
[static]
 

void lo_arg_pp_internal lo_type  type,
void *  data,
int  bigendian
 

ssize_t lo_validate_string void *  data,
ssize_t  size
 

Validate raw OSC string data. Where applicable, data should be in network byte order.

This function is used internally to parse and validate raw OSC data.

Returns length of string or < 0 if data is invalid.

Parameters:
data A pointer to the data.
size The size of data in bytes (total bytes remaining).

ssize_t lo_validate_blob void *  data,
ssize_t  size
 

Validate raw OSC blob data. Where applicable, data should be in network byte order.

This function is used internally to parse and validate raw OSC data.

Returns length of blob or < 0 if data is invalid.

Parameters:
data A pointer to the data.
size The size of data in bytes (total bytes remaining).

ssize_t lo_validate_bundle void *  data,
ssize_t  size
 

Validate raw OSC bundle data. Where applicable, data should be in network byte order.

This function is used internally to parse and validate raw OSC data.

Returns length of bundle or < 0 if data is invalid.

Parameters:
data A pointer to the data.
size The size of data in bytes (total bytes remaining).

ssize_t lo_validate_arg lo_type  type,
void *  data,
ssize_t  size
 

Validate raw OSC argument data. Where applicable, data should be in network byte order.

This function is used internally to parse and validate raw OSC data.

Returns length of argument data or < 0 if data is invalid.

Parameters:
type The OSC type of the data item (eg. LO_FLOAT).
data A pointer to the data.
size The size of data in bytes (total bytes remaining).


Variable Documentation

char lo_numerical_types[] [static]
 

Initial value:

char lo_string_types[] [static]
 

Initial value:

 {
    LO_STRING,
    LO_SYMBOL,
    '\0'
}


Generated on Sat Oct 17 14:12:33 2009 for CSL by  doxygen 1.4.5-20051010