Mercurial > hg > old > magoroku_racing
view Linda/lindaapi.h~ @ 102:31b24eaf05cc
remove .o
author | Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 02 Jun 2011 23:11:44 +0900 |
parents | 0b65ca27f113 |
children |
line wrap: on
line source
#ifndef LINDAAPI_H #define LINDAAPI_H /*---------------------------------------------------------------------- マクロ定義 ----------------------------------------------------------------------*/ #define FAIL (-1) #define PS_DEB 0xf8 #define MAX_QUEUE 1024 #define INT_SIZE 4 // Byte = sizeof(int) /*---------------------------------------------------------------------- パケットフォーマット char short int int Mode + ID + Seq + Data_len + Padding + Data 0 1 3 7 11 12 ----------------------------------------------------------------------*/ #define LINDA_MODE_OFFSET 0 #define LINDA_ID_OFFSET 1 #define LINDA_SEQ_OFFSET 3 #define LINDA_DATA_LENGTH_OFFSET 7 #define LINDA_TID_OFFSET 11 #define LINDA_HEADER_SIZE 12 /*---------------------------------------------------------------------- 構造体定義 ----------------------------------------------------------------------*/ /*typedef struct psx_reply{ unsigned char *answer; unsigned int seq; struct psx_reply *next; char mode; void(*callback)(char * tuple, void * obj); void * obj; } REPLY, *REPLY_PTR;*/ /*typedef struct command_queue{ unsigned char *command; struct command_queue *next; unsigned int size; } COMMAND, *COMMAND_PTR;*/ /*---------------------------------------------------------------------- 静的関数テンプレート ----------------------------------------------------------------------*/ int start_linda(char *hostname); void unix_chkserv(); int psx_out(unsigned int id, unsigned char *data, unsigned int size); int psx_ld(unsigned int id, char mode, void(*callback)(char *,void *),void * obj); #define psx_in(id) psx_ld(id, 'i', NULL, NULL) #define psx_rd(id) psx_ld(id, 'r', NULL, NULL) #define psx_ck(id) psx_ld(id, 'c', NULL, NULL) #define psx_wait_rd(id) psx_ld(id, 'w', NULL, NULL) #define psx_callback_in(id,callback,obj) psx_ld(id, 'i', callback, obj) #define psx_callback_rd(id,callback,obj) psx_ld(id, 'r', callback, obj) #define psx_callback_ck(id,callback,obj) psx_ld(id, 'c', callback, obj) #define psx_callback_wait_rd(id,callback,obj) psx_ld(id, 'w', callback, obj) unsigned char *psx_reply(int seq); void psx_sync_n(); void psx_free(unsigned char *); int psx_queue(unsigned int id, unsigned int size, unsigned char *data, char mode, void(*callback)(char *,void *),void * obj); int psx_get_datalength(unsigned char *); unsigned char *psx_get_data(unsigned char *); int psx_get_seq(unsigned char *); short psx_get_id(unsigned char *); char psx_get_mode(unsigned char *); int unix_open(); /* UNIX 通信を開設する */ int unix_read(int,char *,unsigned int); /* UNIX から読み込む */ int unix_read_w(int,char *,int); /* UNIX から読み込む(non wait) */ int unix_write(int,unsigned char *,unsigned int);/* UNIX へ書き込む */ int unix_write_w(int,unsigned char *,unsigned int);/* UNIX へ書き込む(non wait) */ int send_able(); /* 読み書きできるパケット数を求める */ typedef struct psx_reply{ unsigned char *answer; unsigned int seq; struct psx_reply *next; char mode; void(*callback)(char * tuple, void * obj); void * obj; } REPLY, *REPLY_PTR; typedef struct command_queue{ unsigned char *command; struct command_queue *next; unsigned int size; } COMMAND, *COMMAND_PTR; #endif