File: tftpd_mtftp.h

package info (click to toggle)
atftp 0.7.dfsg-6
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 1,144 kB
  • ctags: 538
  • sloc: ansic: 6,384; sh: 3,892; makefile: 81
file content (85 lines) | stat: -rw-r--r-- 1,998 bytes parent folder | download | duplicates (3)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/* hey emacs! -*- Mode: C; c-file-style: "k&r"; indent-tabs-mode: nil -*- */
/*
 * tftpd_mtftp.h
 *
 * $Id: tftpd_mtftp.h,v 1.5 2004/02/27 02:05:26 jp Exp $
 *
 * Copyright (c) 2000 Jean-Pierre Lefebvre <helix@step.polymtl.ca>
 *                and Remi Lefebvre <remi@debian.org>
 *
 * atftp is free software; you can redistribute them and/or modify them
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2 of the License, or (at your
 * option) any later version.
 *
 */

#ifndef tftpd_mtftp_h
#define tftpd_mtftp_h

#include <pthread.h>
#include <arpa/tftp.h>
#include <arpa/inet.h>
#include "tftp_io.h"
#include "options.h"

/*
 * This structure hold information on mtftp configuration
 * 
 */
struct mtftp_data {
     struct mtftp_thread *thread_data;
     int number_of_thread;

     /* for receiving of initial request */
     char *data_buffer;
     int data_buffer_size;
     struct tftp_opt *tftp_options;

     /* options scanned from command line */
     int server_port;
     int mcast_ttl;
     int timeout;
     int checkport;
     int trace;
};

struct mtftp_thread {
     pthread_t tid;

     /* Configuration data */
     int running;
     char file_name[MAXLEN];
     char mcast_ip[MAXLEN];     /* FIXME: could be less memory */
     char client_port[MAXLEN];

     /* Server thread variables */
     FILE *fp;

     int sockfd;
     struct sockaddr_in sa_in;
     struct sockaddr_in sa_client;

     int mcast_sockfd;
     int mcast_port;
     struct sockaddr_in sa_mcast;
     struct ip_mreq mcastaddr;

     char *data_buffer;
     int data_buffer_size;

     /* For options access */
     struct mtftp_data *mtftp_data;

     struct mtftp_thread *next;     
};

/*
 * Functions defined in tftpd_file.c
 */
struct mtftp_data *tftpd_mtftp_init(char *filename);
int tftpd_mtftp_clean(struct mtftp_data *data);
void *tftpd_mtftp_server(void *arg);
void tftpd_mtftp_kill_threads(struct mtftp_data *data);

#endif