![]() |
|
|||
0001 /** 0002 * 0003 * @file atmisv.c 0004 */ 0005 /* ----------------------------------------------------------------------------- 0006 * Enduro/X Middleware Platform for Distributed Transaction Processing 0007 * Copyright (C) 2009-2016, ATR Baltic, Ltd. All Rights Reserved. 0008 * Copyright (C) 2017-2023, Mavimax, Ltd. All Rights Reserved. 0009 * This software is released under one of the following licenses: 0010 * AGPL (with Java and Go exceptions) or Mavimax's license for commercial use. 0011 * See LICENSE file for full text. 0012 * ----------------------------------------------------------------------------- 0013 * AGPL license: 0014 * 0015 * This program is free software; you can redistribute it and/or modify it under 0016 * the terms of the GNU Affero General Public License, version 3 as published 0017 * by the Free Software Foundation; 0018 * 0019 * This program is distributed in the hope that it will be useful, but WITHOUT ANY 0020 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 0021 * PARTICULAR PURPOSE. See the GNU Affero General Public License, version 3 0022 * for more details. 0023 * 0024 * You should have received a copy of the GNU Affero General Public License along 0025 * with this program; if not, write to the Free Software Foundation, Inc., 0026 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 0027 * 0028 * ----------------------------------------------------------------------------- 0029 * A commercial use license is available from Mavimax, Ltd 0030 * contact@mavimax.com 0031 * ----------------------------------------------------------------------------- 0032 */ 0033 0034 /* Stuff for sockets testing: */ 0035 #include <sys/socket.h> 0036 #include <sys/time.h> 0037 #include <sys/types.h> 0038 #include <arpa/inet.h> 0039 #include <netinet/in.h> 0040 #include <errno.h> 0041 #include <fcntl.h> 0042 #include <netdb.h> 0043 #include <string.h> 0044 #include <unistd.h> 0045 0046 #include <stdio.h> 0047 #include <stdlib.h> 0048 #include <ndebug.h> 0049 #include <atmi.h> 0050 #include <ndrstandard.h> 0051 #include <ubf.h> 0052 #include <test.fd.h> 0053 0054 /* 0055 * This is test service! 0056 */ 0057 void TESTSVFN (TPSVCINFO *p_svc) 0058 { 0059 int ret=EXSUCCEED; 0060 0061 char *str = "THIS IS TEST - OK!"; 0062 0063 UBFH *p_ub = (UBFH *)p_svc->data; 0064 0065 NDRX_LOG(log_debug, "TESTSVFN got call"); 0066 0067 sleep(2); /* <<< So that clients enqueue theyr calls! */ 0068 exit (1); /* We have crashed! */ 0069 0070 out: 0071 tpreturn( ret==EXSUCCEED?TPSUCCESS:TPFAIL, 0072 0L, 0073 (char *)p_ub, 0074 0L, 0075 0L); 0076 } 0077 0078 /** 0079 * Perform exit of server after few seconds.. 0080 * @param p_svc 0081 */ 0082 void EXITSVC(TPSVCINFO *p_svc) 0083 { 0084 0085 sleep(4); 0086 0087 /* lets die */ 0088 exit(1); 0089 } 0090 0091 /* 0092 * Do initialization 0093 */ 0094 int NDRX_INTEGRA(tpsvrinit)(int argc, char **argv) 0095 { 0096 int ret = EXSUCCEED; 0097 NDRX_LOG(log_debug, "tpsvrinit called"); 0098 0099 if (EXSUCCEED!=tpadvertise("TESTSVFN", TESTSVFN)) 0100 { 0101 NDRX_LOG(log_error, "TESTERROR: Failed to initialize TESTSV (first)!"); 0102 EXFAIL_OUT(ret); 0103 } 0104 else if (EXSUCCEED!=tpadvertise("EXITSVC", EXITSVC)) 0105 { 0106 NDRX_LOG(log_error, "Failed to initialize EXITSVC!"); 0107 EXFAIL_OUT(ret); 0108 } 0109 0110 out: 0111 return ret; 0112 } 0113 0114 /** 0115 * Do de-initialization 0116 */ 0117 void NDRX_INTEGRA(tpsvrdone)(void) 0118 { 0119 NDRX_LOG(log_debug, "tpsvrdone called"); 0120 } 0121 /* vim: set ts=4 sw=4 et smartindent: */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |