#ifndef _PROTO_H_
#define _PROTO_H_

/* This file is automatically generated with "make proto". DO NOT EDIT */


/* The following definitions come from adminproc.c  */

int com_test(int p, param_list param);
int com_players_rewrite(int p, param_list param);
int com_gen_fen(int p, param_list param);
char* get_fen();
int com_amytest(int p, param_list param);
int com_atell(int p, param_list param);
int check_admin(int p, unsigned level);
int com_adjudicate(int p, param_list param);
int com_remplayer(int p, param_list param);
int com_raisedead(int p, param_list param);
int com_addplayer(int p, param_list param);
int com_pose(int p, param_list param);
int com_asetv(int p, param_list param);
int com_announce(int p, param_list param);
int com_annunreg(int p, param_list param);
int com_asetpasswd(int p, param_list param);
int com_asetemail(int p, param_list param);
int com_asetrealname(int p, param_list param);
int com_asethandle(int p, param_list param);
int com_asetadmin(int p, param_list param);
int com_asetzh(int p, param_list param);
int com_asetbugfr(int p, param_list param);
int com_asetstd(int p, param_list param);
int com_asetsimul(int p, param_list param);
int com_asetbug(int p, param_list param);
int com_ftell(int p, param_list param);
int com_nuke(int p, param_list param);
int com_summon(int p, param_list param);
int com_addcomment(int p, param_list param);
int com_showcomment(int p, param_list param);
int com_admin(int p, param_list param);
int com_hideinfo(int p, param_list param);
int com_quota(int p, param_list param);
int com_areload(int p, param_list param);

/* The following definitions come from algcheck.c  */

int alg_is_move(const char *mstr);
int alg_parse_move(char *mstr, struct game_state_t * gs, struct move_t * mt);
char *alg_unparse(struct game_state_t * gs, struct move_t * mt);

/* The following definitions come from board.c  */

void board_clear(struct game_state_t *gs);
void board_standard(struct game_state_t *gs);
int board_init(int g,struct game_state_t *b, char *category, char *board);
void board_calc_strength(struct game_state_t *b, int *ws, int *bs);
void update_holding(int g, int pieceCaptured);
char *board_to_string(char *wn, char *bn,
		      int wt, int bt,
		      struct game_state_t *b, struct move_t *ml, int style,
		      int orientation, int relation,
		      int p);
char *move_and_time(struct move_t *m);
void fr_update(void);
int com_setBoardFromFen(int p, param_list param);

/* The following definitions come from command.c  */

int alias_lookup(char *tmp, struct alias_type *alias_list, int numalias);
int process_input(int fd, char *com_string);
int process_new_connection(int fd, struct in_addr fromHost);
int process_disconnection(int fd);
int process_heartbeat(int *fd);
void commands_init(void);
void TerminateCleanup(void);
const struct alias_type *alias_list_global(void);
const struct alias_type *alias_list_personal(int p, int *n);
int com_acheckhelp(int p, param_list param);

/* The following definitions come from talkproc.c  */

int com_shout(int p, param_list param);
int com_cshout(int p, param_list param);
int com_it(int p, param_list param);
void print_successful_tell(int p, int p1);
void modify_last_tell(int p, int p1);
int com_ptell(int p, param_list param);
int com_whisper(int p, param_list param);
int com_kibitz(int p, param_list param);
int com_tell(int p, param_list param);
int com_ltell(int p, param_list param);
int com_xtell(int p, param_list param);
int com_say(int p, param_list param);
int com_inchannel(int p, param_list param);
int com_messages(int p, param_list param);
int com_forwardmess(int p, param_list param);
int com_clearmessages(int p, param_list param);
int com_znotify(int p, param_list param);
int com_qtell(int p, param_list param);

/* The following definitions come from comproc.c  */

int com_more(int p, param_list param);
int com_quit(int p, param_list param);
int com_set(int p, param_list param);
int FindPlayer(int p, char* name, int *p1, int *connected);
int com_finger(int p, param_list param);
int com_teamfinger(int p, param_list param);
int com_stats(int p, param_list param);
int com_password(int p, param_list param);
int com_uptime(int p, param_list param);
int com_date(int p, param_list param);
int com_llogons(int p, param_list param);
int com_logons(int p, param_list param);
void AddPlayerLists (int p1, char *ptmp);
int com_who_bug(int p,param_list param);
int com_showadmins(int p);
int com_listBugTeams(int p, param_list param);
int com_who(int p, param_list param);
int com_open(int p, param_list param);
int com_bell(int p, param_list param);
int com_flip(int p, param_list param);
int com_style(int p, param_list param);
int com_promote(int p, param_list param);
void alias_add(int p, const char *name, const char *value);
int com_alias(int p, param_list param);
int com_unalias(int p, param_list param);
int com_handles(int p, param_list param);
int com_getgi(int p, param_list param);
int com_getpi(int p, param_list param);
int com_limits(int p, param_list param);
int com_remote(int p, param_list param);

/* The following definitions come from formula.c  */

int GameMatchesFormula (int w, int b, int wTime, int wInc, int bTime,
           int bInc, int rated, int gametype, struct textlist **clauseList);
int SetValidFormula (int p, int clause, char *string);
void ShowClauses (int p, int p1, textlist *clauses);

/* The following definitions come from gamedb.c  */

struct game *game_getStruct(int g);
int game_getWhiteResultSimple(int g);
int game_getOppositeResultSimple(int result);
int game_new(void);
int game_free(int g);
int game_remove(int g);
int game_finish(int g);
void MakeFENpos (int g, char *FEN);
char *game_str(int rated, int wt, int winc, int bt, int binc,
	   char *cat, char *board);
char *game_str_number(int g);
int game_isblitz(char *cat, char *board);
void send_board_to(int g, int p);
void send_boards(int g);
void game_update_time(int g);
char *EndString(int g, int personal);
const char *EndSym(int g);
char *movesToString(int g, int pgn);
void game_disconnect(int g, int p);
int CharToPiece(char c);
char PieceToChar(int piece);
int ReadGameAttrs_exam(FILE * fp, int g);
int ReadGameAttrs(FILE * fp, int g);
int game_read(int g, int wp, int bp);
int game_delete(int wp, int bp);
int game_save(int g);
void RemHist(char *who);
char get_journalgame_type(int p,char* fname,char slot);
int removejournalitem(int p, char slot,FILE* fp,char* fname, int* empty);
int journal_get_info(int p, char from_spot,struct journal* j, char *fname);
void addjournalitem(int p,struct journal* j_add, char* fname);
int pjournal(int p, int p1, char *fname);
int pgames(int p, int p1, char *fname);
void bughouse_game_write(int g1, int g2, int WhiteResult1);
void bpgn_write(int g1,int counter);
void game_write_complete(int g, int WhiteResult);
int game_count(void);

/* The following definitions come from gameproc.c  */

void game_ended(int g, int winner, int why);
int pIsPlaying (int p);
void timeseal_update_clocks(struct player *pp, struct game *gg);
void process_move(int p, char *command);
int com_resign(int p, param_list param);
char *GetFENpos (int g, int half_move);
int com_draw(int p, param_list param);
int com_abort(int p, param_list param);
int game_player_time(struct player *pp, struct game *gg);
int com_flag(int p, param_list param);
void game_wonontime(struct game *gg, int p, int color);
int com_adjourn(int p, param_list param);
int com_takeback(int p, param_list param);
int com_switch(int p, param_list param);
int com_time(int p, param_list param);
int com_ptime(int p, param_list param);
int com_boards(int p, param_list param);
int com_moretime(int p, param_list param);

/* The following definitions come from config.c  */

void config_close(void);
int config_open(void);
const char *config_get(const char *name);
int config_get_int(const char *name, int default_v);
const char *config_get_tmp(const char *name);
int com_aconfig(int p, param_list param);

/* The following definitions come from lists.c  */

void lists_close(void);
int list_add(int p, enum ListWhich l, const char *s);
struct List *list_findpartial(int p, char *which, int gonnado);
int in_list(int p, enum ListWhich which, char *member);
int list_addsub(int p, char* list, char* who, int addsub);
int com_addlist(int p, param_list param);
int com_sublist(int p,param_list param);
int com_togglelist(int p,param_list param);
int com_showlist(int p, param_list param);
int list_channels(int p,int p1);
void list_free(struct List * gl);
void lists_validate(int p);
int titled_player(int p,char* name);

/* The following definitions come from malloc.c  */

void *m_malloc(size_t size);
void m_malloc_check(void *ptr);
int m_free(void *ptr);
void m_check_all(void);
void m_free_all(void);
void *m_calloc(size_t n, size_t size);
char *m_strdup(const char *s);
char *m_strndup(const char *s, size_t n);
void m_safe_free(void **ptr, const char *file, unsigned line);
int m_vasprintf(char **strp, const char *fmt, va_list ap);
int m_asprintf(char **strp, const char *fmt, ...);
void *m_realloc(void *ptr, size_t size);
int com_print_usage(int p, param_list param);

/* The following definitions come from reload.c  */

void initial_load(void);
void reload_open(void);
void db_connect();
void db_disconnect();
int db_table_exists(char *tbl);
int db_check_error();
void reload_close(void);

/* The following definitions come from follow.c  */

void follow_start(int p1,int p2);
void pfollow_start(int p1,int p2);

/* The following definitions come from help.c  */

int com_help(int p, param_list param);
int com_ahelp(int p, param_list param);

/* The following definitions come from movecheck.c  */

int is_move(const char *mstr);
int NextPieceLoop(board_t b, int *f, int *r, int color);
int InitPieceLoop(board_t b, int *f, int *r, int color);
int legal_move(struct game_state_t * gs,
	       int fFile, int fRank,
	       int tFile, int tRank);
int legal_andcheck_move(struct game_state_t * gs,
			int fFile, int fRank,
			int tFile, int tRank);
int in_check(struct game_state_t * gs);
int has_legal_move(struct game_state_t * gs);
int FoundPieceFile(struct game_state_t * gs, int piece);
int parse_move(char *mstr, struct game_state_t * gs, struct move_t * mt, int promote);
int execute_move(struct game_state_t * gs, struct move_t * mt, int check_game_status);
int backup_move(int g, int mode);

/* The following definitions come from multicol.c  */

struct multicol *multicol_start(int maxArray);
int multicol_store(multicol * m, char *str);
int multicol_store_sorted(multicol * m, char *str);
int multicol_pprint(multicol * m, int player, int cols, int space);
int multicol_end(multicol * m);

/* The following definitions come from network.c  */

int net_send_string(int fd, char *str, int format, int width);
int net_init(int port);
void net_close(void);
void net_close_connection(int fd);
void turn_echo_on(int fd);
void turn_echo_off(int fd);
void select_loop(void );

/* The following definitions come from playerdb.c  */

struct player *player_getStruct(p);
struct player *player_getGameStruct(struct player *pp);
int player_new(void);
void ResetStats(struct statistics *ss);
void ResetIVars(int p);
void player_free(struct player *pp);
int player_clear(int p);
int player_remove(int p);
int player_read(int p, char *name);
int player_save(int p);
int player_add_DB(int p);
int player_save_DB(int p);
int player_find(int fd);
int player_find_bylogin(const char *name);
int player_find_part_login(const char *name);
int player_censored(int p, int p1);
int player_isIgnored(int p, int p1);
int player_isHearCh(int p, int p1);
int player_isAllowedTells(int p, int p1);
int player_isAllowedPlay(int p, int p1);
int player_in_list(int list, int p, int p1);
int player_notified(int p, int p1);
void player_notify_departure(int p);
int player_notify_present(int p);
int player_notify(int p, char *note1, char *note2);
int showstored(int p);
int player_count(int CountAdmins);
int player_idle(int p);
int player_ontime(int p);
void player_write_login(int p);
void player_write_logout(int p);
int player_lastdisconnect(int p);
int player_is_observe(int p, int g);
int player_add_observe(int p, int g);
int player_remove_observe(int p, int g);
int player_game_ended(int g);
int player_num_messages(int p);
int player_add_message(int top, int fromp, char *message);
void SaveTextListEntry(textlist **Entry, char *string, int n);
void ClearTextList(textlist *head);
int ForwardMsgRange(char *p1, int p, int start, int end);
int ClearMsgsBySender(int p, param_list param);
int player_show_messages(int p);
int ShowMsgsBySender(int p, param_list param);
int ShowMsgRange (int p, int start, int end);
int ClrMsgRange (int p, int start, int end);
int player_clear_messages(int p);
int player_search(int p, char *name);
int player_kill(char *name);
int player_rename(char *name, char *newname);
int player_reincarn(char *name, char *newname);
int player_num_comments(int p);
int player_add_comment(int p_by, int p_to, char *comment);
int player_show_comments(int p, int p1);
int player_ishead(int p);
int GetRating(struct player *p, int gametype);
double GetRD(struct player *p, int gametype);

/* The following definitions come from ratings.c  */

double current_sterr(double s, long t);
void rating_sterr_delta(int p1, int p2, int type, int gtime, int result,
			        int *deltarating, double *newsterr);
void glicko(struct statistics *stats_one, struct statistics *stats_two,
            int result, int *deltarating, double *newsterr);
void stats_updateStats(struct bugteam *team, int result, int ratingchg,
                       double sterr);
int bugteam_rating_update(int g, int link_game);
int rating_update(int g, int link_game);
int com_assess(int p, param_list param);
int com_best(int p, param_list param);
int com_hbest(int p, param_list param);
int com_best(int p, param_list param);
int com_fixrank(int p, param_list param);
int com_rank(int p, param_list param);
int com_hrank(int p, param_list param);
void UpdateRank(int type, char *addName,
		struct statistics *sNew, char *delName);

/* The following definitions come from utils.c  */

char *eatword(char *str);
char *eatwhite(char *str);
char *eattailwhite(char *str);
char *nextword(char *str);
int mail_string_to_address(char *addr, char *subj, char *str);
int mail_string_to_user(int p, char *subj, char *str);
int pcommand(int p, char *comstr,...);
int pprintf(int p, char *format,...);
int pprintf_highlight(int p, char *format,...);
int pprintf_more(int p, char *format,...);
int psprintf_highlight(int p, char *s, char *format,...);
int pprintf_prompt(int p, char *format,...);
void send_prompt(int p) ;
int pprintf_noformat(int p, char *format,...);
void Bell (int p);
int psend_raw_file(int p, char *dir, char *file);
int psend_file(int p, const char *dir, const char *file);
int psend_logoutfile(int p, char *dir, char *file);
int pmore_text(int p);
char *stolower(char *str);
int alphastring(char *str);
int printablestring(const char *str);
char *hms_desc(int t);
char *hms(int t, int showhour, int showseconds, int showtenth, int spaces);
unsigned tenth_secs(void);
unsigned tenth_secs(void);
unsigned tenth_secs2(void);
int untenths(unsigned tenths);
char *tenth_str(unsigned t, int spaces);
int truncate_file(char *file, int lines);
int lines_file(char *file);
int file_has_pname(char *fname, char *plogin);
char *file_wplayer(char *fname);
char *file_bplayer(char *fname);
char *dotQuad(struct in_addr a);
int file_exists(char *fname);
char *ratstr(int rat);
char *ratstrii(int rat, int p);
int search_directory(const char *dir, const char *filter, char **buffer, int buffersize);
int display_directory(int p, char **buffer, int count);
void CenterText (char *target, const char *text, int width, int pad);
void block_signal(int signum);
void unblock_signal(int signum);
int file_copy(const char *src, const char *dest);
size_t strnlen(const char *s, size_t n);
const char *strday(time_t *t);
const char *strltime(time_t *clock);
const char *strgtime(time_t *clock);
void d_printf(const char *fmt, ...);
void admin_log(struct player *pp, const char *command, param_list params);
int file_save(const char *fname, void *data, size_t length);
char *fd_load(int fd, size_t *size);
char *file_load(const char *fname, size_t *size);
char *fd_gets(char *line, size_t maxsize, int fd);
FILE *fopen_p(const char *fmt, const char *mode, ...);
FILE *fopen_s(const char *fname, const char *mode);
int tdb_set_int(TDB_CONTEXT *tdb, const char *name, int value);
int tdb_get_int(TDB_CONTEXT *tdb, const char *name, int def_value);
int tdb_set_string(TDB_CONTEXT *tdb, const char *name, const char *value);
const char *tdb_get_string(TDB_CONTEXT *tdb, const char *name);
int tdb_delete_string(TDB_CONTEXT *tdb, const char *name);

/* The following definitions come from variable.c  */

const char *Language(int i);
int com_partner(int p, param_list param);
int var_set(int p, char *var, char *val, int *wh);
int com_variables(int p, param_list param);
int com_tournset(int p, param_list param);
int com_rpartner(int p, param_list param);

/* The following definitions come from vers.c  */


/* The following definitions come from eco.c  */

void FEN_to_board(char* FENpos, struct game_state_t* gs);
char *boardToFEN(int g);
void book_close(void);
void book_open(void);
char *getECO(int g);
int com_eco(int p, param_list param);
int com_fen(int p, param_list param);

/* The following definitions come from matchproc.c  */

void gameinfo(int p, int g);
int create_new_match(int g, int white_player, int black_player,
                             int wt, int winc, int bt, int binc,
                             int rated, char *category, char *board,
                             int white, int simul);
int BugMatchErrorHandler(int g1, int pp1, int partner);
int accept_match(struct pending *pend, int p, int p1);
int com_match(int p, param_list param);
int com_rmatch(int p, param_list param);
int com_rematch(int p, param_list param);

/* The following definitions come from obsproc.c  */

int GameNumFromParam(int p, int *p1, parameter *param);
int com_games(int p, param_list param);
int do_observe(int p, int obgame);
void unobserveAll(int p);
int com_unobserve(int p, param_list param);
int com_pobserve(int p, param_list param);
int com_follow(int p, param_list param);
int com_pfollow(int p, param_list param);
int com_observe(int p, param_list param);
int com_allobservers(int p, param_list param);
int com_unexamine(int p, param_list param);
int com_mexamine(int p, param_list param);
int com_moves(int p, param_list param);
int com_mailmoves(int p, param_list param);
int com_oldmoves(int p, param_list param);
int com_robserve(int p, param_list param);
int com_rfollow(int p, param_list param);
int com_mailoldmoves(int p, param_list param);
void ExamineScratch(int p,  param_list param,int setup);
int com_wname(int p, param_list param);
int com_bname(int p, param_list param);
int com_examine(int p, param_list param);
int com_stored(int p, param_list param);
int com_mailstored(int p, param_list param);
int com_smoves(int p, param_list param);
int com_sposition(int p, param_list param);
int com_forward(int p, param_list param);
int com_backward(int p, param_list param);
int com_revert(int p, param_list param);
int com_history(int p, param_list param);
int com_journal(int p, param_list param);
int com_jkill(int p, param_list param);
int com_jsave(int p, param_list param);
int com_refresh(int p, param_list param);
int com_prefresh(int p, param_list param);

/* The following definitions come from pending.c  */

struct pending *delete_pending(struct pending *current);
void destruct_pending(void);
struct pending *add_pending(int from,int to,int type);
struct pending *find_pend(int p, int p1, int type);
struct pending *add_request(int p, int p1, int type);
void remove_request(int p, int p1, int type);
void decline_withdraw_offers(int p, int p1, int offerType,int wd);
int com_accept(int p, param_list param);
int com_decline(int p, param_list param);
int com_withdraw(int p, param_list param);
int com_pending(int p, param_list param);
void pend_join_match (int p, int p1);

/* The following definitions come from gics.c  */

void init_userstat(void);
void save_userstat(void);
int com_ping(int p, param_list param);
void game_save_playerratio(char *file, char *Opponent, int Result, int rated);
int com_pstat(int p, param_list param);

/* The following definitions come from setup.c  */

int com_setup (int p,param_list param);
int com_tomove (int p,param_list param);
int com_clrsquare (int p,param_list param);
int is_drop(char* dropstr);
int attempt_drop(int p,int g,char* dropstr);

/* The following definitions come from shutdown.c  */

void output_shut_mess(void);
void ShutHeartBeat(void);
int check_and_print_shutdown(int p);
int com_shutdown(int p, param_list param);
int com_whenshut(int p, param_list param);

/* The following definitions come from seekproc.c  */

int com_seek(int p, param_list param);
int com_play(int p, param_list param);
int com_sought(int p, param_list param);
int com_unseek(int p, param_list param);
void withdraw_seeks(int p);

/* The following definitions come from parsers/parser.c  */

void load_all_globals(const char *fname);
void save_all_globals(const char *fname);
int com_adump(int p, param_list param);
const char *marshall_player(const struct player *pp);
int unmarshall_player(struct player *pp, const char *s);
const char *marshall_game(const struct game *gg);
int unmarshall_game(struct game *gg, const char *s);
int gen_dump_struct_in_addr(struct parse_string *p, const char *ptr, unsigned indent);
int gen_parse_struct_in_addr(char *ptr, const char *str);

/* The following definitions come from parsers/genparser.c  */

int gen_addgen(struct parse_string *p, const char *fmt, ...);
int gen_dump_enum(const struct enum_struct *einfo,
		  struct parse_string *p, 
		  const char *ptr,
		  unsigned indent);
int gen_dump_struct(const struct parse_struct *pinfo,
		    struct parse_string *p, 
		    const char *ptr, 
		    unsigned indent);
char *gen_dump(const struct parse_struct *pinfo, 
	       const char *data, 
	       unsigned indent);
int gen_parse_enum(const struct enum_struct *einfo, 
		   char *ptr, 
		   const char *str);
int gen_parse_struct(const struct parse_struct *pinfo, char *ptr, const char *str);
int gen_parse(const struct parse_struct *pinfo, char *data, const char *s);
int gen_parse_char(char *ptr, const char *str);
int gen_parse_int(char *ptr, const char *str);
int gen_parse_unsigned(char *ptr, const char *str);
int gen_parse_time_t(char *ptr, const char *str);
int gen_parse_double(char *ptr, const char *str);
int gen_parse_float(char *ptr, const char *str);
int gen_dump_char(struct parse_string *p, const char *ptr, unsigned indent);
int gen_dump_int(struct parse_string *p, const char *ptr, unsigned indent);
int gen_dump_unsigned(struct parse_string *p, const char *ptr, unsigned indent);
int gen_dump_time_t(struct parse_string *p, const char *ptr, unsigned indent);
int gen_dump_double(struct parse_string *p, const char *ptr, unsigned indent);
int gen_dump_float(struct parse_string *p, const char *ptr, unsigned indent);

/* The following definitions come from iset.c  */

int com_iset(int p, param_list param);
int com_ivars(int p, param_list param);

/* The following definitions come from crypt.c  */

char *chessd_crypt(const char *passwd, const char *salt);

/* The following definitions come from crypt-md5.c  */

char *crypt_md5(const char *pw, const char *salt);

/* The following definitions come from crypt-md5c.c  */

void MD5Init(MD5_CTX *context);
void MD5Update(MD5_CTX *context,
	       const unsigned char *input,
	       unsigned int inputLen);
void MD5Final(unsigned char digest[16],
	      MD5_CTX *context);

/* The following definitions come from crypt-misc.c  */

void _crypt_to64(unsigned char *s, unsigned long v, int n);

/* The following definitions come from timeseal.c  */

void timeseal_init(const char *path);
int timeseal_check_flags(struct game *gg, int p);
int timeseal_areflagson(struct game *gg, int p);
void timeseal_turnoff_flags(struct game *gg, int p);
void timeseal_updateLag(struct game *gg, struct player *pp);
int timeseal_updateTimeOfReply(int p, struct connection_t *con);
void timeseal_normalMoveTagHandler(int p, struct connection_t *con);
int timeseal_getSpamCheckpoint();
void timeseal_clearSpamCheck(struct connection_t *con);
void timeseal_clearSpamCheckAll(struct connection_t *con);
int timeseal_isSameCommand(const char *cmd1, const char *cmd2);
void timeseal_MakeMRC(struct connection_t *con, char *command);
int timeseal_checkSpam(int p, struct connection_t *con, char *command);
void timeseal_sendSpamWarning(int p, struct connection_t *con);
int timeseal_spam_exceeded(struct connection_t *con);
int timeseal_parse(char *command, struct connection_t *con);
void ExecuteFlagCmd(int p, struct connection_t *con);

/* The following definitions come from timeproc.c  */

void check_flag(int g, int color);
void check_flag_bughouse(int g);
void ExecuteFlag(int g);
void stop_clocks(int g);
int UpdateTimeX(struct player *pp, struct game *gg);
int game_check_flag(struct player *pp, struct game *gg);
int com_unpause(int p, param_list param);
int com_pause(int p, param_list param);

/* The following definitions come from tbl/tourney_stats.c  */

void tourneystats_createTable();
void tourneystats_newPlayer(char *username);
struct statistics *tourneystats_getStats(char *username);

/* The following definitions come from tbl/bugteam_stats.c  */

void bugteamstats_createTable();
int bugteamstats_newTeam(struct bugteam *team);
struct statistics *bugteamstats_getStats(struct bugteam *team);
int bugteamstats_updateStats(struct bugteam *team);
int bugteamstats_bestOfPlayer(char *player, struct bugteam *team);
int bugteamstats_rowToStruct(dbi_result result, struct statistics *stats);

/* The following definitions come from tbl/bugteam.c  */

void bugteam_createTable();
int bugteam_newTeam(struct bugteam *team);
int bugteam_getTeamId(struct bugteam *team);
int bugteam_playerCmp(char *playerone, char *playertwo);
int bugteam_rowToStruct(dbi_result result, struct bugteam *team);
void bugteam_orderTeam(char **partnerone, char **partnertwo);

/* The following definitions come from tbl/stats.c  */

int stats_RowToStruct(dbi_result result, struct statistics *ret);

/* The following definitions come from tdb/tdb.c  */

void tdb_dump_all(TDB_CONTEXT *tdb);
int tdb_printfreelist(TDB_CONTEXT *tdb);
enum TDB_ERROR tdb_error(TDB_CONTEXT *tdb);
const char *tdb_errorstr(TDB_CONTEXT *tdb);
TDB_DATA tdb_fetch(TDB_CONTEXT *tdb, TDB_DATA key);
int tdb_exists(TDB_CONTEXT *tdb, TDB_DATA key);
int tdb_traverse(TDB_CONTEXT *tdb, tdb_traverse_func fn, void *state);
TDB_DATA tdb_firstkey(TDB_CONTEXT *tdb);
TDB_DATA tdb_nextkey(TDB_CONTEXT *tdb, TDB_DATA oldkey);
int tdb_delete(TDB_CONTEXT *tdb, TDB_DATA key);
int tdb_store(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, int flag);
TDB_CONTEXT *tdb_open(const char *name, int hash_size, int tdb_flags,
		      int open_flags, mode_t mode);
TDB_CONTEXT *tdb_open_ex(const char *name, int hash_size, int tdb_flags,
			 int open_flags, mode_t mode,
			 tdb_log_func log_fn);
int tdb_close(TDB_CONTEXT *tdb);
int tdb_lockall(TDB_CONTEXT *tdb);
void tdb_unlockall(TDB_CONTEXT *tdb);
int tdb_lockkeys(TDB_CONTEXT *tdb, u32 number, TDB_DATA keys[]);
void tdb_unlockkeys(TDB_CONTEXT *tdb);
int tdb_chainlock(TDB_CONTEXT *tdb, TDB_DATA key);
int tdb_chainunlock(TDB_CONTEXT *tdb, TDB_DATA key);
void tdb_logging_function(TDB_CONTEXT *tdb, void (*fn)(TDB_CONTEXT *, int , const char *, ...));
int tdb_reopen(TDB_CONTEXT *tdb);
int tdb_reopen_all(void);

/* The following definitions come from tdb/spinlock.c  */

int tdb_spinlock(TDB_CONTEXT *tdb, int list, int rw_type);
int tdb_spinunlock(TDB_CONTEXT *tdb, int list, int rw_type);
int tdb_create_rwlocks(int fd, unsigned int hash_size);
int tdb_clear_spinlocks(TDB_CONTEXT *tdb);
int tdb_clear_spinlocks(TDB_CONTEXT *tdb);

#endif /*  _PROTO_H_  */
