1
0
mirror of https://github.com/haiwen/libsearpc.git synced 2025-09-17 07:18:19 +00:00

1. Rearraged the source tree

2. modified the autotools scripts, "make distcheck" is ok now
This commit is contained in:
lins05
2011-04-15 14:33:25 +08:00
parent fecbee71a1
commit 02eb0744fc
25 changed files with 100 additions and 949 deletions

View File

@@ -1,28 +1,27 @@
EXTRA_DIST = pysearpc-demo-client.py
genrpc_files = pysearpc-gen-dfun-macro.py rpc_table.py
AM_CFLAGS = -DPKGDATADIR=\"$(pkgdatadir)\" \
-DPACKAGE_DATA_DIR=\""$(pkgdatadir)"\" \
-I$(top_srcdir) \
-I$(top_srcdir)/include \
@GLIB2_CFLAGS@ \
@PYGOBJECT_CFLAGS@ \
-I/usr/include/python$(PYTHON_VERSION)
@GLIB2_CFLAGS@ @PYGOBJECT_CFLAGS@ \
-I/usr/include/python$(PYTHON_VERSION) \
-I${top_builddir}/lib -I${top_srcdir}/lib
if COMPILE_PYTHON
pkgpyexec_PYTHON = __init__.py client.py gen-dfun-macro.py
pkgpyexec_PYTHON = __init__.py client.py pysearpc-gen-dfun-macro.py
# generating the fcallfret module
pkgpyexec_LTLIBRARIES = fcallfret.la
fcallfret_la_LDFLAGS = -module -avoid-version -export-symbols-regex initfcallfret
fcallfret_la_SOURCES = fcallfret.c fcallfret.h
fcallfret_la_LIBADD = @GLIB2_LIBS@ @GOBJECT_LIBS@ $(top_builddir)/libsearpc.la
fcallfret_la_LIBADD = @GLIB2_LIBS@ @GOBJECT_LIBS@ $(top_builddir)/lib/libsearpc.la
EXTRA_fcallfret_la_SOURCES = ${genrpc_files}
CLEANFILES = fcallfret.h
fcallfret.c: gen-dfun-macro.py
fcallfret.c: ${genrpc_files}
python $< gen-searpcclient > fcallfret.h
.PHONY: fcallfret.c
endif
.PHONY: fcallfret.c

View File

@@ -24,7 +24,7 @@
#include <glib-object.h>
#include <pygobject.h>
#include <../searpc-client.h>
#include <../lib/searpc-client.h>
#include <structmember.h>
static PyObject *SearpcError;

View File

@@ -1,37 +0,0 @@
import os
import sys
sys.path += ['', '.libs']
RPC_PROC_ID = 1003
SC_CLIENT_CALL = "301"
SS_CLIENT_CALL = "CLIENT CALL"
SC_SERVER_RET = "311"
SS_SERVER_RET = "SERVER RET"
def searpc_transport_send(fcall, priv):
if priv.peerid is None:
proc_name = "%s-rpcserver" % (priv.service)
else:
proc_name = "remote %s %s-rpcserver" % (priv.peerid, priv.service)
priv.session.send_request(RPC_PROC_ID, proc_name)
if priv.session.read_response() < 0:
return None
rsp = priv.session.response
if rsp[0] != "200":
print "[Sea RPC] failed to start rpc server.\n"
return None
priv.session.send_update(RPC_PROC_ID, "301", "CLIENT CALL",
fcall, len(fcall))
if priv.session.read_response() < 0:
return None
rsp = priv.session.response
if rsp[0] == SC_SERVER_RET:
return rsp[2]
else:
print "[Sea RPC] Bad response: %s %s.\n" % (rsp[0], rsp[1])
return None

20
pysearpc/rpc_table.py Normal file
View File

@@ -0,0 +1,20 @@
"""
Define RPC functions needed to generate
"""
# [ <ret-type>, [<arg_types>] ]
func_table = [
[ "int", ["string"] ],
[ "int", ["string", "string"] ],
[ "string", [] ],
[ "string", ["string"] ],
[ "string", ["string", "int"] ],
[ "objlist", [] ],
[ "objlist", ["string"] ],
[ "objlist", ["int", "int"] ],
[ "objlist", ["string", "int"] ],
[ "objlist", ["string", "int", "int"] ],
[ "objlist", ["string", "string", "int"] ],
[ "object", [] ],
[ "object", ["string"] ],
]