Expand the transport layer interface with a peer transmission method.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>master
parent
cd0fbc5c95
commit
beb3d5d821
2
raw.c
2
raw.c
|
@ -210,7 +210,7 @@ static int raw_recv(struct transport *t, int fd, void *buf, int buflen,
|
||||||
return sk_receive(fd, ptr, buflen, hwts, 0);
|
return sk_receive(fd, ptr, buflen, hwts, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int raw_send(struct transport *t, struct fdarray *fda, int event,
|
static int raw_send(struct transport *t, struct fdarray *fda, int event, int peer,
|
||||||
void *buf, int len, struct hw_timestamp *hwts)
|
void *buf, int len, struct hw_timestamp *hwts)
|
||||||
{
|
{
|
||||||
struct raw *raw = container_of(t, struct raw, t);
|
struct raw *raw = container_of(t, struct raw, t);
|
||||||
|
|
|
@ -42,7 +42,13 @@ int transport_recv(struct transport *t, int fd,
|
||||||
int transport_send(struct transport *t, struct fdarray *fda, int event,
|
int transport_send(struct transport *t, struct fdarray *fda, int event,
|
||||||
void *buf, int buflen, struct hw_timestamp *hwts)
|
void *buf, int buflen, struct hw_timestamp *hwts)
|
||||||
{
|
{
|
||||||
return t->send(t, fda, event, buf, buflen, hwts);
|
return t->send(t, fda, event, 0, buf, buflen, hwts);
|
||||||
|
}
|
||||||
|
|
||||||
|
int transport_peer(struct transport *t, struct fdarray *fda, int event,
|
||||||
|
void *buf, int buflen, struct hw_timestamp *hwts)
|
||||||
|
{
|
||||||
|
return t->send(t, fda, event, 1, buf, buflen, hwts);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct transport *transport_create(enum transport_type type)
|
struct transport *transport_create(enum transport_type type)
|
||||||
|
|
|
@ -57,6 +57,9 @@ int transport_recv(struct transport *t, int fd,
|
||||||
int transport_send(struct transport *t, struct fdarray *fda, int event,
|
int transport_send(struct transport *t, struct fdarray *fda, int event,
|
||||||
void *buf, int buflen, struct hw_timestamp *hwts);
|
void *buf, int buflen, struct hw_timestamp *hwts);
|
||||||
|
|
||||||
|
int transport_peer(struct transport *t, struct fdarray *fda, int event,
|
||||||
|
void *buf, int buflen, struct hw_timestamp *hwts);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocate an instance of the specified transport.
|
* Allocate an instance of the specified transport.
|
||||||
* @param type Which transport to obtain.
|
* @param type Which transport to obtain.
|
||||||
|
|
|
@ -34,7 +34,7 @@ struct transport {
|
||||||
int (*recv)(struct transport *t, int fd, void *buf, int buflen,
|
int (*recv)(struct transport *t, int fd, void *buf, int buflen,
|
||||||
struct hw_timestamp *hwts);
|
struct hw_timestamp *hwts);
|
||||||
|
|
||||||
int (*send)(struct transport *t, struct fdarray *fda, int event,
|
int (*send)(struct transport *t, struct fdarray *fda, int event, int peer,
|
||||||
void *buf, int buflen, struct hw_timestamp *hwts);
|
void *buf, int buflen, struct hw_timestamp *hwts);
|
||||||
|
|
||||||
void (*release)(struct transport *t);
|
void (*release)(struct transport *t);
|
||||||
|
|
2
udp.c
2
udp.c
|
@ -165,7 +165,7 @@ static int udp_recv(struct transport *t, int fd, void *buf, int buflen,
|
||||||
return sk_receive(fd, buf, buflen, hwts, 0);
|
return sk_receive(fd, buf, buflen, hwts, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int udp_send(struct transport *t, struct fdarray *fda, int event,
|
static int udp_send(struct transport *t, struct fdarray *fda, int event, int peer,
|
||||||
void *buf, int len, struct hw_timestamp *hwts)
|
void *buf, int len, struct hw_timestamp *hwts)
|
||||||
{
|
{
|
||||||
ssize_t cnt;
|
ssize_t cnt;
|
||||||
|
|
Loading…
Reference in New Issue