diff options
author | metamuffin <metamuffin@disroot.org> | 2024-11-19 02:08:52 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-11-19 02:08:52 +0100 |
commit | cbc111f90b5facc1f2a9dd79ced216279d6260af (patch) | |
tree | fa5a1d2d67874413d8e66673825c6789e8cc0945 /sip/src/encoding/status.rs | |
parent | 2d9a31244eab6d3a9871369d3148de253e902d36 (diff) | |
download | sip-rs-cbc111f90b5facc1f2a9dd79ced216279d6260af.tar sip-rs-cbc111f90b5facc1f2a9dd79ced216279d6260af.tar.bz2 sip-rs-cbc111f90b5facc1f2a9dd79ced216279d6260af.tar.zst |
move files + rtp parser
Diffstat (limited to 'sip/src/encoding/status.rs')
-rw-r--r-- | sip/src/encoding/status.rs | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/sip/src/encoding/status.rs b/sip/src/encoding/status.rs new file mode 100644 index 0000000..61b2d2a --- /dev/null +++ b/sip/src/encoding/status.rs @@ -0,0 +1,63 @@ +macro_rules! status_enum { + ($v:vis enum $name:ident { $($variant:ident = $value:literal),*, }) => { + #[derive(Debug, Clone, Eq, PartialEq, Hash)] + $v enum $name { $($variant),*, Other(u16) } + impl $name { pub fn from_code(c: u16) -> Self { match c { $($value => Self::$variant),*, x => Self::Other(x) } } } + impl $name { pub fn to_code(&self) -> u16 { match self { $(Self::$variant => $value),*, Self::Other(x) => *x } } } + }; +} + +status_enum!( + pub enum Status { + Trying = 100, + Ringing = 180, + CallIsBeingForwarded = 181, + Queued = 182, + SessionProgress = 183, + Ok = 200, + MultipleChoices = 300, + MovedPermanently = 301, + MovedTemporarily = 302, + UseProxy = 305, + AlternativeService = 380, + BadRequest = 400, + Unauthorized = 401, + PaymentRequired = 402, + Forbidden = 403, + NotFound = 404, + MethodNotAllowed = 405, + NotAcceptable = 406, + ProxyAuthenticationRequired = 407, + RequestTimeout = 408, + Gone = 410, + RequestEntityTooLarge = 413, + RequestURITooLarge = 414, + UnsupportedMediaType = 415, + UnsupportedURIScheme = 416, + BadExtension = 420, + ExtensionRequired = 421, + IntervalTooBrief = 423, + TemporarilyNotAvailable = 480, + CallLegTransactionDoesNotExist = 481, + LoopDetected = 482, + TooManyHops = 483, + AddressIncomplete = 484, + Ambiguous = 485, + BusyHere = 486, + RequestTerminated = 487, + NotAcceptableHere = 488, + RequestPending = 491, + Undecipherable = 493, + InternalServerError = 500, + NotImplemented = 501, + BadGateway = 502, + ServiceUnavailable = 503, + ServerTimeout = 504, + SIPVersionNotSupported = 505, + MessageTooLarge = 513, + BusyEverywhere = 600, + Decline = 603, + DoesNotExistAnywhere = 604, + GlobalNotAcceptable = 606, + } +); |