Expand the transport layer interface with a peer transmission method.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2012-04-05 17:15:32 +02:00
parent cd0fbc5c95
commit beb3d5d821
5 changed files with 13 additions and 4 deletions

2
raw.c
View File

@ -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);
}
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)
{
struct raw *raw = container_of(t, struct raw, t);

View File

@ -42,7 +42,13 @@ int transport_recv(struct transport *t, int fd,
int transport_send(struct transport *t, struct fdarray *fda, int event,
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)

View File

@ -57,6 +57,9 @@ int transport_recv(struct transport *t, int fd,
int transport_send(struct transport *t, struct fdarray *fda, int event,
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.
* @param type Which transport to obtain.

View File

@ -34,7 +34,7 @@ struct transport {
int (*recv)(struct transport *t, int fd, void *buf, int buflen,
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 (*release)(struct transport *t);

2
udp.c
View File

@ -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);
}
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)
{
ssize_t cnt;