diff --git a/include/IPC_US_communicator.h b/include/IPC_US_communicator.h new file mode 100644 index 0000000000000000000000000000000000000000..774e7f696bbc3845f448aab4c3d804d4183f3f21 --- /dev/null +++ b/include/IPC_US_communicator.h @@ -0,0 +1,21 @@ +/* + * File: IPC_US_communicator.h + * Author: Eckl Máté <ecklm94@gmail.com> + * + * Created on 2016. május 25., 18:09 + */ + +#ifndef IPC_US_COMMUNICATOR_H +#define IPC_US_COMMUNICATOR_H + +#include "udp_socket_wp.h" + +class IPC_US_communicator +{ + udp_socket_wp sock; + IPC_US_communicator(const IPC_US_communicator& orig); +public: + IPC_US_communicator(const char *socket_path); +}; + +#endif /* IPC_US_COMMUNICATOR_H */ diff --git a/src/IPC_US_communicator.cpp b/src/IPC_US_communicator.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ee2dfcec85c70afeb52a50bda09020f35e00d3e0 --- /dev/null +++ b/src/IPC_US_communicator.cpp @@ -0,0 +1,20 @@ +/* + * File: IPC_US_communicator.cpp + * Author: Eckl Máté <ecklm94@gmail.com> + * + * Created on 2016. május 25., 18:09 + */ + +#include <sys/socket.h> +#include <sys/un.h> + +#include "../include/IPC_US_communicator.h" + +IPC_US_communicator::IPC_US_communicator(const char* socket_path) { + sockaddr_un ipc; + memset(&ipc, 0, sizeof(ipc)); + ipc.sun_family = AF_UNIX; + strncpy(ipc.sun_path+1, socket_path, sizeof(ipc.sun_path)-1-1); + sock.set_domain(AF_UNIX); + sock.bind_wp((sockaddr*) &ipc, sizeof(ipc)); +}