
/*
	highscore-tcp.h -- Hiscore Protocol over TCP
	Created on: 2008/12/05 19:06:01
	~/dsys/highscore/tcp/highscore-proto.h
*/

#ifndef	_HIGHSCORE_TCP_H_
#define	_HIGHSCORE_TCP_H_

#define	HISCORE_PROTO_MAX_MESSAGE_SIZE	1024

#define	HISCORE_PROTO_GET_HISCORE	1
#define	HISCORE_PROTO_PUT_SCORE		2

#define	HISCORE_PROTO_OK		0
#define	HISCORE_PROTO_NO_COMMAND	-1
#define	HISCORE_PROTO_MARSHAL_ERROR	-2

#define	HIGHSCORE_MAX_RECORDS	10
#define	HIGHSCORE_NAME_LEN	28

struct score_record {
	int	 score;
	char	 name[HIGHSCORE_NAME_LEN];
};
typedef struct score_record score_record_t;

/* for clients */
extern int get_highscore_client(char *server, int portno,
				score_record_t records[], int len );
extern int put_score_client(char *server, int portno, int score, char *user);

#endif	/*_HIGHSCORE_TCP_H_*/
