-again trying to delete old vectorproduct dir
[oweals/gnunet.git] / src / scalarproduct / scalarproduct_testing.h
1 /*
2      This file is part of GNUnet.
3      (C) 2013 Christian Grothoff (and other contributing authors)
4
5      GNUnet is free software; you can redistribute it and/or modify
6      it under the terms of the GNU General Public License as published
7      by the Free Software Foundation; either version 3, or (at your
8      option) any later version.
9
10      GNUnet is distributed in the hope that it will be useful, but
11      WITHOUT ANY WARRANTY; without even the implied warranty of
12      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13      General Public License for more details.
14
15      You should have received a copy of the GNU General Public License
16      along with GNUnet; see the file COPYING.  If not, write to the
17      Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18      Boston, MA 02111-1307, USA.
19  */
20 /** 
21  * @file scalarproduct/scalarproduct_testing.h
22  * @brief VectorProduct testcase common declarations
23  * @author Gaurav Kukreja
24  * @author Christian Fuchs
25  *
26  * Created on June 29, 2013, 7:39 PM
27  */
28
29 #ifndef SCALARPRODUCT_TESTING_H
30 #define SCALARPRODUCT_TESTING_H
31
32 #ifdef  __cplusplus
33 extern "C" {
34 #endif
35     
36 struct GNUNET_SCALARPRODUCT_TESTING_handle
37 {
38   /**
39    * Testing library system handle
40    */
41   struct GNUNET_TESTING_System *tl_system;
42   
43   /**
44    * head DLL of peers
45    */
46   struct PeerContext *p_head;
47
48   /**
49    * tail DLL of peers
50    */
51   struct PeerContext *p_tail;
52 };
53
54 struct PeerContext 
55 {
56   /**
57    * Next element in the DLL
58    */
59   struct PeerContext *next;
60
61   /**
62    * Previous element in the DLL
63    */
64   struct PeerContext *prev;
65
66   /**
67    * Peer's testing handle
68    */
69   struct GNUNET_TESTING_Peer *peer;
70
71   /**
72    * Peer identity
73    */
74   struct GNUNET_PeerIdentity id;
75   
76   /**
77    * Handle for the peer's ARM process
78    */
79   struct GNUNET_OS_Process *arm_proc;
80   
81   /**
82    * Pointer to Vector Product Handle
83    */
84   struct GNUNET_SCALARPRODUCT_Handle *vh;
85   
86   /**
87    * Closure for the callbacks
88    */
89   void *cb_cls;
90
91   /**
92    * An unique number to identify the peer
93    */
94   unsigned int no;
95   
96   /**
97    * Peer's configuration
98    */
99   struct GNUNET_CONFIGURATION_Handle *cfg;
100   
101   /**
102    * Pointer to the master testing handle
103    */
104   struct GNUNET_SCALARPRODUCT_TESTING_handle * vth;
105   
106   /**
107     * Callback when two peers are connected and both have called the connect callback
108     * to notify clients about a new peer
109     */
110    void (*start_cb) (struct PeerContext * p, void *cls);
111   
112 //  /**
113 //   * Pointer to function where the test occurs
114 //   */
115 //  GNUNET_SCALARPRODUCT_TESTING_start_cb start_cb;
116 };
117
118 /**
119  * Callback when two peers are connected and both have called the connect callback
120  * to notify clients about a new peer
121  */
122 typedef void (*GNUNET_SCALARPRODUCT_TESTING_start_cb) (struct PeerContext * p,
123                                                    void *cls);
124
125 struct GNUNET_SCALARPRODUCT_TESTING_handle *
126 GNUNET_SCALARPRODUCT_TESTING_init();
127
128 static void
129 GNUNET_SCALARPRODUCT_TESTING_done(struct GNUNET_SCALARPRODUCT_TESTING_handle * vth);
130
131 struct PeerContext *
132 GNUNET_SCALARPRODUCT_TESTING_start_peer (struct GNUNET_SCALARPRODUCT_TESTING_handle * vth,
133                                      const char *cfgname, int peer_id,
134                                      GNUNET_SCALARPRODUCT_TESTING_start_cb start_cb,
135                                      void *cb_cls);
136
137 static void
138 GNUNET_SCALARPRODUCT_TESTING_stop_peer
139         (struct GNUNET_SCALARPRODUCT_TESTING_handle * vth,
140         struct PeerContext *p);
141
142
143
144
145 #ifdef  __cplusplus
146 }
147 #endif
148
149 #endif  /* SCALARPRODUCT_TESTING_H */
150