Skip to content

Commit

Permalink
added receive function to rdp
Browse files Browse the repository at this point in the history
  • Loading branch information
ytakano committed Jun 7, 2010
1 parent a8a8dd2 commit c01db30
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

Copyright (c) 2009, Yuuki Takano ([email protected]).
Copyright (c) 2009-2010, Yuuki Takano ([email protected]).
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
4 changes: 2 additions & 2 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
$ omake install PREFIX=/opt/local

4. Uninstall
If you installed to /user/local, please type:
If you have installed to /user/local, please type:
$ omake uninstall

If you installed to any other places, use PREFIX option.
If you have installed to any other places, use PREFIX option.
$ omake uninstall PREFIX=/opt/local

You can uninstall to delete files of libcage.
Expand Down
34 changes: 33 additions & 1 deletion src/rdp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,38 @@ namespace libcage {
m_timer.unset_timer(&m_timer_rdp);
}

void
rdp::receive(int desc, void *buf, int *len)
{
boost::unordered_map<int, rdp_con_ptr>::iterator it;

it = m_desc2conn.find(desc);
if (it == m_desc2conn.end()) {
*len = 0;
return;
}

int total = 0;
char *dst = (char*)buf;
while (! it->second->rqueue.empty()) {
packetbuf_ptr pbuf = it->second->rqueue.front();

if (total + pbuf->get_len() > *len) {
*len = total;
return;
}

memcpy(dst, pbuf->get_data(), pbuf->get_len());

total += pbuf->get_len();
dst += pbuf->get_len();

it->second->rqueue.pop();
}

*len = total;
}

int
rdp::send(int desc, const void *buf, int len)
{
Expand Down Expand Up @@ -1558,7 +1590,7 @@ namespace libcage {


// for eack
#define MAX_EACK 16
#define MAX_EACK 64
uint32_t seqs[MAX_EACK];
int idx;
int i, j;
Expand Down

0 comments on commit c01db30

Please sign in to comment.