--- /dev/null
+#ifndef PDU_H
+#define PDU_H
+
+#include "notaio.h"
+#include <stdio.h>
+
+#define DEFAULT_SID 42
+
+enum MessageTypes {
+ PUT_IMAGE = 's',
+ GET_IMAGE = 'g',
+ FACE_FOUND = 'f',
+ DISCONNECT = 'd',
+ QUIT = 'q'
+};
+
+typedef struct _ServiceMessage {
+ uns8 sigid_length;
+ uns8 sigid[2];
+ uns8 argtype;
+ uns16 arglen;
+ char argdata[0];
+} ServiceMessage;
+
+#define SERVICE_MESSAGE_HEADER_LEN (sizeof(struct _ServiceMessage))
+
+typedef struct {
+ volatile int *run_check;
+ void (*log)(const char*);
+ void (*put_image)(unsigned char* img_buf, int img_size);
+ unsigned char* (*get_image)(int* img_size);
+ void (*disconnect)(int socket);
+ void (*quit)(int socket);
+ void (*face_found)(int x,int y,int r);
+
+} ServiceCallbacks;
+
+
+ServiceMessage* pack_pdu(int sigid, uns8* payload, int payload_len, int* pdu_len);
+
+HErrorCode read_smsg(HSSockID* socket, HSReceiveMode mode, ServiceCallbacks* cb);
+
+#define LOG(str) { cb->log(str); }
+#define LOG1(fmt,arg) { char str[256]; snprintf(str,255,fmt,arg); cb->log(str); }
+#define LOG2(fmt,arg1,arg2) { char str[256]; snprintf(str,255,fmt,arg1,arg2); cb->log(str); }
+
+#endif