/*
** pat_tftp.h for  in 
** 
** Made by 
** Login   <vianney@epita.fr>
** 
** Started on  Wed Sep  1 06:46:58 1999 
** Last update Thu Oct 28 20:20:56 1999 
*/
#ifndef PAT_TFTP_H
#define PAT_TFTP_H	1

#include "pat.h"

extern t_assoc		tftpen_assocs[];

typedef struct		s_tftp
{
  t_u16			opcode;
} t_tftp;

#define TFTP_HLEN	2

#define TFTP_PORT	69

#define PAT_TFTP_CHECK(tftppar,bufpar,lenpar) \
	if ((lenpar) < TFTP_HLEN)\
		return (ERR_PAT_TRUNC_PAT);\
	(tftppar) = (t_tftp *)(bufpar);

#define TFTPOP_RRQ	1
#define TFTPOP_WRQ	2
#define TFTPOP_DATA	3
#define TFTPOP_ACK	4
#define TFTPOP_ERROR	5

extern t_assoc		tftpopcode_assocs[];

extern t_pat		tftpfname_pat;
extern t_pat		tftpmode_pat;
extern t_pat		tftpbn_pat;
extern t_pat		tftperror_pat;
extern t_pat		tftp_pat;

/* PROTO pat_tftp.c */
/* pat_tftp.c */
t_status tftpmode_pat_name P((void *data, t_id *optional_id, char *str, int max_len));
t_status tftpmode_pat_get_field P((void *data, t_id *optional_id, char *buf, int len, char *field, char *str, int max_len));
t_status tftpmode_pat_set_field P((void *data, t_id *optional_id, char *buf, int len, char *field, char *value));
t_status tftpmode_pat_get_fields P((void *data, t_vec *vec_str));
t_status tftpmode_pat_get_field_pat P((void *data, t_id *optional_id, char *buf, int len, char *field, t_pat **pat_return, void **data_return));
t_status tftpmode_pat_get_tmpl P((void *data, t_id *id, char *buf, int len, char *str, int max_len));
t_status tftpmode_pat_sub P((void *data, t_id *optional_id, char *buf, int len, t_pat **pat_return));
t_status tftpfname_pat_name P((void *data, t_id *optional_id, char *str, int max_len));
t_status tftpfname_pat_get_field P((void *data, t_id *optional_id, char *buf, int len, char *field, char *str, int max_len));
t_status tftpfname_pat_set_field P((void *data, t_id *optional_id, char *buf, int len, char *field, char *value));
t_status tftpfname_pat_get_fields P((void *data, t_vec *vec_str));
t_status tftpfname_pat_get_field_pat P((void *data, t_id *optional_id, char *buf, int len, char *field, t_pat **pat_return, void **data_return));
t_status tftpfname_pat_get_tmpl P((void *data, t_id *id, char *buf, int len, char *str, int max_len));
t_status tftpfname_pat_sub P((void *data, t_id *optional_id, char *buf, int len, t_pat **pat_return));
t_status tftperror_pat_name P((void *data, t_id *optional_id, char *str, int max_len));
t_status tftperror_pat_get_field P((void *data, t_id *optional_id, char *buf, int len, char *field, char *str, int max_len));
t_status tftperror_pat_set_field P((void *data, t_id *optional_id, char *buf, int len, char *field, char *value));
t_status tftperror_pat_get_fields P((void *data, t_vec *vec_str));
t_status tftperror_pat_get_field_pat P((void *data, t_id *optional_id, char *buf, int len, char *field, t_pat **pat_return, void **data_return));
t_status tftperror_pat_get_tmpl P((void *data, t_id *id, char *buf, int len, char *str, int max_len));
t_status tftperror_pat_off P((void *data, char *buf, int len, t_off *off_return));
t_status tftperror_pat_sub P((void *data, t_id *optional_id, char *buf, int len, t_pat **pat_return));
t_status tftpbn_pat_name P((void *data, t_id *optional_id, char *str, int max_len));
t_status tftpbn_pat_get_field P((void *data, t_id *optional_id, char *buf, int len, char *field, char *str, int max_len));
t_status tftpbn_pat_set_field P((void *data, t_id *optional_id, char *buf, int len, char *field, char *value));
t_status tftpbn_pat_get_fields P((void *data, t_vec *vec_str));
t_status tftpbn_pat_get_field_pat P((void *data, t_id *optional_id, char *buf, int len, char *field, t_pat **pat_return, void **data_return));
t_status tftpbn_pat_get_tmpl P((void *data, t_id *id, char *buf, int len, char *str, int max_len));
t_status tftpbn_pat_off P((void *data, char *buf, int len, t_off *off_return));
t_status tftpbn_pat_sub P((void *data, t_id *optional_id, char *buf, int len, t_pat **pat_return));
int tftp_get_opcode P((t_tftp *tftp));
t_status tftp_pat_name P((void *data, t_id *optional_id, char *str, int max_len));
t_status tftp_pat_get_field P((void *data, t_id *optional_id, char *buf, int len, char *field, char *str, int max_len));
t_status tftp_pat_set_field P((void *data, t_id *optional_id, char *buf, int len, char *field, char *value));
t_status tftp_pat_get_fields P((void *data, t_vec *vec_str));
t_status tftp_pat_get_field_pat P((void *data, t_id *optional_id, char *buf, int len, char *field, t_pat **pat_return, void **data_return));
t_status tftp_pat_get_tmpl P((void *data, t_id *id, char *buf, int len, char *str, int max_len));
t_status tftp_pat_off P((void *data, char *buf, int len, t_off *off_return));
t_status tftp_pat_sub P((void *data, t_id *optional_id, char *buf, int len, t_pat **pat_return));
#endif
