+/* lttng socket protocol. */
+enum lttcomm_sock_proto {
+ LTTCOMM_SOCK_UDP,
+ LTTCOMM_SOCK_TCP,
+};
+
+/*
+ * Index in the net_families array below. Please keep in sync!
+ */
+enum lttcomm_sock_domain {
+ LTTCOMM_INET = 0,
+ LTTCOMM_INET6 = 1,
+};
+
+struct lttcomm_sockaddr {
+ enum lttcomm_sock_domain type;
+ union {
+ struct sockaddr_in sin;
+ struct sockaddr_in6 sin6;
+ } addr;
+};
+
+struct lttcomm_sock {
+ int fd;
+ enum lttcomm_sock_proto proto;
+ struct lttcomm_sockaddr sockaddr;
+ const struct lttcomm_proto_ops *ops;
+};
+
+struct lttcomm_net_family {
+ int family;
+ int (*create) (struct lttcomm_sock *sock, int type, int proto);
+};
+
+struct lttcomm_proto_ops {
+ int (*bind) (struct lttcomm_sock *sock);
+ int (*close) (struct lttcomm_sock *sock);
+ int (*connect) (struct lttcomm_sock *sock);
+ struct lttcomm_sock *(*accept) (struct lttcomm_sock *sock);
+ int (*listen) (struct lttcomm_sock *sock, int backlog);
+ ssize_t (*recvmsg) (struct lttcomm_sock *sock, void *buf, size_t len,
+ int flags);
+ ssize_t (*sendmsg) (struct lttcomm_sock *sock, void *buf, size_t len,
+ int flags);
+};
+