1 /*******************************************************************************
2 * Copyright (c) 2011 Intalio, Inc.
3 * ======================================================================
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * and Apache License v2.0 which accompanies this distribution.
7 *
8 * The Eclipse Public License is available at
9 * http://www.eclipse.org/legal/epl-v10.html
10 *
11 * The Apache License v2.0 is available at
12 * http://www.opensource.org/licenses/apache2.0.php
13 *
14 * You may elect to redistribute this code under either of these licenses.
15 *******************************************************************************/
16 // ========================================================================
17 // Copyright (c) 2010 Mort Bay Consulting Pty. Ltd.
18 // ------------------------------------------------------------------------
19 // All rights reserved. This program and the accompanying materials
20 // are made available under the terms of the Eclipse Public License v1.0
21 // and Apache License v2.0 which accompanies this distribution.
22 // The Eclipse Public License is available at
23 // http://www.eclipse.org/legal/epl-v10.html
24 // The Apache License v2.0 is available at
25 // http://www.opensource.org/licenses/apache2.0.php
26 // You may elect to redistribute this code under either of these licenses.
27 // ========================================================================
28
29 package org.eclipse.jetty.websocket;
30
31 import org.eclipse.jetty.io.Buffer;
32
33
34
35 /* ------------------------------------------------------------ */
36 /**
37 * Parser the WebSocket protocol.
38 *
39 */
40 public interface WebSocketParser
41 {
42
43 /* ------------------------------------------------------------ */
44 /* ------------------------------------------------------------ */
45 /* ------------------------------------------------------------ */
46 public interface FrameHandler
47 {
48 void onFrame(byte flags, byte opcode, Buffer buffer);
49 void close(int code,String message);
50 }
51
52 Buffer getBuffer();
53
54 /**
55 * @return an indication of progress, normally bytes filled plus events parsed, or -1 for EOF
56 */
57 int parseNext();
58
59 boolean isBufferEmpty();
60
61 void fill(Buffer buffer);
62
63 }