-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathmctp-ops.h
More file actions
49 lines (41 loc) · 1.17 KB
/
mctp-ops.h
File metadata and controls
49 lines (41 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/* SPDX-License-Identifier: GPL-2.0 */
/*
* mctpd: bus owner for MCTP using Linux kernel
*
* Copyright (c) 2023 Code Construct
*/
#pragma once
#include <sys/socket.h>
#include <stdarg.h>
#if OPS_SD_EVENT
#include <systemd/sd-event.h>
#endif
#define _GNU_SOURCE
struct socket_ops {
int (*socket)(void);
int (*setsockopt)(int sd, int level, int optname, void *optval,
socklen_t optlen);
int (*bind)(int sd, struct sockaddr *addr, socklen_t addrlen);
ssize_t (*sendto)(int sd, const void *buf, size_t len, int flags,
const struct sockaddr *dest, socklen_t addrlen);
ssize_t (*recvfrom)(int sd, void *buf, size_t len, int flags,
struct sockaddr *src, socklen_t *addrlen);
int (*close)(int sd);
};
#if OPS_SD_EVENT
struct sd_event_ops {
typeof(sd_event_add_time_relative) *add_time_relative;
typeof(sd_event_source_set_time_relative) *source_set_time_relative;
};
#endif
struct mctp_ops {
struct socket_ops mctp;
struct socket_ops nl;
#if OPS_SD_EVENT
struct sd_event_ops sd_event;
#endif
void (*bug_warn)(const char *fmt, va_list args);
int (*link_sysfs_path)(const char *ifname, char **devpath);
};
extern const struct mctp_ops mctp_ops;
void mctp_ops_init(void);