1 /*
2  * The Spread Toolkit.
3  *
4  * The contents of this file are subject to the Spread Open-Source
5  * License, Version 1.0 (the ``License''); you may not use
6  * this file except in compliance with the License.  You may obtain a
7  * copy of the License at:
8  *
9  * http://www.spread.org/license/
10  *
11  * or in the file ``license.txt'' found in this distribution.
12  *
13  * Software distributed under the License is distributed on an AS IS basis,
14  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
15  * for the specific language governing rights and limitations under the
16  * License.
17  *
18  * The Creators of Spread are:
19  *  Yair Amir, Michal Miskin-Amir, Jonathan Stanton, John Schultz.
20  *
21  *  Copyright (C) 1993-2012 Spread Concepts LLC <info@spreadconcepts.com>
22  *
23  *  All Rights Reserved.
24  *
25  * Major Contributor(s):
26  * ---------------
27  *    Ryan Caudy           rcaudy@gmail.com - contributions to process groups.
28  *    Claudiu Danilov      claudiu@acm.org - scalable wide area support.
29  *    Cristina Nita-Rotaru crisn@cs.purdue.edu - group communication security.
30  *    Theo Schlossnagle    jesus@omniti.com - Perl, autoconf, old skiplist.
31  *    Dan Schoenblum       dansch@cnds.jhu.edu - Java interface.
32  *
33  */
34 
35 
36 
37 #ifndef fl_h_2000_03_20_14_36_26_jschultz_at_cnds_jhu_edu
38 #define fl_h_2000_03_20_14_36_26_jschultz_at_cnds_jhu_edu
39 
40 #include <sp.h>
41 
42 /* FL service types */
43 #define DONT_BLOCK     0x10000000
44 #define FLUSH_REQ_MESS 0x20000000
45 #define SUBGROUP_CAST  0x40000000
46 
47 /* FL service query macros */
48 #define Is_flush_req_mess(serv) (((serv) & FLUSH_REQ_MESS) != 0)
49 #define Is_subgroup_mess(serv)  (((serv) & SUBGROUP_CAST) != 0)
50 
51 /* FL error codes */
52 #define ILLEGAL_PARAM        -24
53 #define WOULD_BLOCK          -25
54 #define ILLEGAL_MESSAGE_TYPE -26
55 #define ILLEGAL_STATE        -27
56 #define ILLEGAL_RECEIVERS    -28
57 
58 /* maximum # of usable scatter elements for FL msgs */
59 #define FL_MAX_SCATTER_ELEMENTS (MAX_CLIENT_SCATTER_ELEMENTS - 1)
60 
61 /* minimum message type a user is allowed to use - less than this is illegal */
62 #define FL_MIN_LEGAL_MESS_TYPE ((int16) -32765)
63 
64 #ifdef __cplusplus
65 extern "C" {
66 #endif
67 
68 int   FL_lib_init(void);
69 
70 void  FL_version(int *major_ver, int *minor_ver, int *patch_ver);
71 
72 int   FL_connect(const char *daemon_name, const char *user_name, int priority,
73 		 mailbox *mbox, char *private_name);
74 
75 int   FL_disconnect(mailbox mbox);
76 
77 int   FL_join(mailbox mbox, const char *group_name);
78 
79 int   FL_leave(mailbox mbox, const char *group_name);
80 
81 int   FL_flush(mailbox mbox, const char *group_name);
82 
83 int   FL_unicast(mailbox mbox, service serv_type, const char *group_name,
84 		 const char *recvr_name, int16 mess_type, int mess_len, const char *mess);
85 
86 int   FL_scat_unicast(mailbox mbox, service serv_type, const char *group_name,
87 		      const char *recvr_name, int16 mess_type, const scatter *scat);
88 
89 int   FL_subgroupcast(mailbox mbox, service serv_type, const char *group_name,
90 		      int num_recvrs, char recvr_names[][MAX_GROUP_NAME],
91 		      int16 mess_type, int mess_len, const char *mess);
92 
93 int   FL_scat_subgroupcast(mailbox mbox, service serv_type, const char *group_name,
94 			   int num_recvrs, char recvr_names[][MAX_GROUP_NAME],
95 			   int16 mess_type, const scatter *scat);
96 
97 int   FL_multicast(mailbox mbox, service serv_type, const char *group_name,
98 		   int16 mess_type, int mess_len, const char *mess);
99 
100 int   FL_scat_multicast(mailbox mbox, service serv_type, const char *group_name,
101 			int16 mess_type, const scatter *scat_mess);
102 
103 int   FL_receive(mailbox mbox, service *serv_type, char *sender_name,
104 		 int max_groups, int *num_groups, char group_names[][MAX_GROUP_NAME],
105 		 int16 *mess_type, int *endian_mismatch, int max_mess_len,
106 		 char *mess, int *more_msgs);
107 
108 int   FL_scat_receive(mailbox mbox, service *serv_type, char *sender_name,
109 		      int max_groups, int *num_groups, char group_names[][MAX_GROUP_NAME],
110 		      int16 *mess_type, int *endian_mismatch, scatter *scat_mess,
111 		      int *more_msgs);
112 
113 int   FL_more_msgs(mailbox mbox);
114 
115 int   FL_poll(mailbox mbox);
116 
117 void  FL_error(int error_code);
118 
119 /* returns offset in memb. message of gid (group id), num_vs and vs_set */
120 
121 int   FL_get_gid_offset_memb_mess(void);
122 int   FL_get_num_vs_offset_memb_mess(void);
123 int   FL_get_vs_set_offset_memb_mess(void);
124 
125 
126 #ifdef __cplusplus
127 }
128 #endif
129 
130 #endif
131