libguac 1.5.5
Loading...
Searching...
No Matches
parser.h
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20#ifndef _GUAC_PARSER_H
21#define _GUAC_PARSER_H
22
29#include "parser-types.h"
30#include "parser-constants.h"
31#include "socket-types.h"
32
34
38 char* opcode;
39
43 int argc;
44
48 char** argv;
49
54
58 int __element_length;
59
63 int __elementc;
64
68 char* __elementv[GUAC_INSTRUCTION_MAX_ELEMENTS];
69
74 char* __instructionbuf_unparsed_start;
75
79 char* __instructionbuf_unparsed_end;
80
86 char __instructionbuf[32768];
87
88};
89
97
112int guac_parser_append(guac_parser* parser, void* buffer, int length);
113
122
132int guac_parser_shift(guac_parser* parser, void* buffer, int length);
133
140
162int guac_parser_read(guac_parser* parser, guac_socket* socket, int usec_timeout);
163
185int guac_parser_expect(guac_parser* parser, guac_socket* socket, int usec_timeout, const char* opcode);
186
187#endif
188
Constants related to the Guacamole protocol parser.
#define GUAC_INSTRUCTION_MAX_ELEMENTS
The maximum number of elements per instruction, including the opcode.
Definition parser-constants.h:42
Type definitions related to parsing the Guacamole protocol.
guac_parse_state
All possible states of the instruction parser.
Definition parser-types.h:32
guac_parser * guac_parser_alloc()
Allocates a new parser.
int guac_parser_shift(guac_parser *parser, void *buffer, int length)
Removes up to length bytes from internal buffer of unparsed bytes, storing them in the given buffer.
int guac_parser_length(guac_parser *parser)
Returns the number of unparsed bytes stored in the given parser's internal buffers.
int guac_parser_read(guac_parser *parser, guac_socket *socket, int usec_timeout)
Reads a single instruction from the given guac_socket connection.
int guac_parser_append(guac_parser *parser, void *buffer, int length)
Appends data from the given buffer to the given parser.
int guac_parser_expect(guac_parser *parser, guac_socket *socket, int usec_timeout, const char *opcode)
Reads a single instruction from the given guac_socket.
void guac_parser_free(guac_parser *parser)
Frees all memory allocated to the given parser.
Type definitions related to the guac_socket object.
A Guacamole protocol parser, which reads individual instructions, filling its own internal structure ...
Definition parser.h:33
guac_parse_state state
The parse state of the instruction.
Definition parser.h:53
int argc
The number of arguments passed to this instruction.
Definition parser.h:43
char * opcode
The opcode of the instruction.
Definition parser.h:38
char ** argv
Array of all arguments passed to this instruction.
Definition parser.h:48
The core I/O object of Guacamole.
Definition socket.h:39