| 1 | /* |
| 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License as published by |
| 5 | * the Free Software Foundation; either version 2 of the License, or |
| 6 | * (at your option) any later version. |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU General Public License |
| 14 | * along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 15 | */ |
| 16 | |
| 17 | #ifndef D4LIB_H |
| 18 | |
| 19 | #define D4LIB_H |
| 20 | |
| 21 | extern int debugD4; /* allow printout of debug informations */ |
| 22 | |
| 23 | extern int EnterIEEE(int fd); |
| 24 | extern int Init(int fd); |
| 25 | extern int Exit(int fd); |
| 26 | extern int GetSocketID(int fd, const char *serviceName); |
| 27 | extern int OpenChannel(int fd, unsigned char sockId, int *sndSz, int *rcvSz); |
| 28 | extern int CloseChannel(int fd, unsigned char socketID); |
| 29 | extern int CreditRequest(int fd, unsigned char socketID); |
| 30 | extern int Credit(int fd, unsigned char socketID, int credit); |
| 31 | |
| 32 | /* convenience function */ |
| 33 | extern int SafeWrite(int fd, const void *data, int len); |
| 34 | extern int askForCredit(int fd, unsigned char socketID, int *sndSz, int *rcvSz); |
| 35 | extern int writeData(int fd, unsigned char socketID, const unsigned char *buf, int len, int eoj); |
| 36 | extern int readData(int fd, unsigned char socketID, unsigned char *buf, int len); |
| 37 | extern int writeAndReadData(int fd, unsigned char socketID, |
| 38 | const unsigned char *cmd, int cmd_len, int eoj, |
| 39 | unsigned char *buf, int len, int *sndSz, int *rcvSz, |
| 40 | int (*test)(const unsigned char *buf)); |
| 41 | extern int readAnswer(int fd, unsigned char *buf, int len, int allowExtra); |
| 42 | extern void flushData(int fd, unsigned char socketID); |
| 43 | extern void setDebug(int debug); |
| 44 | |
| 45 | extern int d4WrTimeout; |
| 46 | extern int d4RdTimeout; |
| 47 | extern int ppid; |
| 48 | |
| 49 | #if D4_DEBUG |
| 50 | #define DEBUG 1 |
| 51 | #endif |
| 52 | |
| 53 | #endif |