26 RCSID(
"$Id: 3ade5916865e76eedd14e69087b1fd0885d1d486 $")
28 #include <freeradius-devel/util/dbuff.h>
29 #include <freeradius-devel/util/udp.h>
31 #include <freeradius-devel/io/test_point.h>
88 opcode =
vp->vp_uint16;
92 case FR_OPCODE_VALUE_READ_REQUEST:
93 case FR_OPCODE_VALUE_WRITE_REQUEST:
119 switch(
vp->vp_uint16) {
120 case FR_MODE_VALUE_ASCII: buf =
"ascii";
break;
121 case FR_MODE_VALUE_OCTET: buf =
"octet";
break;
138 snprintf(tmp,
sizeof(tmp),
"%d",
vp->vp_uint16);
145 case FR_OPCODE_VALUE_ACKNOWLEDGEMENT:
146 case FR_OPCODE_VALUE_DATA:
173 if (opcode != FR_OPCODE_VALUE_DATA)
goto done;
186 case FR_OPCODE_VALUE_ERROR:
197 char const *error_msg;
198 size_t error_msg_len;
207 error_code =
vp->vp_uint16;
213 error_msg =
vp->vp_strvalue;
214 error_msg_len =
vp->vp_length;
217 error_msg_len = strlen(error_msg);
264 if (!test_ctx)
return -1;
#define fr_dbuff_used(_dbuff_or_marker)
Return the number of bytes remaining between the start of the dbuff or marker and the current positio...
#define fr_dbuff_in_bytes(_dbuff_or_marker,...)
Copy a byte sequence into a dbuff or marker.
#define FR_DBUFF_IN_MEMCPY_RETURN(_dbuff_or_marker, _in, _inlen)
Copy exactly _inlen bytes into dbuff or marker returning if there's insufficient space.
#define fr_dbuff_in(_dbuff_or_marker, _in)
Copy data from a fixed sized C type into a dbuff or marker.
#define FR_DBUFF_MAX(_dbuff_or_marker, _max)
Limit the maximum number of bytes available in the dbuff when passing it to another function.
#define FR_DBUFF_TMP(_start, _len_or_end)
Creates a compound literal to pass into functions which accept a dbuff.
fr_pair_t * fr_pair_find_by_da(fr_pair_list_t const *list, fr_pair_t const *prev, fr_dict_attr_t const *da)
Find the first pair with a matching da.
HIDDEN fr_dict_attr_t const * attr_tftp_error_code
HIDDEN fr_dict_attr_t const * attr_tftp_filename
HIDDEN fr_dict_attr_t const * attr_tftp_block_size
HIDDEN fr_dict_attr_t const * attr_tftp_opcode
HIDDEN fr_dict_attr_t const * attr_tftp_mode
HIDDEN fr_dict_attr_t const * attr_tftp_data
HIDDEN fr_dict_attr_t const * attr_tftp_block
HIDDEN fr_dict_attr_t const * attr_tftp_error_message
char const * fr_tftp_error_codes[FR_TFTP_MAX_ERROR_CODE]
int fr_tftp_global_init(void)
void fr_tftp_global_free(void)
static int _encode_test_ctx(UNUSED fr_tftp_ctx_t *proto_ctx)
static ssize_t fr_tftp_encode_proto(UNUSED TALLOC_CTX *ctx, fr_pair_list_t *vps, uint8_t *data, size_t data_len, UNUSED void *proto_ctx)
ssize_t fr_tftp_encode(fr_dbuff_t *dbuff, fr_pair_list_t *vps)
static int encode_test_ctx(void **out, TALLOC_CTX *ctx)
fr_test_point_proto_encode_t tftp_tp_encode_proto
PUBLIC int snprintf(char *string, size_t length, char *format, va_alist)
Stores an attribute, a value and various bits of other data.
fr_test_point_ctx_alloc_t test_ctx
Allocate a test ctx for the encoder.
Entry point for protocol encoders.
Functions to encode/decode TFTP packets.
#define FR_TFTP_BLOCK_MAX_SIZE
#define fr_strerror_printf(_fmt,...)
Log to thread local error buffer.
return fr_dbuff_set(dbuff, &our_dbuff)
static size_t char ** out