Initial commit
[jamendo] / branches / nota-show-app / src / notaio.h
diff --git a/branches/nota-show-app/src/notaio.h b/branches/nota-show-app/src/notaio.h
new file mode 100644 (file)
index 0000000..e573c2f
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2008 Nokia Corporation
+ * All rights reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as 
+ * published by the Free Software Foundation.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ */
+
+
+#ifndef NOTAIO_H
+#define NOTAIO_H
+
+#define USE_H_IN3      //h_in2 or h_in3
+
+#ifdef USE_H_IN3
+#include "nota3/h_in/h_bsdapi.h"
+typedef int HErrorCode;
+typedef int HSSockID;
+typedef int uns32;
+typedef int int32;
+typedef int HSReceiveMode;
+typedef int HSSendMode;
+typedef sid_t HSID;
+typedef void HKey;
+typedef void HSSockCallback;
+typedef void HServiceAccessCallback;
+typedef unsigned char uns8;
+typedef unsigned short uns16;
+
+#define HSSendBlocking MSG_WAITALL
+#define HSReceiveBlocking HSSendBlocking
+#define HSReceiveNonBlocking MSG_DONTWAIT
+#define HSSendNonBlocking HSReceiveNonBlocking
+
+#define HErrorNoMemory -4
+#define HErrorNone 0
+
+#else
+#include "h_in.h"
+#endif
+
+HErrorCode n_read(HSSockID socket, void *buffer, uns32 buffer_len, HSReceiveMode mode);
+HErrorCode n_send(HSSockID socket, void* buffer, uns32 buffer_len, HSSendMode mode);
+HErrorCode n_disconnect(HSSockID socket);
+int n_activate(int sid, void* key, void* callback);
+// In this version, 'sid' means the listener socket. 
+int n_deactivate(int sid, void* key);
+// 'to' is SID for H_IN2, socket for H_IN3.
+// 'param1' is HKey for H_IN2, struct sockaddr for H_IN3
+// 'param2' is ServiceAccessCallback for H_IN2, socklen_t for H_IN3
+int n_connect(int sid, void* key, void* callback);
+int n_accept(int to, void* param1, void* param2);
+
+#endif
+