1/* hey emacs! -*- Mode: C; c-file-style: "k&r"; indent-tabs-mode: nil -*- */
2/*
3 * tftpd_mtftp.h
4 *
5 * $Id: tftpd_mtftp.h,v 1.5 2004/02/27 02:05:26 jp Exp $
6 *
7 * Copyright (c) 2000 Jean-Pierre Lefebvre <helix@step.polymtl.ca>
8 *                and Remi Lefebvre <remi@debian.org>
9 *
10 * atftp is free software; you can redistribute them and/or modify them
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 */
16
17#ifndef tftpd_mtftp_h
18#define tftpd_mtftp_h
19
20#include <pthread.h>
21#include <arpa/tftp.h>
22#include <arpa/inet.h>
23#include "tftp_io.h"
24#include "options.h"
25
26/*
27 * This structure hold information on mtftp configuration
28 *
29 */
30struct mtftp_data {
31     struct mtftp_thread *thread_data;
32     int number_of_thread;
33
34     /* for receiving of initial request */
35     char *data_buffer;
36     int data_buffer_size;
37     struct tftp_opt *tftp_options;
38
39     /* options scanned from command line */
40     int server_port;
41     int mcast_ttl;
42     int timeout;
43     int checkport;
44     int trace;
45};
46
47struct mtftp_thread {
48     pthread_t tid;
49
50     /* Configuration data */
51     int running;
52     char file_name[MAXLEN];
53     char mcast_ip[MAXLEN];     /* FIXME: could be less memory */
54     char client_port[MAXLEN];
55
56     /* Server thread variables */
57     FILE *fp;
58
59     int sockfd;
60     struct sockaddr_in sa_in;
61     struct sockaddr_in sa_client;
62
63     int mcast_sockfd;
64     int mcast_port;
65     struct sockaddr_in sa_mcast;
66     struct ip_mreq mcastaddr;
67
68     char *data_buffer;
69     int data_buffer_size;
70
71     /* For options access */
72     struct mtftp_data *mtftp_data;
73
74     struct mtftp_thread *next;
75};
76
77/*
78 * Functions defined in tftpd_file.c
79 */
80struct mtftp_data *tftpd_mtftp_init(char *filename);
81int tftpd_mtftp_clean(struct mtftp_data *data);
82void *tftpd_mtftp_server(void *arg);
83void tftpd_mtftp_kill_threads(struct mtftp_data *data);
84
85#endif
86