GRASS Programmer's Manual 6.4.1(2011)
|
00001 #include "xdr.h" 00002 #include "macros.h" 00003 00004 00005 /******** client only ***************/ 00006 int db__start_procedure_call(int procnum) 00007 { 00008 int reply; 00009 00010 DB_SEND_INT(procnum); 00011 DB_RECV_INT(&reply); 00012 if (reply != procnum) { 00013 if (reply == 0) { 00014 db_noproc_error(procnum); 00015 } 00016 else { 00017 db_protocol_error(); 00018 } 00019 return DB_PROTOCOL_ERR; 00020 } 00021 00022 return DB_OK; 00023 } 00024 00025 /***** driver only *******************/ 00026 00027 /* return codes: 00028 * DB_OK ok 00029 * DB_EOF eof from client 00030 */ 00031 int db__recv_procnum(int *n) 00032 { 00033 int stat = DB_OK; 00034 00035 if (!db__recv(n, sizeof(*n))) 00036 stat = DB_EOF; 00037 00038 return stat; 00039 } 00040 00041 int db__send_procedure_ok(int n) 00042 { 00043 return db__send_int(n); 00044 } 00045 00046 int db__send_procedure_not_implemented(int n) 00047 { 00048 return db__send_int(n ? 0 : -1); 00049 }