External Data Representation (XDR) is a standard data serialization format, for uses such as computer network protocols. It allows data to be transferred between different kinds of computer systems. Converting from the local representation to XDR is called encoding. Converting from XDR to the local representation is called decoding. XDR is implemented as a software library of functions which is portable between different operating systems and is also independent of the transport layer.
XDR uses a base unit of 4 bytes, serialized in big-endian order; smaller data types still occupy four bytes each after encoding. Variable-length types such as string and opaque are padded to a total divisible by four bytes. Floating-point numbers are represented in IEEE 754 format.
XDR was developed in the mid 1980s at Sun Microsystems, and first widely published in 1987. XDR became an IETF standard in 1995.
The XDR data format is in use by many systems, including:
Network File System (protocol)ZFS File SystemNDMP Network Data Management ProtocolOpen Network Computing Remote Procedure CallLegato NetWorker backup software (later sold by EMC)NetCDF (a scientific data format)The R language and environment for statistical computingThe HTTP-NG Binary Wire ProtocolThe SpiderMonkey JavaScript engine, to serialize/deserialize compiled JavaScript codeThe Ganglia distributed monitoring systemThe sFlow network monitoring standardThe libvirt virtualization library, API and UIThe Firebird (database server) for Remote Binary Wire Protocolbooleanint – 32-bit integerunsigned int – unsigned 32-bit integerhyper – 64-bit integerunsigned hyper – unsigned 64-bit integerIEEE floatIEEE doublequadruple (new in RFC1832)enumerationstructurestringfixed length arrayvariable length arrayunion – discriminated unionfixed length opaque datavariable length opaque datavoid – zero byte quantityoptional – optional data is notated similarly to C pointers, but is represented as the data type "pointed to" with a boolean "present or not" flag.