aboutsummaryrefslogtreecommitdiff
path: root/iemnet_data.h
diff options
context:
space:
mode:
authorIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2010-04-07 14:22:19 +0000
committerIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2010-04-07 14:22:19 +0000
commit08d63d87d4ff70428c5ac3bf48a8673371ad1f99 (patch)
tree4579e8c24b0798efe793773dd50e9e15fbd5227a /iemnet_data.h
parent2686a9a7be466d7193ff8a2ad44467945d116709 (diff)
nice documentation (this file is not so private any more)
svn path=/trunk/externals/iem/iemnet/; revision=13389
Diffstat (limited to 'iemnet_data.h')
-rw-r--r--iemnet_data.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/iemnet_data.h b/iemnet_data.h
index 6124a85..0039e43 100644
--- a/iemnet_data.h
+++ b/iemnet_data.h
@@ -28,6 +28,8 @@
/* */
/* ---------------------------------------------------------------------------- */
+#ifndef INCLUDE__IEMNET_DATA_H_
+#define INCLUDE__IEMNET_DATA_H_
/**
* a resizable list of float-only atoms
@@ -55,6 +57,66 @@ void iemnet__floatlist_destroy(t_iemnet_floatlist*cl);
/**
+ * chunk of data as sent to a socket or received from it
+ * for received data, this might additionally hold the originator (if available)
+ */
+typedef struct _iemnet_chunk {
+ unsigned char* data;
+ size_t size;
+
+ long addr;
+ unsigned short port;
+} t_iemnet_chunk;
+
+/**
+ * free a "chunk" (de-allocate memory,...)
+ */
+void iemnet__chunk_destroy(t_iemnet_chunk*);
+
+/**
+ * initialize a "chunk" (allocate memory,...) of fixed size
+ * receiver address will be set to 0
+ *
+ * \param size of the chunk (data will be zeroed out)
+ * \return a new chunk of given size
+ */
+t_iemnet_chunk*iemnet__chunk_create_empty(int);
+/**
+ * initialize a "chunk" (allocate memory,...) with given data
+ * receiver address will be set to 0
+ *
+ * \param size of data
+ * \param data of size
+ * \return a new chunk that holds a copy of data
+ */
+t_iemnet_chunk*iemnet__chunk_create_data(int size, unsigned char*data);
+/**
+ * initialize a "chunk" (allocate memory,...) with given data from specified address
+ * \param size of data
+ * \param data of size
+ * \param addr originating address (can be NULL)
+ * \return a new chunk that holds a copy of data
+ */
+t_iemnet_chunk*iemnet__chunk_create_dataaddr(int size, unsigned char*data, struct sockaddr_in*addr);
+/**
+ * initialize a "chunk" (allocate memory,...) with given data
+ * receiver address will be set to 0
+ *
+ * \param argc size of list
+ * \param argv list of atoms containing only "bytes" (t_floats [0..255])
+ * \return a new chunk that holds a copy of the list data
+ */
+t_iemnet_chunk*iemnet__chunk_create_list(int argc, t_atom*argv);
+/**
+ * initialize a "chunk" (allocate memory,...) from another chunk
+ *
+ * \param src the source chunk
+ * \return a new chunk that holds a copy of the source data
+ */
+t_iemnet_chunk*iemnet__chunk_create_chunk(t_iemnet_chunk*source);
+
+
+/**
* convert a data chunk to a Pd-list of A_FLOATs
* the destination list will eventually be resized if it is too small to hold the chunk
*
@@ -136,3 +198,6 @@ void queue_destroy(t_iemnet_queue* q);
* \return the newly created queue; if something went wrong NULL is returned
*/
t_iemnet_queue* queue_create(void);
+
+
+#endif /* INCLUDE__IEMNET_DATA_H_ */