1%%%  Copyright (C) 2011 Nicolas Niclausse
2%%%
3%%%  This program is free software; you can redistribute it and/or modify
4%%%  it under the terms of the GNU General Public License as published by
5%%%  the Free Software Foundation; either version 2 of the License, or
6%%%  (at your option) any later version.
7%%%
8%%%  This program is distributed in the hope that it will be useful,
9%%%  but WITHOUT ANY WARRANTY; without even the implied warranty of
10%%%  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11%%%  GNU General Public License for more details.
12%%%
13%%%  You should have received a copy of the GNU General Public License
14%%%  along with this program; if not, write to the Free Software
15%%%  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
16%%%
17%%%  Created : 3 Mar 2011 by Nicolas Niclausse <nicolas@niclux.org>
18
19%%%  In addition, as a special exception, you have the permission to
20%%%  link the code of this program with any library released under
21%%%  the EPL license and distribute linked combinations including
22%%%  the two; the MPL (Mozilla Public License), which EPL (Erlang
23%%%  Public License) is based on, is included in this exception.
24
25-module(ts_plugin).
26
27-export([dump/2, parse_bidi/2]).
28
29-export([behaviour_info/1]).
30
31behaviour_info(callbacks) ->
32    [{add_dynparams, 4},
33     {get_message, 2},
34     {session_defaults, 0},
35     {dump, 2},
36     {parse, 2},
37     {parse_bidi, 2},
38     {parse_config, 2},
39     {decode_buffer, 2},
40     {new_session, 0}];
41behaviour_info(_Other) ->
42    undefined.
43
44
45%% @spec dump(protocol, {Request::term(),Session::term(), Id::integer(),
46%%             Host::string(),DataSize::integer()}) -> ok
47%% @doc It can be used to send specific data to the current plugin back to ts_mon
48%% @end
49dump(_Type,_Data) ->
50    ok.
51
52%% @spec parse_bidi(Data::binary(),State::record(state_rcv)) ->
53%%   {NewData::binary()|nodata, NewState::record(state_rcv), think|continue}
54%% @doc Parse a block of data from the server. No reply will be sent
55%% if the return value is nodata, otherwise the Data binary will be
56%% sent back to the server immediately. If the last argument is
57%% 'think', it will continue to wait; if it's 'continue', it will
58%% handle the next action (request, thinktime, ...)
59%% @end
60parse_bidi(_Data, State) ->
61    {nodata, State, think}.
62