GRASS GIS 7 Programmer's Manual  7.9.dev(2021)-e5379bbd7
xdrprocedure.c
Go to the documentation of this file.
1 /*!
2  \file lib/db/dbmi_base/xdrprocedure.c
3 
4  \brief DBMI Library (base) - external data representation (procedure)
5 
6  (C) 1999-2009, 2011 by the GRASS Development Team
7 
8  This program is free software under the GNU General Public License
9  (>=v2). Read the file COPYING that comes with GRASS for details.
10 
11  \author Joel Jones (CERL/UIUC), Radim Blazek, Brad Douglas, Markus Neteler
12  \author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
13 */
14 
15 #include "xdr.h"
16 #include "macros.h"
17 
18 /*!
19  \brief ? (client only)
20 
21  \param procnum
22 
23  \return
24 */
26 {
27  int reply;
28 
29  DB_SEND_INT(procnum);
30  DB_RECV_INT(&reply);
31  if (reply != procnum) {
32  if (reply == 0) {
33  db_noproc_error(procnum);
34  }
35  else {
37  }
38  return DB_PROTOCOL_ERR;
39  }
40 
41  return DB_OK;
42 }
43 
44 /*!
45  \brief ? (driver only)
46 
47  \param n
48 
49  \return DB_OK ok
50  \return DB_EOF eof from client
51 */
52 int db__recv_procnum(int *n)
53 {
54  int stat = DB_OK;
55 
56  if (!db__recv(n, sizeof(*n)))
57  stat = DB_EOF;
58 
59  return stat;
60 }
61 
62 /*!
63  \brief ?
64 
65  \param n
66 
67  \return
68 */
70 {
71  return db__send_int(n);
72 }
73 
74 /*!
75  \brief ?
76 
77  \param n
78 
79  \return
80 */
82 {
83  return db__send_int(n ? 0 : -1);
84 }
#define DB_PROTOCOL_ERR
Definition: dbmi.h:75
#define DB_SEND_INT(x)
Definition: macros.h:37
#define DB_RECV_INT(x)
Definition: macros.h:39
int db__recv_procnum(int *n)
? (driver only)
Definition: xdrprocedure.c:52
int db__send_procedure_not_implemented(int n)
?
Definition: xdrprocedure.c:81
void db_noproc_error(int)
Report no procedure error.
int db__recv(void *buf, size_t size)
int db__start_procedure_call(int procnum)
? (client only)
Definition: xdrprocedure.c:25
int db__send_procedure_ok(int n)
?
Definition: xdrprocedure.c:69
void db_protocol_error(void)
Report protocol error.
int procnum
Definition: procs.h:34
int db__send_int(int)
Send integer.
Definition: xdrint.c:24
#define DB_EOF
Definition: dbmi.h:76
#define DB_OK
Definition: dbmi.h:71