// SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
// SPDX-License-Identifier: MIT

package proto

import (
	
)

// DontFragmentAttr is a deprecated alias for DontFragment
// Deprecated: Please use DontFragment.
type DontFragmentAttr = DontFragment

// DontFragment represents DONT-FRAGMENT attribute.
//
// This attribute is used by the client to request that the server set
// the DF (Don't Fragment) bit in the IP header when relaying the
// application data onward to the peer.  This attribute has no value
// part and thus the attribute length field is 0.
//
// RFC 5766 Section 14.8.
type DontFragment struct{}

const dontFragmentSize = 0

// AddTo adds DONT-FRAGMENT attribute to message.
func (DontFragment) ( *stun.Message) error {
	.Add(stun.AttrDontFragment, nil)

	return nil
}

// GetFrom decodes DONT-FRAGMENT from message.
func ( *DontFragment) ( *stun.Message) error {
	,  := .Get(stun.AttrDontFragment)
	if  != nil {
		return 
	}

	return stun.CheckSize(stun.AttrDontFragment, len(), dontFragmentSize)
}

// IsSet returns true if DONT-FRAGMENT attribute is set.
func (DontFragment) ( *stun.Message) bool {
	,  := .Get(stun.AttrDontFragment)

	return  == nil
}