Module Wire

module Wire: sig .. end

TFTP wire parsers




TFTP error codes


type errorcode = 
| UNDEFINED (*
operation undefined, e.g., couldn't create TID
*)
| FILE_NOT_FOUND (*
file not found in store
*)
| ACCESS_VIOLATION
| DISK_FULL
| ILLEGAL_OP (*
unsupported operation, e.g., unsupported mode
*)
| UNKNOWN_TID
| FILE_EXISTS
| UNKNOWN_USER

Conversion to/from Wire.errorcodes.
val int_to_errorcode : int -> errorcode option
val errorcode_to_int : errorcode -> int
val errorcode_to_string : errorcode -> string
val string_to_errorcode : string -> errorcode option

TFTP opcodes


type opcode = 
| RRQ (*
read request
*)
| WRQ (*
write request
*)
| DATA (*
data block
*)
| ACK (*
acknowledgement
*)
| ERROR (*
error indication
*)

Conversion to/from Wire.opcodes.
val int_to_opcode : int -> opcode option
val opcode_to_int : opcode -> int
val opcode_to_string : opcode -> string
val string_to_opcode : string -> opcode option

Request packets, Wire.opcode.RRQ/Wire.opcode.WRQ


val sizeof_hreq : int
val get_hreq_opcode : Cstruct.t -> Cstruct.uint16
val set_hreq_opcode : Cstruct.t -> Cstruct.uint16 -> unit
val hexdump_hreq_to_buffer : Buffer.t -> Cstruct.t -> unit
val hexdump_hreq : Cstruct.t -> unit

Data packets, Wire.opcode.DATA/Wire.opcode.ACK


val sizeof_hdat : int
val get_hdat_opcode : Cstruct.t -> Cstruct.uint16
val set_hdat_opcode : Cstruct.t -> Cstruct.uint16 -> unit
val get_hdat_blockno : Cstruct.t -> Cstruct.uint16
val set_hdat_blockno : Cstruct.t -> Cstruct.uint16 -> unit
val hexdump_hdat_to_buffer : Buffer.t -> Cstruct.t -> unit
val hexdump_hdat : Cstruct.t -> unit

Error packets, Wire.opcode.ERROR


val sizeof_herr : int
val get_herr_opcode : Cstruct.t -> Cstruct.uint16
val set_herr_opcode : Cstruct.t -> Cstruct.uint16 -> unit
val get_herr_errorcode : Cstruct.t -> Cstruct.uint16
val set_herr_errorcode : Cstruct.t -> Cstruct.uint16 -> unit
val hexdump_herr_to_buffer : Buffer.t -> Cstruct.t -> unit
val hexdump_herr : Cstruct.t -> unit

Utility functions


val string0 : Cstruct.t -> string * Cstruct.t
string0 buf extracts a NUL terminated ASCII string from buf, shifts buf past it, and returns the pair.