/users/dtb26/GITROOT/vs-vetserial-poc/include/messaging.h

Go to the documentation of this file.
00001 
00026 #ifndef MESSAGING_H_
00027 #define MESSAGING_H_
00028 
00029 #ifdef __cplusplus
00030 extern "C" {
00031 #endif
00032 
00033 #include <stdlib.h>
00034 
00035 #ifdef __cplusplus
00036         //#include "boost/cstdint.hpp"
00037         #include <stdint.h>
00038 #else
00039         #include <stdint.h>
00040 #endif
00041 
00042 struct array;
00043 struct datum;
00044 
00047 typedef enum {
00048         NULL_CONTENT = 0, 
00049         BYTE_CONTENT = 1, 
00050         INT8_CONTENT = 2, 
00051         UINT8_CONTENT = 3, 
00052         INT16_CONTENT = 4, 
00053         UINT16_CONTENT = 5, 
00054         INT32_CONTENT = 6, 
00055         UINT32_CONTENT = 7,
00056         INT64_CONTENT = 8,
00057         UINT64_CONTENT = 9,
00058         FLOAT_CONTENT = 10, 
00059         DOUBLE_CONTENT = 11
00061 } Message_content_type;
00062 
00068 typedef struct connection Connection;
00069 
00079 typedef struct channel Channel;
00080 
00082 typedef struct data {
00083 
00085         int length;
00086 
00088         Message_content_type type;
00089 
00091         void const *content;
00092 } Data;
00093 
00096 typedef struct message {
00098         int length;
00099 
00101         Data *fields;
00102 } Message;
00103 
00114 typedef struct messaging_controller {
00115 
00128         void (*poll)(Connection *connection[], int count, int timeout);
00129 
00131         void (*send_immediate)(Channel *channel, Message *message);
00132 
00143         int (*process_messages)(Connection *connection, short limit);
00144 } Messaging_Controller;
00145 
00152 typedef void (*callback)(Channel *channel, Message *mesg, void *state);
00153 
00161 typedef struct messaging {
00162 
00168         Connection *(*open_connection)(void);
00169 
00174         Channel *(*open_channel)(Connection *connection, const char * channel_name);
00175 
00179         void (*close_connection)(Connection *connection);
00180 
00184         void (*close_channel)(Channel *channel);
00185 
00190         void (*send)(Channel *channel, Message *message);
00191 
00193         void (*unsubscribe)(Channel *channel);
00194 
00196         void (*subscribe)(Channel *channel, callback fp, void *state);
00197 
00204         Messaging_Controller *(*get_controller)();
00205 
00206 } Messaging;
00207 
00216 #ifdef __cplusplus
00217 }
00218 #endif
00219 
00220 #endif /* MESSAGING_H_ */

Generated on Sat Nov 10 10:03:36 2012 for Vet Serial Interfaces (w/ proof-of-concept application) by  doxygen 1.4.7