Mercurial > hg > Members > kono > Cerium
annotate Renderer/Engine/lindaapi.h @ 603:42c94f85c779
long -> memaddr (64 or 32)
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 07 Nov 2009 14:13:29 +0900 |
parents | 1733f3cbfa28 |
children | 32a7260fad2f |
rev | line source |
---|---|
565 | 1 #ifndef _LINDAAPI_H |
2 | |
3 #define _LINDAAPI_H 1 | |
4 | |
5 #ifdef __cplusplus | |
6 extern "C" { | |
7 #endif | |
8 | |
9 /* $Id$ */ | |
507 | 10 |
11 /*---------------------------------------------------------------------- | |
565 | 12 マクロ定義 |
507 | 13 ----------------------------------------------------------------------*/ |
14 | |
15 #define FAIL (-1) | |
16 | |
17 #define PS_DEB 0xf8 | |
18 | |
19 #define MAX_QUEUE 1024 | |
20 | |
21 #define INT_SIZE 4 // Byte = sizeof(int) | |
22 | |
565 | 23 #define LDSERV_PORT 11511 |
24 | |
507 | 25 /*---------------------------------------------------------------------- |
565 | 26 パケットフォーマット |
602
1733f3cbfa28
64bit mode try... not worked.
e075740@nw0740.st.ie.u-ryukyu.ac.jp
parents:
577
diff
changeset
|
27 char short 8byte int |
507 | 28 Mode + ID + Seq + Data_len + Padding + Data |
603
42c94f85c779
long -> memaddr (64 or 32)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
602
diff
changeset
|
29 0 1 3 7 11 12 |
507 | 30 ----------------------------------------------------------------------*/ |
31 | |
32 #define LINDA_MODE_OFFSET 0 | |
33 #define LINDA_ID_OFFSET 1 | |
34 #define LINDA_SEQ_OFFSET 3 | |
603
42c94f85c779
long -> memaddr (64 or 32)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
602
diff
changeset
|
35 #define LINDA_DATA_LENGTH_OFFSET 7 |
42c94f85c779
long -> memaddr (64 or 32)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
602
diff
changeset
|
36 #define LINDA_HEADER_SIZE 12 |
507 | 37 |
38 /*---------------------------------------------------------------------- | |
565 | 39 構造体定義 |
507 | 40 ----------------------------------------------------------------------*/ |
41 typedef struct psx_reply{ | |
42 unsigned char *answer; | |
43 unsigned int seq; | |
44 struct psx_reply *next; | |
45 char mode; | |
565 | 46 void(*callback)(unsigned char * tuple, void * obj); |
507 | 47 void * obj; |
603
42c94f85c779
long -> memaddr (64 or 32)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
602
diff
changeset
|
48 } REPLY, Reply, *ReplyPtr; |
565 | 49 |
507 | 50 typedef struct command_queue{ |
565 | 51 struct command_queue *next; |
52 unsigned int tspace_id; /* ID of destination Tuple Space */ | |
53 unsigned int size; | |
507 | 54 unsigned char *command; |
565 | 55 } COMMAND; |
56 | |
507 | 57 |
58 /*---------------------------------------------------------------------- | |
565 | 59 Linda API |
507 | 60 ----------------------------------------------------------------------*/ |
61 | |
565 | 62 extern void init_linda(void); |
63 extern int open_linda(char *hostname, int port); | |
64 extern int open_linda_java(char *hostname, int port); | |
65 extern int close_linda(int tspace_id); | |
507 | 66 |
565 | 67 extern void psx_free(void*); |
507 | 68 |
565 | 69 extern unsigned char *psx_reply(unsigned int seq); |
70 extern void psx_sync_n(void); | |
71 extern unsigned int psx_get_datalength(unsigned char *); | |
577 | 72 extern unsigned char *psx_get_data(unsigned char *); |
565 | 73 extern unsigned int psx_get_seq(unsigned char *); |
74 extern unsigned short psx_get_id(unsigned char *); | |
75 extern unsigned char psx_get_mode(unsigned char *); | |
76 extern unsigned char * psx_get_data(unsigned char *); | |
507 | 77 |
603
42c94f85c779
long -> memaddr (64 or 32)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
602
diff
changeset
|
78 extern int psx_out(unsigned int tspace_id, unsigned int id, |
565 | 79 unsigned char *data, unsigned int size); |
603
42c94f85c779
long -> memaddr (64 or 32)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
602
diff
changeset
|
80 extern int psx_ld(unsigned int tspace_id, unsigned int id, |
565 | 81 char mode, void(*callback)(unsigned char *,void *),void * obj); |
82 | |
83 #define psx_in(tid, id) psx_ld(tid, id, 'i', NULL, NULL) | |
84 #define psx_rd(tid, id) psx_ld(tid, id, 'r', NULL, NULL) | |
85 #define psx_ck(tid, id) psx_ld(tid, id, 'c', NULL, NULL) | |
86 #define psx_wait_rd(tid, id) psx_ld(tid, id, 'w', NULL, NULL) | |
507 | 87 |
565 | 88 #define psx_callback_in(tid, id,callback,obj) psx_ld(tid, id, 'i', callback, obj) |
89 #define psx_callback_rd(tid, id,callback,obj) psx_ld(tid, id, 'r', callback, obj) | |
90 #define psx_callback_ck(tid, id,callback,obj) psx_ld(tid, id, 'c', callback, obj) | |
91 #define psx_callback_wait_rd(tid, id,callback,obj) psx_ld(tid, id, 'w', callback, obj) | |
92 | |
507 | 93 |
565 | 94 |
95 #ifdef __cplusplus | |
96 }; // for extern "C" | |
97 #endif | |
98 #endif // _LINDAAPI_H |