-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathmctp-ops.h
More file actions
50 lines (42 loc) · 1.27 KB
/
mctp-ops.h
File metadata and controls
50 lines (42 loc) · 1.27 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
50
/* SPDX-License-Identifier: GPL-2.0 */
/*
* mctpd: bus owner for MCTP using Linux kernel
*
* Copyright (c) 2023 Code Construct
*/
#pragma once
#include <stdint.h>
#include <sys/socket.h>
#include <stdarg.h>
#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);
};
struct sd_event;
struct sd_event_source;
struct sd_event_ops {
int (*add_time_relative)(struct sd_event *e,
struct sd_event_source **ret, clockid_t clock,
uint64_t usec, uint64_t accuracy,
int (*callback)(struct sd_event_source *s,
uint64_t usec, void *userdata),
void *userdata);
int (*source_set_time_relative)(struct sd_event_source *s,
uint64_t usec);
};
struct mctp_ops {
struct socket_ops mctp;
struct socket_ops nl;
struct sd_event_ops sd_event;
void (*bug_warn)(const char *fmt, va_list args);
};
extern const struct mctp_ops mctp_ops;
void mctp_ops_init(void);