BGP encoder/decoder