Skip to content

Commit

Permalink
read/write oob.
Browse files Browse the repository at this point in the history
  • Loading branch information
ksherlock committed May 13, 2012
1 parent 6ab3356 commit 7bd4d90
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
4 changes: 4 additions & 0 deletions driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ int driver(
break;

case PRU_RCVOOB:
return mreadoob(e, p1, p2, p3, p4, p5);
break;

case PRU_SEND:
Expand All @@ -143,6 +144,9 @@ int driver(
break;

case PRU_SENDOOB:
// OOB is always inline. so there.
// this is never called via ReadGS.
return mwrite(e, p1, p2, p3, p4, p5);
break;

case PRU_SENSE:
Expand Down
2 changes: 2 additions & 0 deletions marignotti.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ int driver(int, int, void *, void *, void *, void *, void *);
int mattach(int ipid, void *p1, void *p2, void *p3, void *p4, void *p5);

int mread(Entry *, void *p1, void *p2, void *p3, void *p4, void *p5);
int mreadoob(Entry *e, void *p1, void *p2, void *p3, void *p4, void *p5);

int mwrite(Entry *, void *p1, void *p2, void *p3, void *p4, void *p5);
int mconnect(Entry *, void *p1, void *p2, void *p3, void *p4, void *p5);
int mbind(Entry *, void *p1, void *p2, void *p3, void *p4, void *p5);
Expand Down
26 changes: 26 additions & 0 deletions mread.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,32 @@ static int sock_read(

}

int mreadoob(Entry *e, void *p1, void *p2, void *p3, void *p4, void *p5)
{
// called via recv, recvfrom.
// OOB is always inline, therefore an OOB read will
// just return 0.
// todo -- just treat as regular read?

char *buffer = (char *)p1;
LongWord nbytes = *(LongWord *)p2;
xsockaddr *addr = (xsockaddr *)p3;
int addrlen = p4 ? *(int *)p4 : 0;

LongWord *outbytes = (LongWord *)p2;

*outbytes = 0;


if (Debug > 0)
{
s16_debug_printf("oob read nbytes = %ld", nbytes);
}

return 0;
}


// called through ReadGS, recv, recvfrom
int mread(Entry *e, void *p1, void *p2, void *p3, void *p4, void *p5)
{
Expand Down

0 comments on commit 7bd4d90

Please sign in to comment.