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

package ice

import (
	

	
)

// PriorityAttr represents PRIORITY attribute.
type PriorityAttr uint32

const prioritySize = 4 // 32 bit

// AddTo adds PRIORITY attribute to message.
func ( PriorityAttr) ( *stun.Message) error {
	 := make([]byte, prioritySize)
	binary.BigEndian.PutUint32(, uint32())
	.Add(stun.AttrPriority, )

	return nil
}

// GetFrom decodes PRIORITY attribute from message.
func ( *PriorityAttr) ( *stun.Message) error {
	,  := .Get(stun.AttrPriority)
	if  != nil {
		return 
	}
	if  = stun.CheckSize(stun.AttrPriority, len(), prioritySize);  != nil {
		return 
	}
	* = PriorityAttr(binary.BigEndian.Uint32())

	return nil
}