Examples of SipParser


Examples of com.ericsson.ssa.sip.SipParser

        boolean invokeNextFilter = true;

        final WorkerThread workerThread =
                ((WorkerThread) Thread.currentThread());
        ByteBuffer buffer = workerThread.getByteBuffer();
        SipParser _parser = SipParser.getInstance();
        final Protocol prot = ctx.getProtocol();
        final SelectionKey key = ctx.getSelectionKey();
        final SelectorHandler handler = ctx.getSelectorHandler();
      final ThreadAttachment currentTA = workerThread.getAttachment();

        TargetTuple remote = null;
        InetSocketAddress local = null;
        X509Certificate[] x509Certs = null;

        switch (prot) {
            case TCP:
                s = ((SocketChannel) key.channel()).socket();
                remoteAddress = (InetSocketAddress) s.getRemoteSocketAddress();
                remote = new TargetTuple(SipTransports.TCP_PROT, remoteAddress);
                local = (InetSocketAddress) s.getLocalSocketAddress();

                break;

            case UDP:
                if (!GrizzlyNetworkManager.useDefaultUDPSelectorHandler){
                    buffer = (ByteBuffer) ctx.removeAttribute
                            (GrizzlyNetworkManager.UDP_BUFFER);               
                } else {
                    ctx.setKeyRegistrationState(Context.KeyRegistrationState.NONE);               
                    handler.register(key, SelectionKey.OP_READ);
                }
                DatagramSocket d = ((DatagramChannel) key.channel()).socket();
                remoteAddress =
                        (InetSocketAddress) ctx.getAttribute(ReadFilter.UDP_SOCKETADDRESS);
                remote = new TargetTuple(SipTransports.UDP_PROT, remoteAddress);
                local = (InetSocketAddress) d.getLocalSocketAddress();
                break;

            case TLS:
                s = ((SocketChannel) key.channel()).socket();
                remoteAddress = (InetSocketAddress) s.getRemoteSocketAddress();
                remote = new TargetTuple(SipTransports.TLS_PROT, remoteAddress);
                local = (InetSocketAddress) s.getLocalSocketAddress();
                Object[] certs =
                        (Object[]) ctx.removeAttribute(GrizzlyNetworkManager.SIP_CERTS);

                if ((certs != null) && (certs.length > 0)) {
                    ArrayList<X509Certificate> al =
                            new ArrayList<X509Certificate>();

                    for (int i = 0; i < certs.length; i++) {
                        if (certs[i] instanceof X509Certificate) {
                            al.add((X509Certificate) certs[i]);
                        } else {
                            logger.log(Level.WARNING,
                                    "sip.network.grizzly.wrong.certs",
                                    new Object[]{certs[i].getClass()});
                        }
                    }

                    x509Certs = al.toArray(new X509Certificate[al.size()]);
                }

                break;
        }

        try {
            int initialSize = 0;
            buffer.flip();

            int remaining = buffer.remaining();
            while (((remaining > 0) && (initialSize != remaining)) ||
                    (parsedMessage == null)) {
                initialSize = remaining;
                if (_message == null) {
                    skipNewLines(buffer);
                }
                if (!buffer.hasRemaining()) {
                    return invokeNextFilter;
                }

                parsedMessage = _parser.parseMessage(_message, buffer, local,
                        remote, null);
                remaining = buffer.remaining();

                if ((parsedMessage != null) &&
                        parsedMessage.isMessageComplete() && remaining > 0) {
View Full Code Here

Examples of net.sourceforge.peers.sip.syntaxencoding.SipParser

    private Config config;
   
    public TransportManager(TransactionManager transactionManager,
            Config config, Logger logger) {
        sipParser = new SipParser();
        datagramSockets = new Hashtable<SipTransportConnection, DatagramSocket>();
        messageSenders = new Hashtable<SipTransportConnection, MessageSender>();
        messageReceivers = new Hashtable<SipTransportConnection, MessageReceiver>();
        this.transactionManager = transactionManager;
        this.config = config;
View Full Code Here

Examples of net.sourceforge.peers.sip.syntaxencoding.SipParser

        assert message.equals(expectedMessage) : "message != expected message";
    }
   
    private SipMessage parse(String message) throws IOException, SipParserException {
        ByteArrayInputStream bais = new ByteArrayInputStream(message.getBytes());
        SipParser sipParser = new SipParser();
        SipMessage sipMessage = sipParser.parse(bais);
        return sipMessage;
    }
View Full Code Here

Examples of net.sourceforge.peers.sip.syntaxencoding.SipParser

        new DatagramSocket(port, InetAddress.getLocalHost());
    }

    private SipMessage parse(String message) throws IOException, SipParserException {
        ByteArrayInputStream bais = new ByteArrayInputStream(message.getBytes());
        SipParser sipParser = new SipParser();
        SipMessage sipMessage = sipParser.parse(bais);
        return sipMessage;
    }
View Full Code Here

Examples of net.sourceforge.peers.sip.syntaxencoding.SipParser

        assert "abc".equals(dialog.getLocalTag());
    }
   
    private SipMessage parse(String message) throws IOException, SipParserException {
        ByteArrayInputStream bais = new ByteArrayInputStream(message.getBytes());
        SipParser sipParser = new SipParser();
        SipMessage sipMessage = sipParser.parse(bais);
        return sipMessage;
    }
View Full Code Here

Examples of net.sourceforge.peers.sip.syntaxencoding.SipParser

        }
    }

    private SipMessage parse(String message) {
        ByteArrayInputStream bais = new ByteArrayInputStream(message.getBytes());
        SipParser sipParser = new SipParser();
        SipMessage sipMessage = null;
        try {
            sipMessage = sipParser.parse(bais);
        } catch (SipParserException e) {
            e.printStackTrace();
            return null;
        } catch (IOException ioe) {
            ioe.printStackTrace();
View Full Code Here

Examples of net.sourceforge.peers.sip.syntaxencoding.SipParser

        assert serverTransaction instanceof InviteServerTransaction;
    }
   
    private SipMessage parse(String message) throws IOException, SipParserException {
        ByteArrayInputStream bais = new ByteArrayInputStream(message.getBytes());
        SipParser sipParser = new SipParser();
        SipMessage sipMessage = sipParser.parse(bais);
        return sipMessage;
    }
View Full Code Here

Examples of org.cipango.sip.SipParser

  }
 
  public static SipMessage getMessage(String msg) throws Exception
  {
    EventHandler handler = new EventHandler();
    SipParser parser = new SipParser(new ByteArrayBuffer(msg.getBytes()), handler);
    parser.parse();
    return handler.getMessage();
  }
View Full Code Here

Examples of org.cipango.sip.SipParser

    int read;
    while ((read = is.read(buffer)) != -1)
    {
      os.write(buffer, 0, read);
    }
    SipParser parser = new SipParser(new ByteArrayBuffer(os.toByteArray()), handler);
    parser.parse();
   
    SipMessage message = handler.getMessage();
    String toString = message.toString();
    System.out.println(message);
   
View Full Code Here

Examples of org.cipango.sip.SipParser

    System.arraycopy(p.getData(), 0, b, 0, length);
   
    Buffer buffer = new ByteArrayBuffer(b);
   
    EventHandler handler = new EventHandler();
    SipParser parser = new SipParser(buffer, handler);
   
    try
    {
      parser.parse();
     
      SipMessage message = handler.getMessage();
      message.setConnection(new UdpConnection(p.getAddress(), p.getPort()));
     
      /*
 
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.