ipc-connection.c revision e93184a9055c2530366dfe617e07199603c399dd
/* Copyright (c) 2011-2016 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "ioloop.h"
#include "istream.h"
#include "ostream.h"
#include "llist.h"
#include "master-service.h"
#include "ipc-group.h"
#include "ipc-connection.h"
#include <unistd.h>
#define IPC_SERVER_PROTOCOL_MAJOR_VERSION 1
#define IPC_SERVER_PROTOCOL_MINOR_VERSION 0
#define IPC_SERVER_HANDSHAKE "VERSION\tipc-proxy\t1\t0\n"
static unsigned int connection_id_counter;
{
struct ipc_connection_cmd **cmds;
unsigned int i, count;
for (i = 0; i < count; i++) {
break;
}
}
}
}
static struct ipc_connection_cmd *
{
struct ipc_connection_cmd *const *cmdp;
return *cmdp;
}
return NULL;
}
static int
{
struct ipc_connection_cmd *cmd;
unsigned int tag;
enum ipc_cmd_status status;
char *data;
/* <tag> [:+-]<data> */
return -1;
*data++ = '\0';
return -1;
switch (data[0]) {
case ':':
break;
case '+':
break;
case '-':
break;
default:
return -1;
}
data++;
return 0;
}
if (status != IPC_CMD_STATUS_REPLY) {
}
return 0;
}
{
const char *const *args;
char *line;
int ret;
return;
}
if (!conn->version_received) {
return;
i_error("IPC server not compatible with this server "
"(mixed old and new binaries?)");
return;
}
}
if (!conn->handshake_received) {
return;
i_error("IPC server sent invalid handshake");
return;
}
i_error("IPC server named itself unexpectedly: %s "
"(existing ones were %s)",
return;
}
return;
}
}
T_BEGIN {
} T_END;
if (ret < 0) {
i_error("Invalid input from IPC server '%s': %s",
break;
}
}
}
{
struct ipc_connection *conn;
return conn;
}
{
}
i_error("close(ipc connection) failed: %m");
}
struct ipc_connection *
{
struct ipc_connection *conn;
return conn;
}
return NULL;
}
{
struct ipc_connection_cmd *ipc_cmd;
T_BEGIN {
} T_END;
}