libose
Loading...
Searching...
No Matches
ose_util.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2019-23 John MacCallum Permission is hereby granted,
3 free of charge, to any person obtaining a copy of this software
4 and associated documentation files (the "Software"), to deal in
5 the Software without restriction, including without limitation the
6 rights to use, copy, modify, merge, publish, distribute,
7 sublicense, and/or sell copies of the Software, and to permit
8 persons to whom the Software is furnished to do so, subject to the
9 following conditions:
10
11 The above copyright notice and this permission notice shall be
12 included in all copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
18 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
19 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 DEALINGS IN THE SOFTWARE.
22*/
23
37#ifndef OSE_UTIL_H
38#define OSE_UTIL_H
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#include <inttypes.h>
45#include <stdarg.h>
46#include "ose.h"
47
61#define ose_pnbytes(n) (((n) + 4) & 0xfffffffc)
62
71int32_t ose_pstrlen(const char * const s);
72
81bool ose_isAddressChar(char c);
82
91bool ose_isKnownTypetag(char typetag);
92
100bool ose_isStringType(char typetag);
101
109bool ose_isIntegerType(char typetag);
110
119bool ose_isFloatType(char typetag);
120
128bool ose_isNumericType(char typetag);
129
142bool ose_isUnitType(char typetag);
143
152bool ose_isBoolType(char typetag);
153
162bool ose_isBundle(ose_constbundle B);
163
164bool ose_blobContainsBundleAtOffset(ose_constbundle B,
165 const int32_t offset);
166bool ose_blobContainsBundle(ose_constbundle B);
167
177bool ose_bundleIsEmpty(ose_constbundle B);
178
187int32_t ose_getBundleElemCount(ose_constbundle B);
188
200int32_t ose_getBundleElemElemCount(ose_constbundle B,
201 int32_t offset);
202
214bool ose_bundleHasAtLeastNElems(ose_constbundle B,
215 int32_t n);
216
229char ose_getBundleElemType(ose_constbundle B, int32_t offset);
230
231
242char ose_readByte(ose_constbundle B, int32_t offset);
243
244
256int32_t ose_writeByte(ose_bundle B, int32_t offset, char i);
257
258
270int32_t ose_readInt32(ose_constbundle B, int32_t offset);
271
272
285int32_t ose_writeInt32(ose_bundle B, int32_t offset, int32_t i);
286
287
299float ose_readFloat(ose_constbundle B, int32_t offset);
300
313int32_t ose_writeFloat(ose_bundle B, int32_t offset, float f);
314
315
329const char *ose_readString(ose_constbundle B, int32_t offset);
330
331
343int32_t ose_getStringLen(ose_constbundle B, int32_t offset);
344
345
358int32_t ose_getPaddedStringLen(ose_constbundle B,
359 int32_t offset);
360
361
380 int32_t offset,
381 const char * const s,
382 int32_t slen,
383 int32_t slen_padded);
384
385int32_t ose_processEscapes(char *s);
386
403const char *ose_readBlob(ose_constbundle B, int32_t offset);
404
405
420int32_t ose_readBlobSize(ose_constbundle B, int32_t offset);
421
422
435#define ose_addToInt32(b, offset, amt) \
436 ose_writeInt32((b), \
437 (offset), \
438 ose_readInt32((b), (offset)) + (amt))
439
440
441
455int32_t ose_getBlobPaddingForNBytes(int32_t n);
456
469int32_t ose_getPaddedBlobSize(ose_constbundle B,
470 int32_t offset);
471
490const char *ose_readBlobPayload(ose_constbundle B,
491 int32_t offset);
492
511 int32_t offset,
512 int32_t blobsize,
513 const char * const blob);
514
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))
518#endif
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);
522#endif
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))
526#endif
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))
530#endif
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);
534#endif
535#ifdef OSE_PROVIDE_TYPE_UINT16
536uint16_t ose_readUInt16(ose_constbundle B, int32_t offset);
537int32_t ose_writeUInt16(ose_bundle B,
538 int32_t offset,
539 uint16_t i);
540#endif
541#ifdef OSE_PROVIDE_TYPE_UINT32
542uint32_t ose_readUInt32(ose_constbundle B, int32_t offset);
543int32_t ose_writeUInt32(ose_bundle B,
544 int32_t offset,
545 uint32_t i);
546#endif
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);
550#endif
551#ifdef OSE_PROVIDE_TYPE_UINT64
552uint64_t ose_readUInt64(ose_constbundle B, int32_t offset);
553int32_t ose_writeUInt64(ose_bundle B,
554 int32_t offset,
555 uint64_t i);
556#endif
557
571struct ose_timetag ose_readTimetag(ose_constbundle B,
572 int32_t offset);
573
588 int32_t offset,
589 uint32_t sec,
590 uint32_t fsec);
591
601double ose_timetagToDouble(struct ose_timetag tt);
602
610struct ose_timetag ose_doubleToTimetag(double d);
611
625void * const ose_readAlignedPtr_impl(const char * const b);
626
644void * const ose_readAlignedPtr(ose_constbundle B,
645 const int32_t offset);
646
658int32_t ose_writeAlignedPtr_impl(char *b,
659 const void * const ptr);
660
676 const int32_t offset,
677 const void * const ptr);
678
702void ose_dropAtOffset(ose_bundle B, int32_t offset);
703
719int32_t ose_getLastBundleElemOffset(ose_constbundle B);
720
737int32_t ose_getBundleElemAddressOffset(ose_constbundle B,
738 int32_t elemoffset);
739
755int32_t ose_getBundleElemTTOffset(ose_constbundle B,
756 int32_t elemoffset);
757
773int32_t ose_getBundleElemPayloadOffset(ose_constbundle B,
774 int32_t elemoffset);
775
790int32_t ose_getFirstOffsetForMatch(ose_constbundle B,
791 const char * const addr);
792
813int32_t ose_getFirstOffsetForPMatch(ose_constbundle B,
814 const char * const addr);
815
830int32_t ose_getFirstOffsetForFullPMatch(ose_constbundle B,
831 const char * const addr);
832
836int32_t ose_getPayloadItemSize_hook(ose_constbundle B,
837 const char typetag,
838 const int32_t msg_offset,
839 const int32_t item_offset);
840
868int32_t ose_getPayloadItemSize(ose_constbundle B,
869 char typetag,
870 int32_t msg_offset,
871 int32_t item_offset);
872
876int32_t ose_getPayloadItemLength_hook(ose_constbundle B,
877 const char typetag,
878 const int32_t msg_offset,
879 const int32_t item_offset);
908int32_t ose_getPayloadItemLength(ose_constbundle B,
909 char typetag,
910 int32_t msg_offset,
911 int32_t item_offset);
912
952void ose_getNthPayloadItem(ose_constbundle B,
953 int32_t n,
954 int32_t msg_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);
960
1021#ifndef SWIGCSHARP
1023 int32_t offset,
1024 const char * const address,
1025 int32_t addresslen,
1026 int32_t n, ...);
1027#endif
1028
1034#ifndef SWIGCSHARP
1036 int32_t offset,
1037 const char * const address,
1038 int32_t addresslen,
1039 int32_t n,
1040 va_list ap);
1041#endif
1042
1052#ifndef SWIGCSHARP
1054 const char * const address,
1055 const int32_t addresslen,
1056 const int32_t n,
1057 ...);
1058#endif
1059
1065#ifndef SWIGCSHARP
1067 const char * const address,
1068 const int32_t addresslen,
1069 const int32_t n,
1070 va_list ap);
1071#endif
1072
1073int32_t ose_printTypeof0(ose_constbundle B,
1074 const int32_t offset,
1075 char *buf,
1076 int32_t buflen);
1077int32_t ose_printTypeof1(ose_constbundle B,
1078 const int32_t offset,
1079 char *buf,
1080 int32_t buflen);
1081int32_t ose_printTypeof2(ose_constbundle B,
1082 const int32_t offset,
1083 char *buf,
1084 int32_t buflen);
1085
1120int ose_typechk0(ose_constbundle B,
1121 const char * const pattern);
1122
1140int ose_typechk1(ose_constbundle B,
1141 const char * const pattern);
1142
1167int ose_typechk2(ose_constbundle B,
1168 const char * const pattern);
1169
1184int ose_typechk0_ex(ose_constbundle B,
1185 const char * const pattern,
1186 int32_t *elem,
1187 int32_t *item);
1188
1201int ose_typechk1_ex(ose_constbundle B,
1202 const char * const pattern,
1203 int32_t *elem,
1204 int32_t *item);
1205
1230int ose_typechk2_ex(ose_constbundle B,
1231 const char * const pattern,
1232 int32_t *elem,
1233 int32_t *item);
1236int32_t ose_fromString_hook(ose_bundle bundle,
1237 char typetag,
1238 const char * const str);
1239
1240void ose_registerType_hook(ose_bundle bundle,
1241 char typetag,
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,
1249 void (*evalType)(ose_bundle),
1250 const char * const fromString_addr,
1251 void (*fromString)(ose_bundle));
1252
1253/* SLIP framing lives in ose_slip.h now. */
1254
1255
1256/* The extern "C" block used to close HERE, leaving the three validators
1257 below outside it. From C++ they took C++ linkage and did not resolve
1258 against the C definitions -- so ose_validateBundle(),
1259 ose_validateBundleInternal() and ose_validateMessage() were unusable from
1260 every C++ host.
1261
1262 They are the boundary functions. Being unreachable from C++ meant the
1263 hosts most likely to be handed bytes off a socket were the ones that
1264 could not check them, and one such host's UDP read carried a
1265 "need to do a sanity check here!" comment where the call belongs. The
1266 block now closes at the end of the header, where it should have. */
1267
1296int32_t ose_validateBundle(const char * const bytes, const int32_t size);
1297
1327int32_t ose_validateBundleInternal(const char * const bytes,
1328 const int32_t size);
1329
1330int32_t ose_validateMessage(const char * const bytes, const int32_t size);
1331
1332#ifdef __cplusplus
1333}
1334#endif
1335
1336
1337
1338/* INLINE IN A RELEASE BUILD: ose_readInt32, ose_readByte,
1339 ose_bundleIsEmpty, ose_getBundleElemType and ose_getLastBundleElemOffset.
1340
1341 They are the most called functions in the VM and do almost nothing, and a
1342 call into another file cannot be inlined without link-time optimisation --
1343 which a host built as several libraries cannot have across them. Measured
1344 on one host's heaviest message path, seven of these inline took 20.7 to
1345 15.7 us; the whole of LTO took it to 13.2.
1346
1347 The functions are still defined and exported, for anything that takes
1348 their address or calls them from another language. A debug build calls
1349 them, and gets their asserts. OSE_INLINE_ACCESSORS_OFF turns this off. */
1350#if !defined(OSE_CONF_DEBUG) && !defined(OSE_INLINE_ACCESSORS_OFF)
1351#include <string.h>
1352#include "ose_errno.h"
1353#include "ose_context.h"
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)
1363{
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;
1367}
1368static inline int32_t ose_getLastBundleElemOffset_inline(ose_constbundle B)
1369{
1370 const int32_t bs = ose_readSize(B);
1371 int32_t o = OSE_BUNDLE_HEADER_LEN, s;
1372 if(bs == OSE_BUNDLE_HEADER_LEN)
1373 {
1374 return OSE_BUNDLE_HEADER_LEN;
1375 }
1376 s = ose_readInt32(B, o);
1377 while(o + s + 4 < bs)
1378 {
1379 if(s <= 0)
1380 {
1381 ose_context_set_status((ose_bundle)B, OSE_ERR_MALFORMED);
1382 return o;
1383 }
1384 o += s + 4;
1385 s = ose_readInt32(B, o);
1386 }
1387 return o;
1388}
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)
1392#endif
1393
1394#endif
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
Definition ose.h:374
Convenience struct for OSC/NTP timetags.
Definition ose.h:420
uint32_t sec
Definition ose.h:421
uint32_t fsec
Definition ose.h:422