61#define ose_pnbytes(n) (((n) + 4) & 0xfffffffc)
164bool ose_blobContainsBundleAtOffset(ose_constbundle
B,
165 const int32_t offset);
166bool ose_blobContainsBundle(ose_constbundle
B);
381 const char *
const s,
383 int32_t slen_padded);
385int32_t ose_processEscapes(
char *s);
435#define ose_addToInt32(b, offset, amt) \
436 ose_writeInt32((b), \
438 ose_readInt32((b), (offset)) + (amt))
513 const char *
const blob);
515#ifdef OSE_PROVIDE_TYPE_SYMBOL
516#define ose_readSymbol(b, o) ose_readString((b), (o))
517#define ose_writeSymbol(b, o, s) ose_writeString((b), (o), (s))
519#ifdef OSE_PROVIDE_TYPE_DOUBLE
520double ose_readDouble(ose_constbundle
B, int32_t offset);
521int32_t ose_writeDouble(
ose_bundle B, int32_t offset,
double f);
523#ifdef OSE_PROVIDE_TYPE_INT8
524#define ose_readInt8(b, o) ose_readInt32((b), (o))
525#define ose_writeInt8(b, o, i) ose_writeInt32((b), (o), (i))
527#ifdef OSE_PROVIDE_TYPE_UINT8
528#define ose_readUInt8(b, o) ose_readInt32((b), (o))
529#define ose_writeUInt8(b, o, i) ose_writeInt32((b), (o), (i))
531#ifdef OSE_PROVIDE_TYPE_INT16
532int16_t ose_readInt16(ose_constbundle
B, int32_t offset);
533int32_t ose_writeInt16(
ose_bundle B, int32_t offset, int16_t i);
535#ifdef OSE_PROVIDE_TYPE_UINT16
536uint16_t ose_readUInt16(ose_constbundle
B, int32_t offset);
541#ifdef OSE_PROVIDE_TYPE_UINT32
542uint32_t ose_readUInt32(ose_constbundle
B, int32_t offset);
547#ifdef OSE_PROVIDE_TYPE_INT64
548int64_t ose_readInt64(ose_constbundle
B, int32_t offset);
549int32_t ose_writeInt64(
ose_bundle B, int32_t offset, int64_t i);
551#ifdef OSE_PROVIDE_TYPE_UINT64
552uint64_t ose_readUInt64(ose_constbundle
B, int32_t offset);
645 const int32_t offset);
659 const void *
const ptr);
676 const int32_t offset,
677 const void *
const ptr);
791 const char *
const addr);
814 const char *
const addr);
831 const char *
const addr);
836int32_t ose_getPayloadItemSize_hook(ose_constbundle
B,
838 const int32_t msg_offset,
839 const int32_t item_offset);
871 int32_t item_offset);
876int32_t ose_getPayloadItemLength_hook(ose_constbundle
B,
878 const int32_t msg_offset,
879 const int32_t item_offset);
911 int32_t item_offset);
955 int32_t *typetags_offset,
956 int32_t *num_typetags,
957 int32_t *last_typetag_offset,
958 int32_t *payload_offset,
959 int32_t *last_payload_item_offset);
1024 const char *
const address,
1037 const char *
const address,
1054 const char *
const address,
1055 const int32_t addresslen,
1067 const char *
const address,
1068 const int32_t addresslen,
1073int32_t ose_printTypeof0(ose_constbundle
B,
1074 const int32_t offset,
1077int32_t ose_printTypeof1(ose_constbundle
B,
1078 const int32_t offset,
1081int32_t ose_printTypeof2(ose_constbundle
B,
1082 const int32_t offset,
1121 const char *
const pattern);
1141 const char *
const pattern);
1168 const char *
const pattern);
1185 const char *
const pattern,
1202 const char *
const pattern,
1231 const char *
const pattern,
1236int32_t ose_fromString_hook(
ose_bundle bundle,
1238 const char *
const str);
1242 const char *
const getPayloadItemLength_addr,
1243 ose_getPayloadItemLengthFn getPayloadItemLength,
1244 const char *
const getPayloadItemSize_addr,
1245 ose_getPayloadItemSizeFn getPayloadItemSize,
1246 const char *
const pprintPayloadItem_addr,
1247 ose_pprintPayloadItemFn pprintPayloadItem,
1248 const char *
const evalType_addr,
1250 const char *
const fromString_addr,
1328 const int32_t size);
1330int32_t ose_validateMessage(
const char *
const bytes,
const int32_t size);
1350#if !defined(OSE_CONF_DEBUG) && !defined(OSE_INLINE_ACCESSORS_OFF)
1354static inline int32_t ose_readInt32_inline(ose_constbundle
B, int32_t o)
1355{
return ose_ntohl(*((
const int32_t *)(ose_getBundlePtr(
B) + o))); }
1356static inline char ose_readByte_inline(ose_constbundle
B, int32_t o)
1357{
return ose_getBundlePtr(
B)[o]; }
1358#define ose_readInt32(B, o) ose_readInt32_inline((B), (o))
1359#define ose_readByte(B, o) ose_readByte_inline((B), (o))
1360static inline bool ose_bundleIsEmpty_inline(ose_constbundle
B)
1361{
return ose_readSize(
B) <= OSE_BUNDLE_HEADER_LEN; }
1362static inline char ose_getBundleElemType_inline(ose_constbundle
B, int32_t o)
1364 const char *
const b = ose_getBundlePtr(
B) + o + 4;
1365 return (b[0] == OSE_BUNDLE_ID_[0] && !memcmp(b, OSE_BUNDLE_ID, 8))
1366 ? OSETT_BUNDLE : OSETT_MESSAGE;
1368static inline int32_t ose_getLastBundleElemOffset_inline(ose_constbundle
B)
1370 const int32_t bs = ose_readSize(
B);
1371 int32_t o = OSE_BUNDLE_HEADER_LEN, s;
1372 if(bs == OSE_BUNDLE_HEADER_LEN)
1374 return OSE_BUNDLE_HEADER_LEN;
1377 while(o + s + 4 < bs)
1389#define ose_bundleIsEmpty(B) ose_bundleIsEmpty_inline(B)
1390#define ose_getBundleElemType(B, o) ose_getBundleElemType_inline((B), (o))
1391#define ose_getLastBundleElemOffset(B) ose_getLastBundleElemOffset_inline(B)
provides global definitions and types
contains functions that structure an OSC bundle for use with other parts of this library
Status codes for context bundles.
@ OSE_ERR_MALFORMED
Definition ose_errno.h:50
#define B(...)
Instantiate a top-level OSC bundle.
Definition ose_test_ctosc.h:339
int ose_typechk1_ex(ose_bundle B, const char *const pattern, int32_t *elem, int32_t *item)
As ose_typechk1, additionally reporting where the mismatch was.
Definition ose_util.c:2659
int32_t ose_getFirstOffsetForMatch(ose_bundle B, const char *const addr)
Get the offset of the first element whose address matches a string, using simple string comparison.
Definition ose_util.c:1300
int32_t ose_writeString(ose_bundle B, int32_t offset, const char *const s, int32_t slen, int32_t slen_padded)
Read a byte at an offset.
Definition ose_util.c:556
char ose_getBundleElemType(ose_bundle B, int32_t offset)
Get the type of a bundle element.
Definition ose_util.c:406
int32_t ose_getStringLen(ose_bundle B, int32_t offset)
Get the length of a string at an offset.
Definition ose_util.c:518
char ose_readByte(ose_bundle B, int32_t offset)
Read a byte at an offset.
Definition ose_util.c:429
int32_t ose_getBundleElemPayloadOffset(ose_bundle B, int32_t elemoffset)
Get the offset in bytes of the payload of an element.
Definition ose_util.c:1277
float ose_readFloat(ose_bundle B, int32_t offset)
Read a 32-bit float at an offset.
Definition ose_util.c:472
const char * ose_readBlob(ose_bundle B, int32_t offset)
Read a blob at an offset.
Definition ose_util.c:721
void *const ose_readAlignedPtr(ose_bundle B, const int32_t offset)
Read a pointer at an offset.
Definition ose_util.c:1053
bool ose_isStringType(char typetag)
Determine whether a given character is a string type.
Definition ose_util.c:149
int32_t ose_writeFloat(ose_bundle B, int32_t offset, float f)
Write a 32-bit float at an offset.
Definition ose_util.c:485
int32_t ose_writeAlignedPtr_impl(char *b, const void *const ptr)
Write a pointer.
Definition ose_util.c:1067
int32_t ose_getFirstOffsetForFullPMatch(ose_bundle B, const char *const addr)
Get the offset of the first element whose address fully matches a string, using OSC pattern matching ...
Definition ose_util.c:1388
int32_t ose_getBundleElemElemCount(ose_bundle B, int32_t offset)
Get the number of items in a bundle element.
Definition ose_util.c:348
int32_t ose_getBundleElemTTOffset(ose_bundle B, int32_t elemoffset)
Get the offset in bytes of the typetag / timetag field of an element.
Definition ose_util.c:1261
int ose_typechk2(ose_bundle B, const char *const pattern)
Check a bundle's element types and their contents.
Definition ose_util.c:2681
bool ose_bundleIsEmpty(ose_bundle B)
Determine whether a bundle contains any elements.
Definition ose_util.c:309
int32_t ose_writeInt32(ose_bundle B, int32_t offset, int32_t i)
Write a 32-bit int at an offset.
Definition ose_util.c:460
int ose_typechk1(ose_bundle B, const char *const pattern)
Check a bundle's element types.
Definition ose_util.c:2676
const char * ose_readString(ose_bundle B, int32_t offset)
Read a string at an offset.
Definition ose_util.c:500
double ose_timetagToDouble(struct ose_timetag tt)
Convert a timetag to a double-precision float.
Definition ose_util.c:1023
const char * ose_readBlobPayload(ose_bundle B, int32_t offset)
Get a pointer to the payload of a blob at an offset.
Definition ose_util.c:783
int32_t ose_writeMessage(ose_bundle B, int32_t offset, const char *const address, int32_t addresslen, int32_t n,...)
Write a message with arguments into a bundle at an offset.
Definition ose_util.c:2145
int32_t ose_writeBlob(ose_bundle B, int32_t offset, int32_t blobsize, const char *const blob)
Write a blob at an offset.
Definition ose_util.c:794
bool ose_isBoolType(char typetag)
Determine whether a given character is either OSETT_TRUE or OSETT_FALSE.
Definition ose_util.c:244
int32_t ose_readBlobSize(ose_bundle B, int32_t offset)
Get the size of a blob.
Definition ose_util.c:730
int32_t ose_vcomputeMessageSize(ose_bundle B, const char *const address, const int32_t addresslen, const int32_t n, va_list ap)
Compute the size of a message.
Definition ose_util.c:1715
int32_t ose_writeAlignedPtr(ose_bundle B, const int32_t offset, const void *const ptr)
Write a pointer at an offset.
Definition ose_util.c:1080
struct ose_timetag ose_readTimetag(ose_bundle B, int32_t offset)
Read a timetag at an offset.
Definition ose_util.c:990
int ose_typechk0_ex(ose_bundle B, const char *const pattern, int32_t *elem, int32_t *item)
As ose_typechk0, additionally reporting where the mismatch was.
Definition ose_util.c:2653
int32_t ose_getBundleElemAddressOffset(ose_bundle B, int32_t elemoffset)
Get the offset in bytes of the address of an element.
Definition ose_util.c:1250
bool ose_isAddressChar(char c)
Determine whether a given character is a valid OSC address character.
Definition ose_util.c:44
bool ose_isKnownTypetag(char typetag)
Determine whether a given character is a typetag known to the system.
Definition ose_util.c:67
int ose_typechk2_ex(ose_bundle B, const char *const pattern, int32_t *elem, int32_t *item)
As ose_typechk2, additionally reporting where the mismatch was.
Definition ose_util.c:2665
void ose_getNthPayloadItem(ose_bundle B, int32_t n, int32_t msg_offset, int32_t *typetags_offset, int32_t *num_typetags, int32_t *last_typetag_offset, int32_t *payload_offset, int32_t *last_payload_item_offset)
Get the offset of the nth payload item of a message.
Definition ose_util.c:1637
int32_t ose_getLastBundleElemOffset(ose_bundle B)
Get the offset in bytes of the last bundle element.
Definition ose_util.c:1197
int32_t ose_vwriteMessage(ose_bundle B, int32_t offset, const char *const address, int32_t addresslen, int32_t n, va_list ap)
Write a message with arguments into a bundle at an offset.
Definition ose_util.c:1872
int32_t ose_getBundleElemCount(ose_bundle B)
Get the number of elements in a bundle.
Definition ose_util.c:327
bool ose_isBundle(ose_bundle B)
Determine whether the data pointed to contains a bundle or not.
Definition ose_util.c:274
int32_t ose_getPaddedBlobSize(ose_bundle B, int32_t offset)
Get the padded size of a blob at an offset.
Definition ose_util.c:757
int32_t ose_getPayloadItemLength(ose_bundle B, char typetag, int32_t msg_offset, int32_t item_offset)
Calculate the length of a typed OSC item.
Definition ose_util.c:1536
bool ose_isNumericType(char typetag)
Determine whether a given character is a numeric type.
Definition ose_util.c:209
int32_t ose_writeByte(ose_bundle B, int32_t offset, char i)
Write a byte at an offset.
Definition ose_util.c:438
int32_t ose_pstrlen(const char *const s)
Get the padded length of a string.
Definition ose_util.c:38
int ose_typechk0(ose_bundle B, const char *const pattern)
Check the type of a bundle itself.
Definition ose_util.c:2671
int32_t ose_getBlobPaddingForNBytes(int32_t n)
Get the number of bytes required to pad a blob size to a multiple of 4 bytes.
Definition ose_util.c:739
void ose_dropAtOffset(ose_bundle B, int32_t offset)
Drop the last element in the bundle.
Definition ose_util.c:1095
int32_t ose_getFirstOffsetForPMatch(ose_bundle B, const char *const addr)
Get the offset of the first element whose pattern matches a string, using OSC pattern matching.
Definition ose_util.c:1360
bool ose_isUnitType(char typetag)
Determine whether a given character is a unit type.
Definition ose_util.c:226
bool ose_isIntegerType(char typetag)
Determine whether a given character is an integer type.
Definition ose_util.c:163
bool ose_isFloatType(char typetag)
Determine whether a given character is a floating point type.
Definition ose_util.c:195
int32_t ose_getPaddedStringLen(ose_bundle B, int32_t offset)
Get the padded length of a string at an offset.
Definition ose_util.c:535
int32_t ose_readInt32(ose_bundle B, int32_t offset)
Read a 32-bit int at an offset.
Definition ose_util.c:451
int32_t ose_validateBundle(const char *const bytes, const int32_t size)
Check that bytes is a well formed OSC bundle, entirely within size bytes.
Definition ose_util.c:3108
int32_t ose_validateBundleInternal(const char *const bytes, const int32_t size)
As ose_validateBundle(), for a single message with no bundle header.
Definition ose_util.c:3117
bool ose_bundleHasAtLeastNElems(ose_bundle B, int32_t n)
Determine whether a bundle has a minimum number of elements.
Definition ose_util.c:379
void *const ose_readAlignedPtr_impl(const char *const b)
Read a pointer.
Definition ose_util.c:1042
int32_t ose_computeMessageSize(ose_bundle B, const char *const address, const int32_t addresslen, const int32_t n,...)
Compute the size of a message.
Definition ose_util.c:1851
int32_t ose_getPayloadItemSize(ose_bundle B, char typetag, int32_t msg_offset, int32_t item_offset)
Calculate the size of a typed OSC item.
Definition ose_util.c:1425
int32_t ose_writeTimetag(ose_bundle B, int32_t offset, uint32_t sec, uint32_t fsec)
Write a timetag at an offset.
Definition ose_util.c:1006
struct ose_timetag ose_doubleToTimetag(double d)
Convert a double-precision float to a timetag.
Definition ose_util.c:1029