Skip to content

Commit

Permalink
Expand the transport layer interface with a peer transmission method.
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Cochran <[email protected]>
  • Loading branch information
richardcochran committed Apr 5, 2012
1 parent cd0fbc5 commit beb3d5d
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 7 additions & 1 deletion transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions transport.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion transport_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit beb3d5d

Please sign in to comment.