Changeset 14333 in vbox for trunk/src/VBox/Devices/Network
- Timestamp:
- Nov 18, 2008 10:12:28 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 39537
- Location:
- trunk/src/VBox/Devices/Network/slirp
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/ctl.h
r8009 r14333 5 5 #define CTL_BROADCAST 255 6 6 7 #if 08 #define CTL_SPECIAL "10.0.2.0"9 #define CTL_LOCAL "10.0.2.15"10 #endif -
trunk/src/VBox/Devices/Network/slirp/if.c
r13984 r14333 53 53 } 54 54 55 #if 056 /*57 * This shouldn't be needed since the modem is blocking and58 * we don't expect any signals, but what the hell..59 */60 inline int61 writen(fd, bptr, n)62 int fd;63 char *bptr;64 int n;65 {66 int ret;67 int total;68 69 /* This should succeed most of the time */70 ret = send(fd, bptr, n,0);71 if (ret == n || ret <= 0)72 return ret;73 74 /* Didn't write everything, go into the loop */75 total = ret;76 while (n > total) {77 ret = send(fd, bptr+total, n-total,0);78 if (ret <= 0)79 return ret;80 total += ret;81 }82 return total;83 }84 85 /*86 * if_input - read() the tty, do "top level" processing (ie: check for any escapes),87 * and pass onto (*ttyp->if_input)88 *89 * XXXXX Any zeros arriving by themselves are NOT placed into the arriving packet.90 */91 #define INBUFF_SIZE 2048 /* XXX */92 void93 if_input(ttyp)94 struct ttys *ttyp;95 {96 u_char if_inbuff[INBUFF_SIZE];97 int if_n;98 99 DEBUG_CALL("if_input");100 DEBUG_ARG("ttyp = %lx", (long)ttyp);101 102 if_n = recv(ttyp->fd, (char *)if_inbuff, INBUFF_SIZE,0);103 104 DEBUG_MISC((dfd, " read %d bytes\n", if_n));105 106 if (if_n <= 0) {107 if (if_n == 0 || (errno != EINTR && errno != EAGAIN)) {108 if (ttyp->up)109 link_up--;110 tty_detached(ttyp, 0);111 }112 return;113 }114 if (if_n == 1) {115 if (*if_inbuff == '0') {116 ttyp->ones = 0;117 if (++ttyp->zeros >= 5)118 slirp_exit(0);119 return;120 }121 if (*if_inbuff == '1') {122 ttyp->zeros = 0;123 if (++ttyp->ones >= 5)124 tty_detached(ttyp, 0);125 return;126 }127 }128 ttyp->ones = ttyp->zeros = 0;129 130 (*ttyp->if_input)(ttyp, if_inbuff, if_n);131 }132 #endif133 134 55 /* 135 56 * if_output: Queue packet into an output queue.
Note:
See TracChangeset
for help on using the changeset viewer.