syslog-ng source
stomp.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Balabit
3  * Copyright (c) 2013 Viktor Tusa <tusa@balabit.hu>
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 as published
7  * by the Free Software Foundation, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17  *
18  * As an additional exemption you are allowed to compile & link against the
19  * OpenSSL libraries as published by the OpenSSL project. See the file
20  * COPYING for details.
21  *
22  */
23 
24 #ifndef STOMP_H
25 #define STOMP_H
26 
27 #include "gsocket.h"
28 #include <glib.h>
29 
30 typedef struct stomp_connection
31 {
32  int socket;
34  char *remote_ip;
36 
37 typedef struct stomp_frame
38 {
39  char *command;
40  GHashTable *headers;
41  char *body;
43 } stomp_frame;
44 
45 void stomp_frame_init(stomp_frame *frame, const char *command, int command_len);
46 void stomp_frame_add_header(stomp_frame *frame, const char *name,
47  const char *value);
48 void stomp_frame_set_body(stomp_frame *frame, const char *body, int body_len);
50 
51 int stomp_connect(stomp_connection **connection_ref, char *hostname, int port);
52 int stomp_disconnect(stomp_connection **connection_ref);
53 
54 int stomp_write(stomp_connection *connection, stomp_frame *frame);
55 int stomp_read(stomp_connection *connection, stomp_frame **frame);
56 int stomp_parse_frame(GString *data, stomp_frame *frame);
57 int stomp_receive_frame(stomp_connection *connection, stomp_frame *frame);
58 
59 GString *create_gstring_from_frame(stomp_frame *frame);
60 
61 #endif
DebuggerCommandFunc command
Definition: debugger.c:266
const gchar * name
Definition: debugger.c:265
void stomp_frame_set_body(stomp_frame *frame, const char *body, int body_len)
Definition: stomp.c:73
int stomp_parse_frame(GString *data, stomp_frame *frame)
Definition: stomp.c:252
int stomp_frame_deinit(stomp_frame *frame)
Definition: stomp.c:80
int stomp_write(stomp_connection *connection, stomp_frame *frame)
Definition: stomp.c:342
int stomp_receive_frame(stomp_connection *connection, stomp_frame *frame)
Definition: stomp.c:275
int stomp_disconnect(stomp_connection **connection_ref)
Definition: stomp.c:134
void stomp_frame_add_header(stomp_frame *frame, const char *name, const char *value)
Definition: stomp.c:51
GString * create_gstring_from_frame(stomp_frame *frame)
Definition: stomp.c:327
int stomp_read(stomp_connection *connection, stomp_frame **frame)
int stomp_connect(stomp_connection **connection_ref, char *hostname, int port)
Definition: stomp.c:97
void stomp_frame_init(stomp_frame *frame, const char *command, int command_len)
Definition: stomp.c:42
Definition: gsockaddr.h:46
Definition: stomp.h:31
int socket
Definition: stomp.h:32
char * remote_ip
Definition: stomp.h:34
GSockAddr * remote_sa
Definition: stomp.h:33
Definition: stomp.h:38
GHashTable * headers
Definition: stomp.h:40
char * body
Definition: stomp.h:41
int body_length
Definition: stomp.h:42
char * command
Definition: stomp.h:39
GString * value
Definition: test_decode.c:28