File: tftp_io.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 (59 lines) | stat: -rw-r--r-- 2,264 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
/* hey emacs! -*- Mode: C; c-file-style: "k&r"; indent-tabs-mode: nil -*- */
/*
 * tftp_io.h
 *
 * $Id: tftp_io.h,v 1.18 2004/02/13 03:16:09 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 tftp_io_h
#define tftp_io_h

#include <arpa/tftp.h>
#include <sys/socket.h>
#include "tftp_def.h"
#include "options.h"

/* missing from <arpa/tftp.h> */
/* new opcode */
#define OACK   06
/* new error code */
#define EOPTNEG 8               /* error in option negociation */

/* return value of tftp_get_packet */
#define GET_DISCARD 0
#define GET_TIMEOUT 1
#define GET_RRQ     2
#define GET_WRQ     3
#define GET_ACK     4
#define GET_OACK    5
#define GET_ERROR   6
#define GET_DATA    7

/* functions prototype */
int tftp_send_request(int socket, struct sockaddr_in *s_inn, short type,
                      char *data_buffer, int data_buffer_size,
                      struct tftp_opt *tftp_options);
int tftp_send_ack(int socket, struct sockaddr_in *s_inn, short block_number);
int tftp_send_oack(int socket, struct sockaddr_in *s_inn, struct tftp_opt *tftp_options,
                   char *buffer, int buffer_size);
int tftp_send_error(int socket, struct sockaddr_in *s_inn, short err_code,
                    char *buffer, int buffer_size);
int tftp_send_data(int socket, struct sockaddr_in *s_inn, short block_number,
                   int size, char *data);
int tftp_get_packet(int sock1, int sock2, int *sock, struct sockaddr_in *sa,
                    struct sockaddr_in *from, struct sockaddr_in *to,
                    int timeout, int *size, char *data);
int tftp_file_read(FILE *fp, char *buffer, int buffer_size, int block_number, int convert,
                   int *prev_block_number, int *prev_file_pos, int *temp);
int tftp_file_write(FILE *fp, char *data_buffer, int data_buffer_size, int block_number,
                    int data_size, int convert, int *prev_block_number, int *temp);
#endif