Back to home page

Enduro/X

 
 

    


0001 /**
0002  * @brief NDRXD Bridge internal structures.
0003  *
0004  * @file bridge_int.h
0005  */
0006 /* -----------------------------------------------------------------------------
0007  * Enduro/X Middleware Platform for Distributed Transaction Processing
0008  * Copyright (C) 2009-2016, ATR Baltic, Ltd. All Rights Reserved.
0009  * Copyright (C) 2017-2023, Mavimax, Ltd. All Rights Reserved.
0010  * This software is released under one of the following licenses:
0011  * AGPL (with Java and Go exceptions) or Mavimax's license for commercial use.
0012  * See LICENSE file for full text.
0013  * -----------------------------------------------------------------------------
0014  * AGPL license:
0015  *
0016  * This program is free software; you can redistribute it and/or modify it under
0017  * the terms of the GNU Affero General Public License, version 3 as published
0018  * by the Free Software Foundation;
0019  *
0020  * This program is distributed in the hope that it will be useful, but WITHOUT ANY
0021  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
0022  * PARTICULAR PURPOSE. See the GNU Affero General Public License, version 3
0023  * for more details.
0024  *
0025  * You should have received a copy of the GNU Affero General Public License along 
0026  * with this program; if not, write to the Free Software Foundation, Inc.,
0027  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0028  *
0029  * -----------------------------------------------------------------------------
0030  * A commercial use license is available from Mavimax, Ltd
0031  * contact@mavimax.com
0032  * -----------------------------------------------------------------------------
0033  */
0034 
0035 #ifndef BRIDGE_INT_H
0036 #define BRIDGE_INT_H
0037 
0038 #ifdef  __cplusplus
0039 extern "C" {
0040 #endif
0041 
0042 /*---------------------------Includes-----------------------------------*/
0043 #include <exhash.h>
0044 #include <atmi_int.h>
0045 /*---------------------------Externs------------------------------------*/
0046 /*---------------------------Macros-------------------------------------*/
0047 /*---------------------------Enums--------------------------------------*/
0048 /*---------------------------Typedefs-----------------------------------*/
0049 
0050 /*
0051  * Hash list for services advertised by other node
0052  */
0053 struct bridgedef_svcs
0054 {
0055     /* Service name */
0056     char svc_nm[MAXTIDENT+1];
0057     /* Number of copies */
0058     int count;
0059     int pq_info[PQ_LEN];                  /* Print queues,  statistics */
0060     /* makes this structure hashable */
0061     EX_hash_handle hh;
0062 };
0063 typedef struct bridgedef_svcs bridgedef_svcs_t;
0064 
0065 /*
0066  * hash handler for bridges
0067  */
0068 struct bridgedef 
0069 {
0070     /* ID of the other node */
0071     int nodeid;
0072     /* Have a bridge data... */
0073     int srvid;
0074     /* Are we connected? */
0075     int connected;
0076     /* Flags configured for bridge */
0077     int flags;
0078     /* If above enabled, then when was last time we sent refersh? */
0079     long lastrefresh_sent;
0080     
0081     /* List of other nodes (nodeid) services */
0082     bridgedef_svcs_t * theyr_services;
0083     
0084     /* makes this structure hashable */
0085     EX_hash_handle hh;
0086 };
0087 typedef struct bridgedef bridgedef_t;
0088 /*---------------------------Globals------------------------------------*/
0089 /* Bridge related stuff from bridge.c */
0090 extern bridgedef_t *G_bridge_hash; /* Hash table of bridges */
0091 extern bridgedef_svcs_t *G_bridge_svc_hash; /* Our full list of local services! */
0092 extern bridgedef_svcs_t *G_bridge_svc_diff; /* Service diff to be sent to nodes */
0093 /*---------------------------Statics------------------------------------*/
0094 /*---------------------------Prototypes---------------------------------*/
0095 extern bridgedef_t* brd_get_bridge(int nodeid);
0096 extern int brd_addupd_bridge(srv_status_t * srvinfo);
0097 
0098 /* Our list of local services */
0099 extern void brd_del_svc_from_hash(char *svc);
0100 extern int brd_add_svc_to_hash(char *svc);
0101 
0102 
0103 extern int brd_connected(int nodeid);
0104 extern int brd_discconnected(int nodeid);
0105 
0106 extern int brd_add_svc_brhash(bridgedef_t *cur, char *svc, int count);
0107 extern void brd_del_svc_brhash(bridgedef_t *cur, bridgedef_svcs_t *s, char *svc);
0108 extern bridgedef_svcs_t * brd_get_svc_brhash(bridgedef_t *cur, char *svc);
0109 extern bridgedef_svcs_t * brd_get_svc(bridgedef_svcs_t * svcs, char *svc);
0110 extern void brd_erase_svc_hash_g(bridgedef_svcs_t *svcs);
0111 
0112 extern void brd_end_diff(void);
0113 extern void brd_begin_diff(void);
0114 extern void brd_send_periodrefresh(void);
0115 extern int brd_lock_and_update_shm(int nodeid, char *svc_nm, int count, char mode);
0116 extern int brd_add_svc_to_hash_g(bridgedef_svcs_t ** svcs, char *svc);
0117 extern int brd_del_bridge(int nodeid);
0118 
0119 #ifdef  __cplusplus
0120 }
0121 #endif
0122 
0123 #endif  /* BRIDGE_INT_H */
0124 
0125 /* vim: set ts=4 sw=4 et smartindent: */