Feature #218

buildserver support for automatic server advertise

Added by Madars over 6 years ago. Updated over 3 years ago.

Status:ClosedStart date:09/20/2017
Priority:Normal (Code 4)Due date:
Assignee:-% Done:

100%

Category:-
Target version:-

Description

buildserver support for automatic server advertise

also we need to include support for repeated command line arguments. Like multiple -s -f -l. We need to write own "getopts" version to parse the arguments like the C do.

History

#1 Updated by Madars over 6 years ago

  • Description updated (diff)

#2 Updated by Madars almost 6 years ago

Thus buildserver and buildclient shall be re-written in C, with support for automatic advertise. In this case if using auto advertise, we shall link against "libatmisrvnomain" and register some globals for generated service advertise.

#3 Updated by Madars about 5 years ago

we shall support -r flag for buildserver, buildclient and buildtms.

The -r flag is "resource name" that should be looked up in:

$NDRX_HOME/udataobj/RM

or if this file does not exists then lookup shall be made to: $NDRX_RMFILE

if files does not exists, then build shall fail, with correspoding message to stderr.

if we got the file, then we shall search the line which starts with

<rm_name>:<xa_switch_name>:<lastfile>

We the rm_name is not found, the build shall terminate with error to stderr.

if line is found, then for build server tmsvrargs_t which is used for _tmstartserver we shall set xa_switch (first argument) to <xa_switch_name>.

The <lastfile> shall be used after the lastfiles in CC command, just copy the contents to compiler.

======================================================================

To support statically linked RM for client processes, the buildclient shall generate source code file which will contain:
global variable:

#include <atmi.h>
#include <xa.h>

extern struct xa_switch_t *<xa_switch_name>;
expublic struct tmsvrargs_t ndrx_G_tmsvrargs_stat = {<xa_switch_name>, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
expublic struct tmsvrargs_t *ndrx_G_tmsvrargs = &ndrx_G_tmsvrargs_stat;

and this shall be built together with client process.

#4 Updated by Madars about 5 years ago

for builttms, the libndrxtms.so will be provided to which we can provide the xa switch, and standard _tmstartserver() with no any special advertises.

#5 Updated by Madars about 4 years ago

tpsrvinit, tpsvrdone ensure that we can build binary with out these...

#6 Updated by Madars about 4 years ago

tmrunserver struct: https://wedelphi.com/t/262261/

May 20, 2004
#1
下面这段代码是用C++写的tuxedo服务的一部分
我想尝试下用delphi来编写tuxedo服务,但这个c++的结构比较复杂
恳请高人帮忙,谢谢

#include <stdio.h>
#include <xa.h>
#include "c_demo.h" 
#include <atmi.h>
#include <userlog.h> /*TUXEDO H*/

//服务端初始化服务
#if defined(__STDC__) || defined(__cplusplus)
tpsvrinit(int argc, char *argv[])
#else
tpsvrinit(argc, argv)
int argc;
char **argv;
#endif
{
argc = argc;
argv = argv;
tpopen();
return 0;
}

//服务端结束服务
void tpsvrdone()
{
tpclose();
}

#if defined(__cplusplus)
extern "C" {
#endif
extern int _tmrunserver _((int));
extern void TUDEMO _((TPSVCINFO *));
#if defined(__cplusplus)
}
#endif

static struct tmdsptchtbl_t _tmdsptchtbl[] = {
{ (char*)"TUDEMO", (char*)"TUDEMO", (void (*) _((TPSVCINFO *))) TUDEMO, 0, 0 },
{ NULL, NULL, NULL, 0, 0 }
};

#ifndef _TMDLLIMPORT
#define _TMDLLIMPORT
#endif

#if defined(__cplusplus)
extern "C" {
#endif
_TMDLLIMPORT extern struct xa_switch_t xaosw;
#if defined(__cplusplus)
}
#endif

typedef void (*tmp_void_cast)();
typedef void (*tmp_voidvoid_cast)(void);
typedef int (*tmp_intchar_cast)(int, char **);
typedef int (*tmp_int_cast)(int);
struct tmsvrargs_t tmsvrargs = {
NULL,
&amp;_tmdsptchtbl[0],
0,
(tmp_intchar_cast)tpsvrinit,
(tmp_voidvoid_cast)tpsvrdone,
(tmp_int_cast)_tmrunserver, /* PRIVATE */
NULL, /* RESERVED */
NULL, /* RESERVED */
NULL, /* RESERVED */
NULL, /* RESERVED */
(tmp_intchar_cast)tpsvrthrinit,
(tmp_voidvoid_cast)tpsvrthrdone
};

struct tmsvrargs_t *
#ifdef _TMPROTOTYPES
_tmgetsvrargs(void)
#else
_tmgetsvrargs()
#endif
{
tmsvrargs.reserved1 = NULL;
tmsvrargs.reserved2 = NULL;
tmsvrargs.xa_switch = &amp;xaosw;
return(&amp;tmsvrargs);
}

int
#ifdef _TMPROTOTYPES
main(int argc, char **argv)
#else
main(argc,argv)
int argc;
char **argv;
#endif
{
#ifdef TMMAINEXIT
#include "mainexit.h" 
#endif
return( _tmstartserver( argc, argv, _tmgetsvrargs()));
}

#ifdef __cplusplus
extern "C" 
#endif
void TUDEMO(TPSVCINFO *rqst)
{
long nRet;
{
TCDemo Demo;
Demo.Do(rqst);
nRet = Demo.GetRetCode();
}
tpreturn(TPSUCCESS, nRet, NULL, 0, 0);
}

#7 Updated by Madars about 4 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

#8 Updated by Madars over 3 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF