e573c2fdf39b4f9a9ae020e1d676bcfe89d0606f
[jamendo] / branches / nota-show-app / src / notaio.h
1 /*
2  * Copyright (C) 2008 Nokia Corporation
3  * All rights reserved
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as 
7  * published by the Free Software Foundation.
8  * 
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *     GNU General Public License for more details.
13  * 
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17  *
18  */
19
20
21 #ifndef NOTAIO_H
22 #define NOTAIO_H
23
24 #define USE_H_IN3       //h_in2 or h_in3
25
26 #ifdef USE_H_IN3
27 #include "nota3/h_in/h_bsdapi.h"
28 typedef int HErrorCode;
29 typedef int HSSockID;
30 typedef int uns32;
31 typedef int int32;
32 typedef int HSReceiveMode;
33 typedef int HSSendMode;
34 typedef sid_t HSID;
35 typedef void HKey;
36 typedef void HSSockCallback;
37 typedef void HServiceAccessCallback;
38 typedef unsigned char uns8;
39 typedef unsigned short uns16;
40
41 #define HSSendBlocking MSG_WAITALL
42 #define HSReceiveBlocking HSSendBlocking
43 #define HSReceiveNonBlocking MSG_DONTWAIT
44 #define HSSendNonBlocking HSReceiveNonBlocking
45
46 #define HErrorNoMemory -4
47 #define HErrorNone 0
48
49 #else
50 #include "h_in.h"
51 #endif
52
53 HErrorCode n_read(HSSockID socket, void *buffer, uns32 buffer_len, HSReceiveMode mode);
54 HErrorCode n_send(HSSockID socket, void* buffer, uns32 buffer_len, HSSendMode mode);
55 HErrorCode n_disconnect(HSSockID socket);
56 int n_activate(int sid, void* key, void* callback);
57 // In this version, 'sid' means the listener socket. 
58 int n_deactivate(int sid, void* key);
59 // 'to' is SID for H_IN2, socket for H_IN3.
60 // 'param1' is HKey for H_IN2, struct sockaddr for H_IN3
61 // 'param2' is ServiceAccessCallback for H_IN2, socklen_t for H_IN3
62 int n_connect(int sid, void* key, void* callback);
63 int n_accept(int to, void* param1, void* param2);
64
65 #endif
66