00001 /* 00002 * Licensed to the Apache Software Foundation (ASF) under one 00003 * or more contributor license agreements. See the NOTICE file 00004 * distributed with this work for additional information 00005 * regarding copyright ownership. The ASF licenses this file 00006 * to you under the Apache License, Version 2.0 (the 00007 * "License"); you may not use this file except in compliance 00008 * with the License. You may obtain a copy of the License at 00009 * 00010 * http://www.apache.org/licenses/LICENSE-2.0 00011 * 00012 * Unless required by applicable law or agreed to in writing, 00013 * software distributed under the License is distributed on an 00014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 00015 * KIND, either express or implied. See the License for the 00016 * specific language governing permissions and limitations 00017 * under the License. 00018 */ 00019 00020 00021 #ifndef _GUAC_PARSER_H 00022 #define _GUAC_PARSER_H 00023 00030 #include "parser-types.h" 00031 #include "parser-constants.h" 00032 #include "socket-types.h" 00033 00034 struct guac_parser { 00035 00039 char* opcode; 00040 00044 int argc; 00045 00049 char** argv; 00050 00054 guac_parse_state state; 00055 00059 int __element_length; 00060 00064 int __elementc; 00065 00069 char* __elementv[GUAC_INSTRUCTION_MAX_ELEMENTS]; 00070 00075 char* __instructionbuf_unparsed_start; 00076 00080 char* __instructionbuf_unparsed_end; 00081 00087 char __instructionbuf[32768]; 00088 00089 }; 00090 00097 guac_parser* guac_parser_alloc(); 00098 00113 int guac_parser_append(guac_parser* parser, void* buffer, int length); 00114 00122 int guac_parser_length(guac_parser* parser); 00123 00133 int guac_parser_shift(guac_parser* parser, void* buffer, int length); 00134 00140 void guac_parser_free(guac_parser* parser); 00141 00163 int guac_parser_read(guac_parser* parser, guac_socket* socket, int usec_timeout); 00164 00186 int guac_parser_expect(guac_parser* parser, guac_socket* socket, int usec_timeout, const char* opcode); 00187 00188 #endif 00189