Commit 8c62b070 authored by Marco De Marco's avatar Marco De Marco
Browse files

Protocol Buffer classes added

parent 685191f9
Loading
Loading
Loading
Loading
+35 −8
Original line number Diff line number Diff line
#================================================================================
EXEC_NAME=metadataExporter-srv
INST_NAME=test
DEBUG_LEV=-v1
DEBUG_LEV=-v3
INSTALL_DIR=/usr/local/bin
#================================================================================
INC_DIR=/usr/local/omniORB-4.1.7/include \
@@ -10,11 +10,13 @@ INC_DIR=/usr/local/omniORB-4.1.7/include \
	   /usr/local/soci-3.2.1/include \
	   /usr/local/soci-3.2.1/include/soci \
	   /usr/include/mysql \
	   /usr/local/protobuf-2.5.0/include \
	   ./src
LIB_DIR=/usr/local/omniORB-4.1.7/lib \
	   /usr/local/zeromq-3.2.3/lib \
	   /usr/local/tango-8.1.2/lib \
	   /usr/local/soci-3.2.1/lib64
	   /usr/local/soci-3.2.1/lib64 \
	   /usr/local/protobuf-2.5.0/lib
#================================================================================
CC=g++
CXX_DEBUG_FLAGS=-g -DVERBOSE_DEBUG
@@ -22,17 +24,25 @@ CXX_RELEASE_FLAGS=-O3
CXX_DEFAULT_FLAGS=-c -Wall -Wextra -std=c++11 -std=gnu++11
LDFLAGS=-Wall -lomniORB4 -lomniDynamic4 -lCOS4 -lomnithread -ltango -llog4tango \
	-lsoci_core -lsoci_mysql -lboost_system -lboost_thread -lboost_filesystem \
	-lssl
	-lprotobuf -lssl
INC_PARM=$(foreach d, $(INC_DIR), -I$d)
LIB_PARM=$(foreach d, $(LIB_DIR), -L$d)
PROTOC :=/usr/local/protobuf-2.5.0/bin/protoc
#================================================================================
SRC_DIR=./src
OBJ_DIR=./obj
BIN_DIR=./bin
PROTO_DIR=./proto
#================================================================================
EXECUTABLE=$(BIN_DIR)/$(EXEC_NAME)
CPP_FILES=$(wildcard $(SRC_DIR)/*.cpp)
OBJ_FILES=$(addprefix $(OBJ_DIR)/,$(notdir $(CPP_FILES:.cpp=.o)))
EXECUTABLE := $(BIN_DIR)/$(EXEC_NAME)
CPP_FILES := $(wildcard $(SRC_DIR)/*.cpp)
OBJ_FILES := $(addprefix $(OBJ_DIR)/,$(notdir $(CPP_FILES:.cpp=.o)))
#================================================================================
PROTO_FILES := $(wildcard $(PROTO_DIR)/*.proto)
PROTO_HEADERS := $(addprefix $(SRC_DIR)/,$(notdir $(PROTO_FILES:.proto=.pb.h)))
PROTO_CLASSES := $(addprefix $(SRC_DIR)/,$(notdir $(PROTO_FILES:.proto=.pb.cc)))
CPP_FILES += $(PROTO_CLASSES)
OBJ_FILES += $(addprefix $(OBJ_DIR)/,$(notdir $(PROTO_CLASSES:.pb.cc=.pb.o)))
#================================================================================

.PHONY: all
@@ -56,6 +66,13 @@ $(EXECUTABLE): makedir $(OBJ_FILES)
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp
	$(CC) $(CXXFLAGS) $(INC_PARM) -o $@ $<

$(OBJ_DIR)/%.pb.o: $(SRC_DIR)/%.pb.cc
	$(CC) $(CXXFLAGS) $(INC_PARM) -o $@ $<

.PHONY: protoc
protoc:
	$(PROTOC) --proto_path=$(PROTO_DIR) --cpp_out=$(SRC_DIR) $(PROTO_FILES)

.PHONY: makedir
makedir:
	-mkdir -p $(OBJ_DIR) $(BIN_DIR)
@@ -64,6 +81,10 @@ makedir:
clean:
	-rm -rf $(OBJ_DIR) $(BIN_DIR)

.PHONY: deepclean
deepclean:
	-rm -rf $(OBJ_DIR) $(BIN_DIR) $(PROTO_HEADERS) $(PROTO_CLASSES)

.PHONY: install
install:
	-cp $(EXECUTABLE) $(INSTALL_DIR)
@@ -80,4 +101,10 @@ echo:
	@echo $(INC_PARM)
	@echo LIB_PARM
	@echo $(LIB_PARM)
	@echo PROTO_FILES
	@echo $(PROTO_FILES)
	@echo PROTO_CLASSES
	@echo $(PROTO_CLASSES)
	@echo PROTO_HEADERS
	@echo $(PROTO_HEADERS)
+36 −0
Original line number Diff line number Diff line
package MetadataMessage;
package MetadataExporter_ns;

message Request
{
	//Request type descriptor

	enum Type
	{
		AUTHORIZATION = 0;
@@ -10,6 +12,8 @@ message Request

	required Type type = 1;

	//Authorization request

	message Authorization
	{
		required string username = 1;
@@ -18,57 +22,13 @@ message Request

	optional Authorization authorization = 2;

	message Metadata
	{
		required string host = 1;
		required uint32 port = 2;
		required string schema = 3;
		required string table = 4;
	}

	optional Metadata metadata = 5;
}

message Response
{
	enum Type
	{
		AUTHORIZATION = 0;
		METADATA = 1;
	}

	required Type type = 1;

	message Authorization
	{
		enum State
		{
			ACCEPTED = 0;
			REJECTED = 1;
		}
	}

	optional Authorization authorization = 2;
	//Metadata update request

	message Metadata
	{
		message Parameter
		{
			required string key = 4;

			enum Type
			{
				VARCHAR = 0;
				INTEGER = 1;
				DOUBLE = 2;
			}

		required Type type = 5;

			required string value = 6;
		}

		repeated Parameter parameters = 7;
		required string schema = 1;
		required string table = 2;
		required sfixed64 timestamp = 3;
	}

	optional Metadata metadata = 5;

proto/Response.proto

0 → 100644
+95 −0
Original line number Diff line number Diff line
package MetadataExporter_ns;

message Response
{
	//Response type descriptor

	enum Type
	{
		AUTHORIZATION = 0;
		METADATA = 1;
	}

	required Type type = 1;

	//Authorization response

	message Authorization
	{
		enum Status
		{
			ACCEPTED = 0;
			REJECTED = 1;
		}

		required Status status = 1;
	}

	optional Authorization authorization = 2;

	//Metadata tuple container

	message Metadata
	{
		//Metadata response status

		enum Status
		{
			ACCEPTED = 0;
			REJECTED = 1;
		}

		required Status status = 1;

		//Mysql: FLOAT, DOUBLE, DECIMAL
		//SOCI:  dt_double
		//C++:   double

		message DtDouble
		{
			required string key = 1;
			required double value = 2;
		}

		repeated DtDouble double_list = 2;

		//Mysql: TINYINT, SMALLINT, INT, BIGINT
		//SOCI:  dt_integer 
		//C++:   int 

		message DtInteger 
		{
			required string key = 1;
			required int64 value = 2;
		}

		repeated DtInteger integer_list = 3;

		//Mysql: STRING/BINARY, VARCHAR/VARBINARY
		//SOCI:  dt_string
		//C++:   string 

		message DtString
		{
			required string key = 1;
			required string value = 2;
		}

		repeated DtString strings_list = 4;

		//Mysql: TIMESTAMP DATE, TIME, DATETIME
		//SOCI:  dt_date 
		//C++:   tm 

		message DtDate
		{
			required string key = 1;
			required sfixed64 value = 2;
		}

		repeated DtDate date_list = 5;
	}

	optional Metadata metadata = 3;
}

src/Message.pb.cc

0 → 100644
+2341 −0

File added.

Preview size limit exceeded, changes collapsed.

src/Message.pb.h

0 → 100644
+1758 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading