/*
** pat_null.c for  in 
** 
** Made by 
** Login   <vianney@epita.fr>
** 
** Started on  Wed Sep  1 06:42:29 1999 
** Last update Thu Nov 18 04:34:08 1999 
*/
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include "pat_null.h"
#include "pat_ip.h"
#include "pat_data.h"
#include "pat_rip.h"
#include "pat_32.h"

t_field				null_fields[] = 
{
  {"family",	OFFSET(t_null *,family), &u32_pat,	        	NULL},
  {"Family",	OFFSET(t_null *,family), &u32assoc_pat,       family_assocs},
  NULL_FIELD
};

char				*null_itmpl = "\n\
<table _name=null[%i%] width=100%%%% bgcolor=\"%%nullColor%%\">\n\
<tr>\n\
<td align=center width=100%%%%>\n\
<a href=\"set(null[%i%].Family)\">%%null[%i%].Family%%</a>\n\
(<a href=\"set(null[%i%].family)\">%%null[%i%].family%%</a>)\n\
</td>\n\
</tr>\n\
</table>\n\
<br>\n\
";

int	null_chan;

PAT_NAME_GENERIC(null_pat_name,
		 (VOID_PTR)&null_chan,
		 "null")

PAT_GET_FIELD_GENERIC(null_pat_get_field,
		      null_fields)

PAT_SET_FIELD_GENERIC(null_pat_set_field,
		      null_fields)

PAT_GET_FIELDS_GENERIC(null_pat_get_fields,
		       null_fields)

PAT_GET_FIELD_PAT_GENERIC(null_pat_get_field_pat,
			  null_fields)

PAT_GET_TMPL_GENERIC(null_pat_get_tmpl,
		     (VOID_PTR)&null_chan,
		     null_itmpl)

PAT_OFF_GENERIC(null_pat_off,
		NULL_HLEN)

PAT_SUB_DECL(null_pat_sub)
{
  t_null		*null;
  t_u32			family;

  PAT_NULL_CHECK(null,buf,len);
  switch (null->family)
    {
    case AF_INET:
	(*pat_return) = &ip_pat;
	return (0);
    }
  (*pat_return) = &data_pat;
  return (0);
}

t_pat				null_pat = 
{
  null_pat_name,		/* t_pat_name_proc		*/
  null_pat_off,			/* t_pat_off_proc		*/
  null_pat_sub,			/* t_pat_sub_proc		*/
  NULL,				/* t_pat_sum_proc		*/
  null_pat_get_field,		/* t_pat_get_field_proc		*/
  null_pat_set_field,		/* t_pat_set_field_proc		*/
  null_pat_get_fields,		/* t_pat_get_fields_proc	*/
  null_pat_get_tmpl,		/* t_pat_get_tmpl_proc		*/
  NULL,				/* t_pat_get_tmpl2_proc		*/
  NULL,				/* t_pat_has_opt_proc		*/
  NULL,				/* t_pat_adapt_len_proc		*/
  null_pat_get_field_pat,	/* t_pat_get_field_pat_proc	*/
  NULL,				/* t_pat_extract_proc		*/
  NULL,				/* t_pat_insert_proc		*/
  NULL,				/* t_pat_get_choices_proc	*/
};
