Giter Site home page Giter Site logo

sipcore's Introduction

SWUbanner

sipcore's People

Contributors

kurotych avatar q6r avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

sipcore's Issues

Adjust HeaderValue vstr field

vstr field - This is header value from start until parameters or end of value ( not includes parameters )
Spaces at the end of value should be trimmed

Implement unicase library

For headers comparing, at least.

When comparing header fields, field names are always case-
insensitive.  Unless otherwise stated in the definition of a
particular header field, field values, parameter names, and parameter
values are case-insensitive.  Tokens are always case-insensitive.
Unless specified otherwise, values expressed as quoted strings are
case-sensitive.  For example,

      Contact: <sip:[email protected]>;expires=3600

   is equivalent to

      CONTACT: <sip:[email protected]>;ExPiReS=3600

   and

      Content-Disposition: session;handling=optional

   is equivalent to

      content-disposition: Session;HANDLING=OPTIONAL

   The following two header fields are not equivalent:

      Warning: 370 devnull "Choose a bigger pipe"
      Warning: 370 devnull "CHOOSE A BIGGER PIPE"

Refs:
https://github.com/seanmonstar/unicase/
https://docs.rs/unicase/2.6.0/unicase/
https://tools.ietf.org/html/rfc3261#section-7.3.1

Implement absoluteURI

absoluteURI = scheme ":" ( hier-part / opaque-part )

Also, replace URI in RequestLine according to RFC3261:

pub uri: SipUri<'a>,

to

pub uri: RequestURI <'a>,

Request-URI = SIP-URI / SIPS-URI / absoluteURI

Improve parsing of sip message headers

Make parsing headers according to each definition from https://tools.ietf.org/html/rfc3261#section-25

message-header  =  (Accept
                /  Accept-Encoding
                /  Accept-Language
                /  Alert-Info
                /  Allow
                /  Authentication-Info
                /  Authorization
                /  Call-ID
                /  Call-Info
                /  Contact
                /  Content-Disposition
                /  Content-Encoding
                /  Content-Language
                /  Content-Length
                /  Content-Type
                /  CSeq
                /  Date
                /  Error-Info
                /  Expires
                /  From
                /  In-Reply-To
                /  Max-Forwards
                /  MIME-Version
                /  Min-Expires
                /  Organization
                /  Priority
                /  Proxy-Authenticate
                /  Proxy-Authorization
                /  Proxy-Require
                /  Record-Route
                /  Reply-To
                /  Require
                /  Retry-After
                /  Route
                /  Server
                /  Subject
                /  Supported
                /  Timestamp
                /  To
                /  Unsupported
                /  User-Agent
                /  Via
                /  Warning
                /  WWW-Authenticate
                /  extension-header) CRLF

GenericParam panicked

let (input, (_, param_val, _)) = take_quoted_string(input).unwrap();

in some possible invalid input this causes panic

thread 'tokio-runtime-worker' panicked at 'called `Result::unwrap()` on an `Err` value: Error(SipParseError { code: 1, message: Some("take_until_nonescaped_quote error!") })'

better propagate like the rest of code in GenericParam

User Agent parser missing quot cases

fn take_value(source_input: &[u8]) -> nom::IResult<&[u8], HeaderValue, SipParseError> {

In some SIP samples from Wireshark project contained the following UA :

User-Agent: <Motorola VT1000 mac: 000CE5C74EF8 sw:VT20_02.03.00_A ln:0 cfg:1253778536520/1002173358>

This fails because quot cases not handled, maybe :

            if tmp_input[0] == b'<' {
                let (input, _) = take_sws_token::laquot(tmp_input)?;
                let (input, _) = take_until(">")(input)?;
                let (input, _) = take_sws_token::raquot(input)?;
                tmp_input = input;
                continue;
            }

sipmsg: Parameters

Create parameters.rs file for parsing header parameters fields into a container.

Think about remove NomParser

It seems useless. I don't remember why i did it

use crate::common::errorparse::SipParseError;

pub trait NomParser<'a> {
    type ParseResult;
    fn parse(input: &'a [u8]) -> nom::IResult<&[u8], Self::ParseResult, SipParseError>;
}

Message editor API

  • push_top/push_bottom(header_name)
  • pop_top/pop_bottom(header_name)
  • add_header(header_object) or add(header_name, header_value)
  • get_header_value(s)?
  • add_parameter?

Fix GenericParams parsing

Add support quoted string and host.
Currently, parsing fail with
+sip.instance="<urn:uuid:00000000-0000-1000-8000-000A95A0E128>"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.