Commit 551cfb46 authored by Elemer Lelik's avatar Elemer Lelik
Browse files

First code commit

parent 3fcc28c4
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2000-2018 Ericsson Telecom AB
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v2.0
// which accompanies this distribution, and is available at
// https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
///////////////////////////////////////////////////////////////////////////////
module Thrift_Common{
type boolean bool
type integer byte
type integer i16
type integer i32
type integer i64
type charstring string
type octetstring binary
type enumerated Thrift_port_operation { OP_OPEN(0),OP_CLOSE(1) }
type enumerated Thrift_port_mode { MODE_CLIENT(0),MODE_SERVER(1) }
type record Thrift_conn_data {
Thrift_transport_data transport optional,
Thrift_protocol_data protocol optional
}
type union Thrift_transport_data{
Thrift_socket_transport socket,
Thrift_socket_transport framed
}
type union Thrift_protocol_data{
Thrift_binary_protocol binary
}
type record Thrift_socket_transport {
charstring host_name optional,
integer port_num
}
type record Thrift_binary_protocol {
}
type enumerated Thrift_control_code{ CRTL_RES_OK(0), CTRL_RES_FAIL(1), CTRL_RES_ERR(2)}
type record Thrift_control_result {
Thrift_control_code result_code,
Thrift_port_error result_desc optional
}
signature Thrift_control(in Thrift_port_operation operation,
in Thrift_port_mode port_mode,
in Thrift_conn_data conn_data) return Thrift_control_result
type record Thrift_port_error{
integer error_code,
charstring error_text
}
}
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2000-2018 Ericsson Telecom AB
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v2.0
// which accompanies this distribution, and is available at
// https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
//////////////////////////////////////////////////////////////////////////////
#include "Thrift_Common.hh"
#include "Thrift_Common_Converter.hh"
void conv_ttcn_thrift(const Thrift__Common::bool_& in,bool& out){
out=in;
}
void conv_ttcn_thrift(const Thrift__Common::byte& in,int8_t& out){
out=(int)in;
}
void conv_ttcn_thrift(const Thrift__Common::i16& in,int16_t& out){
out=(int)in;
}
void conv_ttcn_thrift(const Thrift__Common::i32& in,int32_t& out){
out=(int)in;
}
void conv_ttcn_thrift(const Thrift__Common::i64& in,int64_t& out){
out=in.get_long_long_val();
}
void conv_ttcn_thrift(const Thrift__Common::string& in,std::string& out){
out=std::string((const char*)in,in.lengthof());
}
void conv_ttcn_thrift(const Thrift__Common::binary& in,std::string& out){
out=std::string((const char*)(const unsigned char*)in,in.lengthof());
}
void conv_thrift_ttcn(const bool& in,Thrift__Common::bool_& out){
out=in;
}
void conv_thrift_ttcn(const int8_t& in,Thrift__Common::byte& out){
out=in;
}
void conv_thrift_ttcn(const int16_t& in,Thrift__Common::i16& out){
out=in;
}
void conv_thrift_ttcn(const int32_t& in,Thrift__Common::i32& out){
out=in;
}
void conv_thrift_ttcn(const int64_t& in,Thrift__Common::i64& out){
out.set_long_long_val(in);
}
void conv_thrift_ttcn(const std::string& in,Thrift__Common::string& out){
out=Thrift__Common::string(in.size(),in.data());
}
void conv_thrift_ttcn(const std::string& in,Thrift__Common::binary& out){
out=Thrift__Common::binary(in.size(),(const unsigned char*)in.data());
}
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2000-2018 Ericsson Telecom AB
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v2.0
// which accompanies this distribution, and is available at
// https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
//////////////////////////////////////////////////////////////////////////////
#ifndef Thrift_Common_Converter_H
#define Thrift_Common_Converter_H
#include <thrift/Thrift.h>
#include "Thrift_Common.hh"
struct internal_comm_struct{
int code;
void** data;
};
void conv_ttcn_thrift(const Thrift__Common::bool_& in,bool& out);
void conv_ttcn_thrift(const Thrift__Common::byte& in,int8_t& out);
void conv_ttcn_thrift(const Thrift__Common::i16& in,int16_t& out);
void conv_ttcn_thrift(const Thrift__Common::i32& in,int32_t& out);
void conv_ttcn_thrift(const Thrift__Common::i64& in,int64_t& out);
void conv_ttcn_thrift(const Thrift__Common::string& in,std::string& out);
void conv_ttcn_thrift(const Thrift__Common::binary& in,std::string& out);
void conv_thrift_ttcn(const bool& in,Thrift__Common::bool_& out);
void conv_thrift_ttcn(const int8_t& in,Thrift__Common::byte& out);
void conv_thrift_ttcn(const int16_t& in,Thrift__Common::i16& out);
void conv_thrift_ttcn(const int32_t& in,Thrift__Common::i32& out);
void conv_thrift_ttcn(const int64_t& in,Thrift__Common::i64& out);
void conv_thrift_ttcn(const std::string& in,Thrift__Common::string& out);
void conv_thrift_ttcn(const std::string& in,Thrift__Common::binary& out);
#endif
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment