Files
flenser/dpid/dpid_common.hh
ADAM David Alan Martin f283391b46 Get some of the last remaining C files into C++
They still need to be fixed up, but they now build with C++.
2025-08-23 02:09:47 -04:00

65 lines
1.3 KiB
C++

#ifndef DPID_COMMON_H
#define DPID_COMMON_H
/*! \file
* Declares common functions, global variables, and types.
*
* \todo
* The dpid error codes will be used in
* the next patch
*/
#include <dirent.h>
#include <stddef.h> /* size_t */
#include <sys/types.h> /* ssize_t */
#include "../dlib/dlib.hh"
#ifdef __cplusplus
extern "C"
{
#endif
/*
* Debugging macros
*/
#define _MSG(...)
#define MSG(...) printf("[dpid]: " __VA_ARGS__)
#define MSG_ERR(...) fprintf(stderr, "[dpid]: " __VA_ARGS__)
#define dotDILLO_DPI ".flenser/dpi"
#define dotDILLO_DPIDRC ".flenser/dpidrc"
#define dotDILLO_DPID_COMM_KEYS ".flenser/dpid_comm_keys"
#define ERRMSG(CALLER, CALLED, ERR)\
errmsg(CALLER, CALLED, ERR, __FILE__, __LINE__)
#define _ERRMSG(CALLER, CALLED, ERR)
/*!
* Macros for calling ckd_write and ckd_close functions
*/
#define CKD_WRITE(fd, msg) ckd_write(fd, msg, __FILE__, __LINE__)
#define CKD_CLOSE(fd) ckd_close(fd, __FILE__, __LINE__)
/*! Intended for identifying dillo plugins
* and related files
*/
enum file_type {
DPI_FILE, /*! Any file name containing .dpi */
UNKNOWN_FILE
};
void errmsg(char *caller, char *called, int errornum, char *file, int line);
ssize_t ckd_write(int fd, char *msg, char *file, int line);
ssize_t ckd_close(int fd, char *file, int line);
#ifdef __cplusplus
}
#endif
#endif