12#include "../dlib/dlib.h"
18#define DPIP_LAST_TAG 2
20#define DPIP_NONBLOCK 8
77#define a_Dpip_dsh_printf(sh, flush, ...) \
79 Dstr *dstr = dStr_sized_new(128); \
80 dStr_sprintf(dstr, __VA_ARGS__); \
81 a_Dpip_dsh_write(sh, flush, dstr->str, dstr->len); \
int a_Dpip_dsh_trywrite(Dsh *dsh, const char *Data, int DataSize)
char * a_Dpip_dsh_read_token2(Dsh *dsh, int blocking, int *DataSize)
Return a newlly allocated string with the next dpip token in the socket.
void a_Dpip_dsh_free(Dsh *dsh)
Free the SockHandler structure.
char * a_Dpip_build_cmd(const char *format,...)
Printf like function for building dpip commands.
int a_Dpip_dsh_write_str(Dsh *dsh, int flush, const char *str)
Convenience function.
char * a_Dpip_get_attr(const char *tag, const char *attrname)
Task: given a tag and an attribute name, return its value.
char * a_Dpip_dsh_read_token(Dsh *dsh, int blocking)
Return a newlly allocated string with the next dpip token in the socket.
void a_Dpip_dsh_close(Dsh *dsh)
Close this socket for reading and writing.
char * a_Dpip_get_attr_l(const char *tag, size_t tagsize, const char *attrname)
Task: given a tag, its size and an attribute name, return the attribute value (stuffing of ' is remov...
int a_Dpip_check_auth(const char *auth)
Check whether the given 'auth' string equals what dpid saved.
int a_Dpip_dsh_write(Dsh *dsh, int flush, const char *Data, int DataSize)
Streamed write to socket.
int a_Dpip_dsh_tryflush(Dsh *dsh)
Dsh * a_Dpip_dsh_new(int fd_in, int fd_out, int flush_sz)
Create and initialize a dpip socket handler.
Dpip socket handler type.
int mode
mode flags: DPIP_TAG | DPIP_LAST_TAG | DPIP_RAW
int status
status code: DPIP_EAGAIN | DPIP_ERROR | DPIP_EOF
int flush_sz
max size before flush