macmaskarg.go
func (d *Directive) MarshalBinary() ([]byte, error) {
	// Ethernet hardware addresses must be 6 bytes in length
	if len(d.MAC) != 6 {
		return nil, ErrorBadArgumentParameter
	}

	// Allocate fixed-length byte structure
	b := make([]byte, directiveLen)

	// 1 byte reserved

	// Add command copy hardware address into Directive
	b[1] = uint8(d.Command)
	copy(b[2:], d.MAC)

	return b, nil
}
func (d *Directive) MarshalBinary() ([]byte, error) {
	// Ethernet hardware addresses must be 6 bytes in length
	if len(d.MAC) != 6 {
		return nil, ErrorBadArgumentParameter
	}

	// Allocate fixed-length byte structure
	b := make([]byte, directiveLen)

	// 1 byte reserved

	// Add command copy hardware address into Directive
	b[1] = uint8(d.Command)
	copy(b[2:], d.MAC)

	return b, nil
}
func ( d * Directive ) MarshalBinary ( ) ( [ ] byte , error ) { // Ethernet hardware addresses must be 6 bytes in length if len ( d . MAC ) != 6 { return nil , ErrorBadArgumentParameter } // Allocate fixed-length byte structure b := make ( [ ] byte , directiveLen ) // 1 byte reserved // Add command copy hardware address into Directive b [ 1 ] = uint8 ( d . Command ) copy ( b [ 2 : ] , d . MAC ) return b , nil }
// MarshalBinary allocates a byte slice containing the data from a Directive.
//
// If d.MAC is not 6 bytes in length, ErrorBadArgumentParameter is returned.
MarshalBinary allocates a byte slice containing the data from a Directive . If d . MAC is not 6 bytes in length ErrorBadArgumentParameter is returned .