The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Macros | Functions | Variables
tftp.h File Reference

Functions to encode/decode TFTP packets. More...

#include <freeradius-devel/protocol/tftp/freeradius.internal.h>
#include <freeradius-devel/protocol/tftp/rfc1350.h>
#include <freeradius-devel/util/dbuff.h>
+ Include dependency graph for tftp.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define FR_TFTP_BLOCK_MAX_SIZE   65464
 
#define FR_TFTP_BLOCK_MIN_SIZE   8
 
#define FR_TFTP_DEFAULT_BLOCK_SIZE   1024
 
#define FR_TFTP_HDR_LEN   (4) /* at least: 2-bytes opcode + 2-bytes */
 
#define FR_TFTP_MAX_CODE   (FR_PACKET_TYPE_VALUE_DO_NOT_RESPOND+1)
 
#define FR_TFTP_MAX_ERROR_CODE   (FR_ERROR_CODE_VALUE_NO_SUCH_USER+1)
 
#define FR_TFTP_MAX_FILESIZE   (FR_TFTP_BLOCK_MAX_SIZE * FR_TFTP_BLOCK_MAX_SIZE)
 

Functions

int fr_tftp_decode (TALLOC_CTX *ctx, fr_pair_list_t *out, uint8_t const *data, size_t data_len))
 
ssize_t fr_tftp_encode (fr_dbuff_t *dbuff, fr_pair_list_t *vps))
 
void fr_tftp_global_free (void)
 
int fr_tftp_global_init (void)
 

Variables

char const * fr_tftp_codes [FR_TFTP_MAX_CODE]
 
char const * fr_tftp_error_codes [FR_TFTP_MAX_ERROR_CODE]
 

Detailed Description

Functions to encode/decode TFTP packets.

Id
3b323f24f463f53855b91bdfcc9da3a2365f0ab5
Author
Jorge Pereira jpere.nosp@m.ira@.nosp@m.freer.nosp@m.adiu.nosp@m.s.org

Definition in file tftp.h.

Macro Definition Documentation

◆ FR_TFTP_BLOCK_MAX_SIZE

#define FR_TFTP_BLOCK_MAX_SIZE   65464

Definition at line 73 of file tftp.h.

◆ FR_TFTP_BLOCK_MIN_SIZE

#define FR_TFTP_BLOCK_MIN_SIZE   8

Definition at line 72 of file tftp.h.

◆ FR_TFTP_DEFAULT_BLOCK_SIZE

#define FR_TFTP_DEFAULT_BLOCK_SIZE   1024

Definition at line 62 of file tftp.h.

◆ FR_TFTP_HDR_LEN

#define FR_TFTP_HDR_LEN   (4) /* at least: 2-bytes opcode + 2-bytes */

Definition at line 41 of file tftp.h.

◆ FR_TFTP_MAX_CODE

#define FR_TFTP_MAX_CODE   (FR_PACKET_TYPE_VALUE_DO_NOT_RESPOND+1)

Definition at line 39 of file tftp.h.

◆ FR_TFTP_MAX_ERROR_CODE

#define FR_TFTP_MAX_ERROR_CODE   (FR_ERROR_CODE_VALUE_NO_SUCH_USER+1)

Definition at line 40 of file tftp.h.

◆ FR_TFTP_MAX_FILESIZE

#define FR_TFTP_MAX_FILESIZE   (FR_TFTP_BLOCK_MAX_SIZE * FR_TFTP_BLOCK_MAX_SIZE)

Definition at line 80 of file tftp.h.

Function Documentation

◆ fr_tftp_decode()

int fr_tftp_decode ( TALLOC_CTX *  ctx,
fr_pair_list_t out,
uint8_t const *  data,
size_t  data_len 
)

2 bytes 2 bytes

| Opcode | Block # |

Figure 5-3: ACK packet

2 bytes 2 bytes string 1 byte

| Opcode | ErrorCode | ErrMsg | 0 |

Figure 5-4: ERROR packet

Definition at line 74 of file decode.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_tftp_encode()

ssize_t fr_tftp_encode ( fr_dbuff_t dbuff,
fr_pair_list_t vps 
)

2 bytes 2 bytes

| Opcode | Block # |

Figure 5-3: ACK packet

2 bytes 2 bytes string 1 byte

| Opcode | ErrorCode | ErrMsg | 0 |

Figure 5-4: ERROR packet

Definition at line 75 of file encode.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_tftp_global_free()

void fr_tftp_global_free ( void  )

Definition at line 114 of file base.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_tftp_global_init()

int fr_tftp_global_init ( void  )

Definition at line 90 of file base.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ fr_tftp_codes

char const* fr_tftp_codes[FR_TFTP_MAX_CODE]
extern

Definition at line 71 of file base.c.

◆ fr_tftp_error_codes

char const* fr_tftp_error_codes[FR_TFTP_MAX_ERROR_CODE]
extern

Definition at line 80 of file base.c.