Mercurial > hg > Members > kono > Cerium
comparison Renderer/Engine/lindaapi.h @ 507:735f76483bb2
Reorganization..
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 12 Oct 2009 09:39:35 +0900 |
parents | |
children | 2e1b6c5e4f8f |
comparison
equal
deleted
inserted
replaced
506:1d4a8a86f26b | 507:735f76483bb2 |
---|---|
1 // $Id: lindaapi.h,v 1.8 2005/12/21 07:29:38 yasumura Exp $ | |
2 // | |
3 | |
4 /*---------------------------------------------------------------------- | |
5 マクロ定義 | |
6 ----------------------------------------------------------------------*/ | |
7 | |
8 #define FAIL (-1) | |
9 | |
10 #define PS_DEB 0xf8 | |
11 | |
12 #define MAX_QUEUE 1024 | |
13 | |
14 #define INT_SIZE 4 // Byte = sizeof(int) | |
15 | |
16 /*---------------------------------------------------------------------- | |
17 パケットフォーマット | |
18 char short int int | |
19 Mode + ID + Seq + Data_len + Padding + Data | |
20 0 1 3 7 11 12 | |
21 ----------------------------------------------------------------------*/ | |
22 | |
23 #define LINDA_MODE_OFFSET 0 | |
24 #define LINDA_ID_OFFSET 1 | |
25 #define LINDA_SEQ_OFFSET 3 | |
26 #define LINDA_DATA_LENGTH_OFFSET 7 | |
27 #define LINDA_TID_OFFSET 11 | |
28 #define LINDA_HEADER_SIZE 12 | |
29 | |
30 /*---------------------------------------------------------------------- | |
31 構造体定義 | |
32 ----------------------------------------------------------------------*/ | |
33 typedef struct psx_reply{ | |
34 unsigned char *answer; | |
35 unsigned int seq; | |
36 struct psx_reply *next; | |
37 char mode; | |
38 void(*callback)(char * tuple, void * obj); | |
39 void * obj; | |
40 } REPLY, *REPLY_PTR; | |
41 | |
42 typedef struct command_queue{ | |
43 unsigned char *command; | |
44 struct command_queue *next; | |
45 unsigned int size; | |
46 } COMMAND, *COMMAND_PTR; | |
47 | |
48 /*---------------------------------------------------------------------- | |
49 静的関数テンプレート | |
50 ----------------------------------------------------------------------*/ | |
51 | |
52 int start_linda(char *hostname); | |
53 void unix_chkserv(); | |
54 extern void psx_free(char *tuple); | |
55 | |
56 int psx_out(unsigned int id, unsigned char *data, unsigned int size); | |
57 int psx_ld(unsigned int id, char mode, void(*callback)(char *,void *),void * obj); | |
58 | |
59 #define psx_in(id) psx_ld(id, 'i', NULL, NULL) | |
60 #define psx_rd(id) psx_ld(id, 'r', NULL, NULL) | |
61 #define psx_ck(id) psx_ld(id, 'c', NULL, NULL) | |
62 #define psx_wait_rd(id) psx_ld(id, 'w', NULL, NULL) | |
63 | |
64 #define psx_callback_in(id,callback,obj) psx_ld(id, 'i', callback, obj) | |
65 #define psx_callback_rd(id,callback,obj) psx_ld(id, 'r', callback, obj) | |
66 #define psx_callback_ck(id,callback,obj) psx_ld(id, 'c', callback, obj) | |
67 #define psx_callback_wait_rd(id,callback,obj) psx_ld(id, 'w', callback, obj) | |
68 | |
69 unsigned char *psx_reply(int seq); | |
70 void psx_sync_n(); | |
71 //void psx_free(unsigned char *); | |
72 int psx_queue(unsigned int id, unsigned int size, unsigned char *data, char mode, | |
73 void(*callback)(char *,void *),void * obj); | |
74 int psx_get_datalength(unsigned char *); | |
75 unsigned char *psx_get_data(unsigned char *); | |
76 int psx_get_seq(unsigned char *); | |
77 short psx_get_id(unsigned char *); | |
78 char psx_get_mode(unsigned char *); | |
79 | |
80 int unix_open(); /* UNIX 通信を開設する */ | |
81 int unix_read(int,char *,unsigned int); /* UNIX から読み込む */ | |
82 int unix_read_w(int,char *,int); /* UNIX から読み込む(non wait) */ | |
83 int unix_write(int,unsigned char *,unsigned int);/* UNIX へ書き込む */ | |
84 int unix_write_w(int,unsigned char *,unsigned int);/* UNIX へ書き込む(non wait) */ | |
85 int send_able(); /* 読み書きできるパケット数を求める */ | |
86 |