summaryrefslogtreecommitdiffstats
path: root/src/include/proto.h
blob: 2c157ee4e05ae3e7ca1d589dbfb8af4a874c0c9d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef PROTO_H
#define PROTO_H

#include "tables.h"
#include "in.h"

struct protocol {
	char *name;
	in_port_t default_port;
	int ( * load ) ( char *url,
			 struct sockaddr_in *server,
			 char *file,
			 int ( * process ) ( unsigned char *data,
					     unsigned int blocknum,
					     unsigned int len,
					     int eof ) );
};

/*
 * Protocols that should be used if no explicit protocol is specified
 * (i.e. tftp) should use __default_protocol; all other protocols
 * should use __protocol.
 *
 */
#define __protocol_start		__table_start(protocol)
#define __protocol			__table(protocol,01)
#define __default_protocol_start	__table(protocol,02)
#define __default_protocol		__table(protocol,03)
#define __protocol_end			__table_end(protocol)

/*
 * Functions in proto.c
 *
 */
extern struct protocol * identify_protocol ( const char *name );

#endif /* PROTO_H */