/[rdesktop]/sourceforge.net/trunk/rdesktop/tcp.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /sourceforge.net/trunk/rdesktop/tcp.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1396 by jsorg71, Mon Jan 8 04:47:06 2007 UTC revision 1397 by stargo, Tue Feb 20 16:51:46 2007 UTC
# Line 46  Line 46 
46  #define INADDR_NONE ((unsigned long) -1)  #define INADDR_NONE ((unsigned long) -1)
47  #endif  #endif
48    
49    #ifdef WITH_SCARD
50    #define STREAM_COUNT 8
51    #else
52    #define STREAM_COUNT 1
53    #endif
54    
55  static int g_sock;  static int g_sock;
56  static struct stream g_in;  static struct stream g_in;
57  #ifndef WITH_SCARD  static struct stream g_out[STREAM_COUNT];
 static struct stream g_out;  
 #endif  
58  int g_tcp_port_rdp = TCP_PORT_RDP;  int g_tcp_port_rdp = TCP_PORT_RDP;
59    
60  /* wait till socket is ready to write or timeout */  /* wait till socket is ready to write or timeout */
# Line 77  tcp_can_send(int sck, int millis) Line 81  tcp_can_send(int sck, int millis)
81  STREAM  STREAM
82  tcp_init(uint32 maxlen)  tcp_init(uint32 maxlen)
83  {  {
84            static int cur_stream_id = 0;
85          STREAM result = NULL;          STREAM result = NULL;
86    
87  #ifdef WITH_SCARD  #ifdef WITH_SCARD
88          scard_lock(SCARD_LOCK_TCP);          scard_lock(SCARD_LOCK_TCP);
         result = scard_tcp_init();  
 #else  
         result = &g_out;  
89  #endif  #endif
90            result = &g_out[cur_stream_id];
91            cur_stream_id = (cur_stream_id + 1) % STREAM_COUNT;
92    
93          if (maxlen > result->size)          if (maxlen > result->size)
94          {          {
# Line 204  tcp_connect(char *server) Line 208  tcp_connect(char *server)
208  {  {
209          socklen_t option_len;          socklen_t option_len;
210          uint32 option_value;          uint32 option_value;
211            int i;
212    
213  #ifdef IPv6  #ifdef IPv6
214    
# Line 296  tcp_connect(char *server) Line 301  tcp_connect(char *server)
301          g_in.size = 4096;          g_in.size = 4096;
302          g_in.data = (uint8 *) xmalloc(g_in.size);          g_in.data = (uint8 *) xmalloc(g_in.size);
303    
304  #ifdef WITH_SCARD          for (i = 0; i < STREAM_COUNT; i++)
305          scard_tcp_connect();          {
306  #else                  g_out[i].size = 4096;
307          g_out.size = 4096;                  g_out[i].data = (uint8 *) xmalloc(g_out[i].size);
308          g_out.data = (uint8 *) xmalloc(g_out.size);          }
 #endif  
309    
310          return True;          return True;
311  }  }
# Line 334  tcp_get_address() Line 338  tcp_get_address()
338  void  void
339  tcp_reset_state(void)  tcp_reset_state(void)
340  {  {
341            int i;
342    
343          g_sock = -1;            /* reset socket */          g_sock = -1;            /* reset socket */
344    
345          /* Clear the incoming stream */          /* Clear the incoming stream */
# Line 350  tcp_reset_state(void) Line 356  tcp_reset_state(void)
356          g_in.channel_hdr = NULL;          g_in.channel_hdr = NULL;
357    
358          /* Clear the outgoing stream(s) */          /* Clear the outgoing stream(s) */
359  #ifdef WITH_SCARD          for (i = 0; i < STREAM_COUNT; i++)
360          scard_tcp_reset_state();          {
361  #else                  if (g_out[i].data != NULL)
362          if (g_out.data != NULL)                          xfree(g_out[i].data);
363                  xfree(g_out.data);                  g_out[i].p = NULL;
364          g_out.p = NULL;                  g_out[i].end = NULL;
365          g_out.end = NULL;                  g_out[i].data = NULL;
366          g_out.data = NULL;                  g_out[i].size = 0;
367          g_out.size = 0;                  g_out[i].iso_hdr = NULL;
368          g_out.iso_hdr = NULL;                  g_out[i].mcs_hdr = NULL;
369          g_out.mcs_hdr = NULL;                  g_out[i].sec_hdr = NULL;
370          g_out.sec_hdr = NULL;                  g_out[i].rdp_hdr = NULL;
371          g_out.rdp_hdr = NULL;                  g_out[i].channel_hdr = NULL;
372          g_out.channel_hdr = NULL;          }
 #endif  
373  }  }

Legend:
Removed from v.1396  
changed lines
  Added in v.1397

  ViewVC Help
Powered by ViewVC 1.1.26