Ubuntu Pastebin

Paste from al at Tue, 3 Feb 2015 20:34:28 +0000

Download as text
   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
diff -Nur synergy-1.3.1/cmd/synergyc/synergyc.cpp synergy-bluetooth-0.1/cmd/synergyc/synergyc.cpp
--- synergy-1.3.1/cmd/synergyc/synergyc.cpp	2006-03-22 05:40:27.000000000 +0000
+++ synergy-bluetooth-0.1/cmd/synergyc/synergyc.cpp	2009-04-25 08:41:20.000000000 +0100
@@ -32,6 +32,7 @@
 #include "CArch.h"
 #include "XArch.h"
 #include <cstring>
+#include "ISocketFactory.h"
 
 #define DAEMON_RUNNING(running_)
 #if WINAPI_MSWINDOWS
@@ -74,6 +75,7 @@
 		m_backend(false),
 		m_restartable(true),
 		m_daemon(true),
+		m_bluetooth(false),
 		m_logFilter(NULL),
 		m_display(NULL),
 		m_serverAddress(NULL)
@@ -86,6 +88,7 @@
 	bool				m_backend;
 	bool				m_restartable;
 	bool				m_daemon;
+	bool				m_bluetooth;
 	const char* 		m_logFilter;
 	const char*			m_display;
 	CString 			m_name;
@@ -636,6 +639,11 @@
 			help();
 			bye(kExitSuccess);
 		}
+		
+		else if (isArg(i, argc, argv, "-b", "--bluetooth")) {
+			ARG->m_bluetooth = true;
+			ISocketFactory::SetType(IArchNetwork::kBLUETOOTH);
+		}
 
 		else if (isArg(i, argc, argv, NULL, "--version")) {
 			version();
@@ -662,9 +670,14 @@
 
 	// exactly one non-option argument (server-address)
 	if (i == argc) {
-		LOG((CLOG_PRINT "%s: a server address or name is required" BYE,
-								ARG->m_pname, ARG->m_pname));
-		bye(kExitArgs);
+		if(ARG->m_bluetooth) {
+			*ARG->m_serverAddress = CNetworkAddress("00:00:00:00:00:00", 0);
+			goto out;
+		} else {
+			LOG((CLOG_PRINT "%s: a server address or name is required" BYE,
+									ARG->m_pname, ARG->m_pname));
+			bye(kExitArgs);
+		}
 	}
 	if (i + 1 != argc) {
 		LOG((CLOG_PRINT "%s: unrecognized option `%s'" BYE,
@@ -688,7 +701,7 @@
 			bye(kExitFailed);
 		}
 	}
-
+out:
 	// increase default filter level for daemon.  the user must
 	// explicitly request another level for a daemon.
 	if (ARG->m_daemon && ARG->m_logFilter == NULL) {
diff -Nur synergy-1.3.1/cmd/synergys/synergys.cpp synergy-bluetooth-0.1/cmd/synergys/synergys.cpp
--- synergy-1.3.1/cmd/synergys/synergys.cpp	2006-03-22 05:40:27.000000000 +0000
+++ synergy-bluetooth-0.1/cmd/synergys/synergys.cpp	2009-04-24 17:00:55.000000000 +0100
@@ -34,6 +34,8 @@
 #include "CArch.h"
 #include "XArch.h"
 #include "stdfstream.h"
+#include "IArchNetwork.h"
+#include "ISocketFactory.h"
 #include <cstring>
 
 #define DAEMON_RUNNING(running_)
@@ -87,6 +89,7 @@
 		m_backend(false),
 		m_restartable(true),
 		m_daemon(true),
+		m_bluetooth(false),
 		m_configFile(),
 		m_logFilter(NULL),
 		m_display(NULL),
@@ -101,11 +104,13 @@
 	bool				m_backend;
 	bool				m_restartable;
 	bool				m_daemon;
+	bool				m_bluetooth;
 	CString		 		m_configFile;
 	const char* 		m_logFilter;
 	const char*			m_display;
 	CString 			m_name;
 	CNetworkAddress*	m_synergyAddress;
+	
 	CConfig*			m_config;
 };
 
@@ -848,6 +853,7 @@
 USAGE_DISPLAY_INFO
 "  -f, --no-daemon          run the server in the foreground.\n"
 "*     --daemon             run the server as a daemon.\n"
+"  -b  --bluetooth          Use Bluetooth transport instead of TCP.\n"
 "  -n, --name <screen-name> use screen-name instead the hostname to identify\n"
 "                           this screen in the configuration.\n"
 "  -1, --no-restart         do not try to restart the server if it fails for\n"
@@ -960,7 +966,13 @@
 			// not a daemon
 			ARG->m_daemon = false;
 		}
-
+		
+		else if (isArg(i, argc, argv, "-b", "--bluetooth")) {
+			// not a daemon
+			ARG->m_bluetooth = true;
+			ISocketFactory::SetType(IArchNetwork::kBLUETOOTH);
+		}
+		
 		else if (isArg(i, argc, argv, NULL, "--daemon")) {
 			// daemonize
 			ARG->m_daemon = true;
diff -Nur synergy-1.3.1/config/mkinstalldirs synergy-bluetooth-0.1/config/mkinstalldirs
--- synergy-1.3.1/config/mkinstalldirs	2005-04-24 04:02:12.000000000 +0100
+++ synergy-bluetooth-0.1/config/mkinstalldirs	2009-04-24 10:16:40.000000000 +0100
@@ -4,7 +4,7 @@
 # Created: 1993-05-16
 # Public domain
 
-# $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $
+# $Id$
 
 errstatus=0
 
diff -Nur synergy-1.3.1/doc/todo.html synergy-bluetooth-0.1/doc/todo.html
--- synergy-1.3.1/doc/todo.html	1970-01-01 01:00:00.000000000 +0100
+++ synergy-bluetooth-0.1/doc/todo.html	2009-04-24 10:16:40.000000000 +0100
@@ -0,0 +1,70 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
+<html>
+<head>
+	<link rel="stylesheet" type="text/css" href="synergy.css" media="screen" />
+	<title>Synergy To Do List</title>
+</head>
+<body class="main">
+<h3>Synergy To Do List</h3>
+<p>
+This page describes the planned development of Synergy.  There are
+no dates or deadlines.  Instead, you'll find the features to come
+and the rough order they can be expected to arrive.
+</p>
+
+<h4>Short term</h4>
+<p>
+Synergy should work seamlessly.  When it works correctly, it works
+transparently so you don't even think about it.  When it breaks,
+you're forced out of the illusion of a unified desktop.  The first
+priority is fixing those bugs that break the illusion.
+</p>
+<p>
+Some of these bugs are pretty minor and some people would rather
+have new features first.  But I'd rather fix the current
+foundation before building on it.  That's not to say features
+won't get added until after bug fixes;  sometimes it's just too
+tempting to code up a feature.
+</p>
+
+<h4>Medium term</h4>
+<p>
+Some features fit well into Synergy's current design and may simply
+enhance it's current capabilities.
+<ul>
+<li>Configurable hot key screen switching
+<li>Configurable hot key to lock to a screen
+<li>Configurable hot key to pop up a screen switch menu
+<li>Configure screen saver synchronization on or off
+<li>Graphical interface configuration and control on all platforms
+<li>Graphical status feedback on all platforms
+<li>More supported clipboard formats (particularly rich text)
+</ul>
+</p>
+
+<h4>Long term</h4>
+<p>
+Two features stand out as long term goals:
+<ul>
+<li>Support <span class="arg">N</span> computers on
+<span class="arg">M</span> monitors
+<li>Drag and drop across computers
+</ul>
+</p>
+<p>
+The first feature means sharing a monitor or monitors the way the
+keyboard and mouse are shared.  With this, Synergy would be a full
+KVM solution.  Not only would it support a few computers sharing
+one screen (still using the mouse to roll from one screen to
+another), but it should also support dozens of computers to provide
+a solution for server farm administrators.  In this capacity, it
+may need to support text (as opposed to bitmap graphics) screens.
+</p>
+<p>
+The second feature would enhance the unified desktop illusion.  It
+would make it possible to drag a file and possibly other objects
+to another screen.  The object would be copied (or moved).  I expect
+this to be a very tricky feature.
+</p>
+</body>
+</html>
diff -Nur synergy-1.3.1/lib/arch/CArchDaemonUnix.cpp synergy-bluetooth-0.1/lib/arch/CArchDaemonUnix.cpp
--- synergy-1.3.1/lib/arch/CArchDaemonUnix.cpp	2005-04-24 04:02:12.000000000 +0100
+++ synergy-bluetooth-0.1/lib/arch/CArchDaemonUnix.cpp	2009-04-24 10:17:36.000000000 +0100
@@ -19,6 +19,7 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <errno.h>
+#include <stdlib.h>
 
 //
 // CArchDaemonUnix
diff -Nur synergy-1.3.1/lib/arch/CArchNetworkBSD.cpp synergy-bluetooth-0.1/lib/arch/CArchNetworkBSD.cpp
--- synergy-1.3.1/lib/arch/CArchNetworkBSD.cpp	2006-04-02 05:26:57.000000000 +0100
+++ synergy-bluetooth-0.1/lib/arch/CArchNetworkBSD.cpp	2009-04-25 11:16:38.000000000 +0100
@@ -2,6 +2,9 @@
  * synergy -- mouse and keyboard sharing utility
  * Copyright (C) 2002 Chris Schoeneman
  * 
+ * Hacked to use Bluetooth RFCOMM sockets
+ * Copyright (C) 2009 Alistair Buxton
+ *
  * This package is free software you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  * found in the file COPYING that should have accompanied this file.
@@ -28,6 +31,12 @@
 #include <fcntl.h>
 #include <errno.h>
 #include <string.h>
+#include "CLog.h"
+
+#include <bluetooth/bluetooth.h>
+#include <bluetooth/rfcomm.h>
+#include <bluetooth/hci.h>
+#include <bluetooth/hci_lib.h>
 
 #if HAVE_POLL
 #	include <poll.h>
@@ -43,10 +52,14 @@
 #if !HAVE_INET_ATON
 #	include <stdio.h>
 #endif
+#include "ISocketFactory.h"
+#include <iostream>
+#include <cstdlib>
 
 static const int s_family[] = {
 	PF_UNSPEC,
-	PF_INET
+	PF_INET,
+	PF_BLUETOOTH
 };
 static const int s_type[] = {
 	SOCK_DGRAM,
@@ -76,6 +89,210 @@
 }
 #endif
 
+uint32_t service_uuid_int[] = { 0x0e92afb7, 0xaeca4c00, 0x950d6f96, 0xc3cd5b16 };
+
+sdp_session_t *CArchNetworkBSD::register_service(uint8_t rfcomm_channel)
+{
+    const char *service_name = "Synergy";
+    const char *service_dsc = "Mouse and keyboard sharing";
+    const char *service_prov = "Synergy";
+
+    uuid_t root_uuid, l2cap_uuid, rfcomm_uuid, svc_uuid;
+    sdp_list_t *l2cap_list = 0, 
+               *rfcomm_list = 0,
+               *root_list = 0,
+               *proto_list = 0, 
+               *access_proto_list = 0;
+    sdp_data_t *channel = 0, *psm = 0;
+
+    sdp_record_t *record = sdp_record_alloc();
+
+    // set the general service ID
+    sdp_uuid128_create( &svc_uuid, &service_uuid_int );
+    sdp_set_service_id( record, svc_uuid );
+
+    // make the service record publicly browsable
+    sdp_uuid16_create(&root_uuid, PUBLIC_BROWSE_GROUP);
+    root_list = sdp_list_append(0, &root_uuid);
+    sdp_set_browse_groups( record, root_list );
+
+    // set l2cap information
+    sdp_uuid16_create(&l2cap_uuid, L2CAP_UUID);
+    l2cap_list = sdp_list_append( 0, &l2cap_uuid );
+    proto_list = sdp_list_append( 0, l2cap_list );
+
+    // set rfcomm information
+    sdp_uuid16_create(&rfcomm_uuid, RFCOMM_UUID);
+    channel = sdp_data_alloc(SDP_UINT8, &rfcomm_channel);
+    rfcomm_list = sdp_list_append( 0, &rfcomm_uuid );
+    sdp_list_append( rfcomm_list, channel );
+    sdp_list_append( proto_list, rfcomm_list );
+
+    // attach protocol information to service record
+    access_proto_list = sdp_list_append( 0, proto_list );
+    sdp_set_access_protos( record, access_proto_list );
+
+    // set the name, provider, and description
+    sdp_set_info_attr(record, service_name, service_prov, service_dsc);
+
+    int err = 0;
+    sdp_session_t *session = 0;
+
+    // connect to the local SDP server, register the service record, and 
+    // disconnect
+    session = sdp_connect( BDADDR_ANY, BDADDR_LOCAL, SDP_RETRY_IF_BUSY );
+    err = sdp_record_register(session, record, 0);
+
+    // cleanup
+    sdp_data_free( channel );
+    sdp_list_free( l2cap_list, 0 );
+    sdp_list_free( rfcomm_list, 0 );
+    sdp_list_free( root_list, 0 );
+    sdp_list_free( access_proto_list, 0 );
+
+    return session;
+}
+
+CArchNetAddress CArchNetworkBSD::find_channel(CArchNetAddress addr) {
+	struct sockaddr_rc *Baddr = reinterpret_cast<struct sockaddr_rc*>(&addr->m_addr);
+	
+	LOG((CLOG_INFO "checking services on %s", addrToString(addr).c_str()));
+	
+	uuid_t svc_uuid;
+	int err;
+	sdp_list_t *response_list = NULL, *search_list, *attrid_list;
+	sdp_session_t *session = 0;
+
+	// connect to the SDP server running on the remote machine
+	session = sdp_connect( BDADDR_ANY, &Baddr->rc_bdaddr, SDP_RETRY_IF_BUSY );
+	if(!session) {
+		throwError(errno);
+	}
+
+	// specify the UUID of the application we're searching for
+	sdp_uuid128_create( &svc_uuid, &service_uuid_int );
+	search_list = sdp_list_append( NULL, &svc_uuid );
+
+	// specify that we want a list of all the matching applications' attributes
+	uint32_t range = 0x0000ffff;
+	attrid_list = sdp_list_append( NULL, &range );
+
+	// get a list of service records that have UUID 0xabcd
+	err = sdp_service_search_attr_req( session, search_list,
+		SDP_ATTR_REQ_RANGE, attrid_list, &response_list);
+
+	sdp_list_t *r = response_list;
+
+	// go through each of the service records
+	for (; r; r = r->next ) {
+	  sdp_record_t *rec = (sdp_record_t*) r->data;
+	  sdp_list_t *proto_list;
+	  
+	  // get a list of the protocol sequences
+	  if( sdp_get_access_protos( rec, &proto_list ) == 0 ) {
+	  sdp_list_t *p = proto_list;
+
+	  // go through each protocol sequence
+	  for( ; p ; p = p->next ) {
+		sdp_list_t *pds = (sdp_list_t*)p->data;
+
+		// go through each protocol list of the protocol sequence
+		for( ; pds ; pds = pds->next ) {
+
+		    // check the protocol attributes
+		    sdp_data_t *d = (sdp_data_t*)pds->data;
+		    int proto = 0;
+		    for( ; d; d = d->next ) {
+		        switch( d->dtd ) { 
+		            case SDP_UUID16:
+		            case SDP_UUID32:
+		            case SDP_UUID128:
+		                proto = sdp_uuid_to_proto( &d->val.uuid );
+		                break;
+		            case SDP_UINT8:
+		                if( proto == RFCOMM_UUID ) {
+		                		LOG((CLOG_INFO "Found synergy service on channel %d", d->val.int8));
+						Baddr->rc_channel = d->val.int8;
+		                }
+		                break;
+		        }
+		    }
+		}
+		sdp_list_free( (sdp_list_t*)p->data, 0 );
+	  }
+	  sdp_list_free( proto_list, 0 );
+	  }
+	  sdp_record_free( rec );
+	}
+
+	sdp_close(session);
+	if(Baddr->rc_channel == 0)
+		throw XArchNetwork("Synergy service not available on remote device");
+
+	return addr;
+}
+
+CArchNetAddress CArchNetworkBSD::find_service(CArchNetAddress addr) {
+	if(isAnyAddr(addr)) {
+		LOG((CLOG_INFO "Scanning for bluetooth devices..."));
+		inquiry_info *ii = NULL;
+		int max_rsp, num_rsp;
+		int dev_id, sock, len, flags;
+		int i;
+		char _addr[19] = { 0 };
+		char name[248] = { 0 };
+
+		dev_id = hci_get_route(NULL);
+		sock = hci_open_dev( dev_id );
+		if (dev_id < 0 || sock < 0) {
+			throwError(errno);
+		}
+
+		len  = 8;
+		max_rsp = 255;
+		flags = IREQ_CACHE_FLUSH;
+		ii = (inquiry_info*)malloc(max_rsp * sizeof(inquiry_info));
+		
+		CArchNetAddress temp_addr = copyAddr(addr);
+		struct sockaddr_rc *temp_baddr = reinterpret_cast<struct sockaddr_rc*>(&temp_addr->m_addr);
+
+		num_rsp = hci_inquiry(dev_id, len, max_rsp, NULL, &ii, flags);
+		if( num_rsp < 0 ) perror("hci_inquiry");
+
+		for (i = 0; i < num_rsp; i++) {
+			ba2str(&(ii+i)->bdaddr, _addr);
+			memset(name, 0, sizeof(name));
+			if (hci_read_remote_name(sock, &(ii+i)->bdaddr, sizeof(name), 
+			name, 0) < 0)
+			strcpy(name, "[unknown]");
+			LOG((CLOG_INFO "Found device: %s %s", _addr, name));
+
+			try {
+				temp_baddr->rc_bdaddr = (ii+i)->bdaddr;
+				find_channel(temp_addr);
+			} 
+			catch(...) {
+				continue;
+			}
+			//found a device
+			*addr = *temp_addr;
+			break;
+		}
+		
+		delete temp_addr;
+		free( ii );
+		hci_close_dev(sock);		
+		
+		if(isAnyAddr(addr)) {
+			throw XArchNetwork("No devices with synergy service found");
+		}
+		
+		return addr;
+
+	} else 
+		return find_channel(addr);
+}
+
 //
 // CArchNetworkBSD
 //
@@ -84,6 +301,7 @@
 {
 	// create mutex to make some calls thread safe
 	m_mutex = ARCH->newMutex();
+	sdp_session = NULL;
 }
 
 CArchNetworkBSD::~CArchNetworkBSD()
@@ -94,8 +312,23 @@
 CArchSocket
 CArchNetworkBSD::newSocket(EAddressFamily family, ESocketType type)
 {
+	int fd;
 	// create socket
-	int fd = socket(s_family[family], s_type[type], 0);
+	switch(family) {
+	case kINET: {
+		fd = socket(s_family[family], s_type[type], 0);
+		break;
+	}
+	case kBLUETOOTH: {
+		fd = socket(s_family[family], s_type[type], BTPROTO_RFCOMM);
+		break;
+	}
+	default: {
+		assert(0 && "unknown address family");
+		return NULL;
+	}
+	}
+
 	if (fd == -1) {
 		throwError(errno);
 	}
@@ -106,6 +339,14 @@
 		close(fd);
 		throw;
 	}
+	if(family == kBLUETOOTH) {
+		int opt = 0;
+		opt |= RFCOMM_LM_AUTH;
+		opt |= RFCOMM_LM_ENCRYPT;
+		opt |= RFCOMM_LM_SECURE;
+
+		setsockopt(fd, SOL_RFCOMM, RFCOMM_LM, &opt, sizeof(opt));
+	}
 
 	// allocate socket object
 	CArchSocketImpl* newSocket = new CArchSocketImpl;
@@ -131,6 +372,8 @@
 {
 	assert(s != NULL);
 
+	if(sdp_session != NULL) sdp_close(sdp_session);
+
 	// unref the socket and note if it should be released
 	ARCH->lockMutex(m_mutex);
 	const bool doClose = (--s->m_refCount == 0);
@@ -194,6 +437,16 @@
 	if (listen(s->m_fd, 3) == -1) {
 		throwError(errno);
 	}
+
+	if(ISocketFactory::GetType() == kBLUETOOTH) {
+		struct sockaddr Addr;
+		memset(&Addr, 0, sizeof(Addr));
+		socklen_t size = sizeof(Addr);
+		getsockname(s->m_fd, &Addr, &size);
+		struct sockaddr_rc* BAddr =
+			reinterpret_cast<struct sockaddr_rc*>(&Addr);
+		register_service((uint8_t)BAddr->rc_channel);
+	}
 }
 
 CArchSocket
@@ -253,6 +506,10 @@
 	assert(s    != NULL);
 	assert(addr != NULL);
 
+	if(ISocketFactory::GetType() == kBLUETOOTH) {
+		addr = find_service(addr);
+	}
+
 	if (connect(s->m_fd, &addr->m_addr, addr->m_len) == -1) {
 		if (errno == EISCONN) {
 			return true;
@@ -564,23 +821,26 @@
 CArchNetworkBSD::setNoDelayOnSocket(CArchSocket s, bool noDelay)
 {
 	assert(s != NULL);
+	if(ISocketFactory::GetType() == kINET) {
+		// get old state
+		int oflag;
+		socklen_t size = sizeof(oflag);
+		if (getsockopt(s->m_fd, IPPROTO_TCP, TCP_NODELAY,
+								(optval_t*)&oflag, &size) == -1) {
+			throwError(errno);
+		}
 
-	// get old state
-	int oflag;
-	socklen_t size = sizeof(oflag);
-	if (getsockopt(s->m_fd, IPPROTO_TCP, TCP_NODELAY,
-							(optval_t*)&oflag, &size) == -1) {
-		throwError(errno);
-	}
-
-	int flag = noDelay ? 1 : 0;
-	size     = sizeof(flag);
-	if (setsockopt(s->m_fd, IPPROTO_TCP, TCP_NODELAY,
-							(optval_t*)&flag, size) == -1) {
-		throwError(errno);
-	}
+		int flag = noDelay ? 1 : 0;
+		size     = sizeof(flag);
+		if (setsockopt(s->m_fd, IPPROTO_TCP, TCP_NODELAY,
+								(optval_t*)&flag, size) == -1) {
+			throwError(errno);
+		}
 
-	return (oflag != 0);
+		return (oflag != 0);
+	
+	} else return true;
+		
 }
 
 bool
@@ -636,6 +896,15 @@
 		addr->m_len                = sizeof(struct sockaddr_in);
 		break;
 	}
+	case kBLUETOOTH: {
+		struct sockaddr_rc* BAddr =
+			reinterpret_cast<struct sockaddr_rc*>(&addr->m_addr);
+		BAddr->rc_family         = AF_BLUETOOTH;
+		BAddr->rc_bdaddr	    = ((bdaddr_t) {{0, 0, 0, 0, 0, 0}});
+		BAddr->rc_channel	= (uint8_t) 0;
+		addr->m_len                = sizeof(struct sockaddr_rc);
+		break;
+	}
 
 	default:
 		delete addr;
@@ -660,46 +929,65 @@
 	// allocate address
 	CArchNetAddressImpl* addr = new CArchNetAddressImpl;
 
-	// try to convert assuming an IPv4 dot notation address
-	struct sockaddr_in inaddr;
-	memset(&inaddr, 0, sizeof(inaddr));
-	if (inet_aton(name.c_str(), &inaddr.sin_addr) != 0) {
-		// it's a dot notation address
-		addr->m_len       = sizeof(struct sockaddr_in);
-		inaddr.sin_family = AF_INET;
-		inaddr.sin_port   = 0;
-		memcpy(&addr->m_addr, &inaddr, addr->m_len);
-	}
-
-	else {
-		// mutexed address lookup (ugh)
-		ARCH->lockMutex(m_mutex);
-		struct hostent* info = gethostbyname(name.c_str());
-		if (info == NULL) {
-			ARCH->unlockMutex(m_mutex);
-			delete addr;
-			throwNameError(h_errno);
-		}
-
-		// copy over address (only IPv4 currently supported)
-		if (info->h_addrtype == AF_INET) {
+	if(ISocketFactory::GetType() == kINET) {
+		// try to convert assuming an IPv4 dot notation address
+		struct sockaddr_in inaddr;
+		memset(&inaddr, 0, sizeof(inaddr));
+		if (inet_aton(name.c_str(), &inaddr.sin_addr) != 0) {
+			// it's a dot notation address
 			addr->m_len       = sizeof(struct sockaddr_in);
-			inaddr.sin_family = info->h_addrtype;
+			inaddr.sin_family = AF_INET;
 			inaddr.sin_port   = 0;
-			memcpy(&inaddr.sin_addr, info->h_addr_list[0],
-								sizeof(inaddr.sin_addr));
 			memcpy(&addr->m_addr, &inaddr, addr->m_len);
 		}
+
 		else {
+			// mutexed address lookup (ugh)
+			ARCH->lockMutex(m_mutex);
+			struct hostent* info = gethostbyname(name.c_str());
+			if (info == NULL) {
+				ARCH->unlockMutex(m_mutex);
+				delete addr;
+				throwNameError(h_errno);
+			}
+
+			// copy over address (only IPv4 currently supported)
+			if (info->h_addrtype == AF_INET) {
+				addr->m_len       = sizeof(struct sockaddr_in);
+				inaddr.sin_family = info->h_addrtype;
+				inaddr.sin_port   = 0;
+				memcpy(&inaddr.sin_addr, info->h_addr_list[0],
+									sizeof(inaddr.sin_addr));
+				memcpy(&addr->m_addr, &inaddr, addr->m_len);
+			}
+			else {
+				ARCH->unlockMutex(m_mutex);
+				delete addr;
+				throw XArchNetworkNameUnsupported(
+						"The requested name is valid but "
+						"does not have a supported address family");
+			}
+
+			// done with static buffer
+			ARCH->unlockMutex(m_mutex);
+		}
+	} else {
+		
+		struct sockaddr_rc inaddr;
+		memset(&inaddr, 0, sizeof(inaddr));
+		if(str2ba(name.c_str(), &inaddr.rc_bdaddr) == 0) {
+			addr->m_len = sizeof(struct sockaddr_rc);
+			inaddr.rc_family = AF_BLUETOOTH;
+			inaddr.rc_channel = (uint8_t) 0;
+			memcpy(&addr->m_addr, &inaddr, addr->m_len);
+		
+		} else {
 			ARCH->unlockMutex(m_mutex);
 			delete addr;
 			throw XArchNetworkNameUnsupported(
 					"The requested name is valid but "
 					"does not have a supported address family");
 		}
-
-		// done with static buffer
-		ARCH->unlockMutex(m_mutex);
 	}
 
 	return addr;
@@ -717,24 +1005,44 @@
 CArchNetworkBSD::addrToName(CArchNetAddress addr)
 {
 	assert(addr != NULL);
+	switch(getAddrFamily(addr)) {
+	case kINET: {
+		// mutexed name lookup (ugh)
+		ARCH->lockMutex(m_mutex);
+		struct hostent* info = gethostbyaddr(
+				reinterpret_cast<const char*>(&addr->m_addr),
+				addr->m_len, addr->m_addr.sa_family);
+		if (info == NULL) {
+			ARCH->unlockMutex(m_mutex);
+			throwNameError(h_errno);
+		}
 
-	// mutexed name lookup (ugh)
-	ARCH->lockMutex(m_mutex);
-	struct hostent* info = gethostbyaddr(
-							reinterpret_cast<const char*>(&addr->m_addr),
-							addr->m_len, addr->m_addr.sa_family);
-	if (info == NULL) {
+		// save (primary) name
+		std::string name = info->h_name;
+
+		// done with static buffer
 		ARCH->unlockMutex(m_mutex);
-		throwNameError(h_errno);
+		return name;
 	}
+	case kBLUETOOTH: {
+		int sock = hci_open_dev( hci_get_route( NULL ) );
+		struct sockaddr_rc *baddr = reinterpret_cast<sockaddr_rc*>(&addr->m_addr);
 
-	// save (primary) name
-	std::string name = info->h_name;
+		char cname[256] = "00:00:00:00:00:00";
+		if(hci_read_remote_name(sock, &baddr->rc_bdaddr, 255, 
+                         cname, 3000))
+			return addrToString(addr);
 
-	// done with static buffer
-	ARCH->unlockMutex(m_mutex);
+		close(sock);
 
-	return name;
+		std::string name = cname;
+		return name;
+	}
+
+	default:
+		assert(0 && "unknown address family");
+		return "";
+	}
 }
 
 std::string
@@ -751,6 +1059,13 @@
 		ARCH->unlockMutex(m_mutex);
 		return s;
 	}
+	case kBLUETOOTH: {
+		struct sockaddr_rc *baddr = reinterpret_cast<sockaddr_rc*>(&addr->m_addr);
+		char cstr[18] = "00:00:00:00:00:00";
+		ba2str(&baddr->rc_bdaddr, cstr);
+		std::string s = cstr;
+		return s;
+	}
 
 	default:
 		assert(0 && "unknown address family");
@@ -766,6 +1081,8 @@
 	switch (addr->m_addr.sa_family) {
 	case AF_INET:
 		return kINET;
+	case AF_BLUETOOTH:
+		return kBLUETOOTH;
 
 	default:
 		return kUNKNOWN;
@@ -784,6 +1101,12 @@
 		ipAddr->sin_port = htons(port);
 		break;
 	}
+	case kBLUETOOTH: {
+		struct sockaddr_rc* ipAddr =
+			reinterpret_cast<struct sockaddr_rc*>(&addr->m_addr);
+		ipAddr->rc_channel = (uint8_t) 0;
+		break;
+	}
 
 	default:
 		assert(0 && "unknown address family");
@@ -802,6 +1125,11 @@
 			reinterpret_cast<struct sockaddr_in*>(&addr->m_addr);
 		return ntohs(ipAddr->sin_port);
 	}
+	case kBLUETOOTH: {
+		struct sockaddr_rc* ipAddr =
+			reinterpret_cast<struct sockaddr_rc*>(&addr->m_addr);
+		return ipAddr->rc_channel;
+	}
 
 	default:
 		assert(0 && "unknown address family");
@@ -821,6 +1149,18 @@
 		return (ipAddr->sin_addr.s_addr == INADDR_ANY &&
 				addr->m_len == sizeof(struct sockaddr_in));
 	}
+	case kBLUETOOTH: {
+		struct sockaddr_rc* BAddr =
+			reinterpret_cast<struct sockaddr_rc*>(&addr->m_addr);
+		char *a, *b;
+		int n;
+		a = (char*)&BAddr->rc_bdaddr;
+		b = (char*)(&(bdaddr_t){{0,0,0,0,0,0}});
+		for(n=0;n<6;n++) {
+			if(a[n]!=b[n]) return false;
+		}
+		return (addr->m_len == sizeof(struct sockaddr_rc));
+	}
 
 	default:
 		assert(0 && "unknown address family");
@@ -970,3 +1310,5 @@
 		throw XArchNetworkName(s_msg[4]);
 	}
 }
+
+
diff -Nur synergy-1.3.1/lib/arch/CArchNetworkBSD.h synergy-bluetooth-0.1/lib/arch/CArchNetworkBSD.h
--- synergy-1.3.1/lib/arch/CArchNetworkBSD.h	2005-05-08 18:26:20.000000000 +0100
+++ synergy-bluetooth-0.1/lib/arch/CArchNetworkBSD.h	2009-04-24 22:20:53.000000000 +0100
@@ -23,6 +23,8 @@
 #if HAVE_SYS_SOCKET_H
 #	include <sys/socket.h>
 #endif
+#include <bluetooth/sdp.h>
+#include <bluetooth/sdp_lib.h>
 
 #if !HAVE_SOCKLEN_T
 typedef int socklen_t;
@@ -94,8 +96,13 @@
 	void				throwError(int);
 	void				throwNameError(int);
 
+	sdp_session_t 			*register_service(uint8_t rfcomm_channel);
+	CArchNetAddress 		find_channel(CArchNetAddress addr);
+	CArchNetAddress 		find_service(CArchNetAddress addr);
+
 private:
 	CArchMutex			m_mutex;
+	sdp_session_t *			sdp_session;
 };
 
 #endif
diff -Nur synergy-1.3.1/lib/arch/CMultibyte.cpp synergy-bluetooth-0.1/lib/arch/CMultibyte.cpp
--- synergy-1.3.1/lib/arch/CMultibyte.cpp	2005-11-30 04:33:24.000000000 +0000
+++ synergy-bluetooth-0.1/lib/arch/CMultibyte.cpp	2009-04-24 10:17:36.000000000 +0100
@@ -19,6 +19,7 @@
 #include "CArch.h"
 #include <limits.h>
 #include <string.h>
+#include <cstdlib>
 #if HAVE_LOCALE_H
 #	include <locale.h>
 #endif
diff -Nur synergy-1.3.1/lib/arch/IArchNetwork.h synergy-bluetooth-0.1/lib/arch/IArchNetwork.h
--- synergy-1.3.1/lib/arch/IArchNetwork.h	2005-05-08 18:23:38.000000000 +0100
+++ synergy-bluetooth-0.1/lib/arch/IArchNetwork.h	2009-04-24 13:12:37.000000000 +0100
@@ -61,6 +61,7 @@
 	enum EAddressFamily {
 		kUNKNOWN,
 		kINET,
+		kBLUETOOTH,
 	};
 
 	//! Supported socket types
diff -Nur synergy-1.3.1/lib/base/CStringUtil.cpp synergy-bluetooth-0.1/lib/base/CStringUtil.cpp
--- synergy-1.3.1/lib/base/CStringUtil.cpp	2005-12-14 17:25:20.000000000 +0000
+++ synergy-bluetooth-0.1/lib/base/CStringUtil.cpp	2009-04-24 10:17:36.000000000 +0100
@@ -18,6 +18,7 @@
 #include "stdvector.h"
 #include <cctype>
 #include <cstdio>
+#include <string.h>
 #include <cstdlib>
 #include <algorithm>
 
diff -Nur synergy-1.3.1/lib/client/CClient.cpp synergy-bluetooth-0.1/lib/client/CClient.cpp
--- synergy-1.3.1/lib/client/CClient.cpp	2006-03-09 04:07:17.000000000 +0000
+++ synergy-bluetooth-0.1/lib/client/CClient.cpp	2009-04-24 10:17:36.000000000 +0100
@@ -26,6 +26,8 @@
 #include "CLog.h"
 #include "IEventQueue.h"
 #include "TMethodEventJob.h"
+#include <malloc.h>
+#include <string.h>
 
 //
 // CClient
diff -Nur synergy-1.3.1/lib/client/CServerProxy.cpp synergy-bluetooth-0.1/lib/client/CServerProxy.cpp
--- synergy-1.3.1/lib/client/CServerProxy.cpp	2006-04-02 02:47:03.000000000 +0100
+++ synergy-bluetooth-0.1/lib/client/CServerProxy.cpp	2009-04-24 10:17:36.000000000 +0100
@@ -24,6 +24,7 @@
 #include "TMethodEventJob.h"
 #include "XBase.h"
 #include <memory>
+#include <string.h>
 
 //
 // CServerProxy
diff -Nur synergy-1.3.1/lib/net/CNetworkAddress.cpp synergy-bluetooth-0.1/lib/net/CNetworkAddress.cpp
--- synergy-1.3.1/lib/net/CNetworkAddress.cpp	2005-04-24 04:02:15.000000000 +0100
+++ synergy-bluetooth-0.1/lib/net/CNetworkAddress.cpp	2009-04-24 17:47:44.000000000 +0100
@@ -13,6 +13,7 @@
  */
 
 #include "CNetworkAddress.h"
+#include "ISocketFactory.h"
 #include "XSocket.h"
 #include "CArch.h"
 #include "XArch.h"
@@ -39,7 +40,10 @@
 	m_port(port)
 {
 	checkPort();
-	m_address = ARCH->newAnyAddr(IArchNetwork::kINET);
+	if(ISocketFactory::GetType() == IArchNetwork::kINET)
+		m_address = ARCH->newAnyAddr(IArchNetwork::kINET);
+	else
+		m_address = ARCH->newAnyAddr(IArchNetwork::kBLUETOOTH);
 	ARCH->setAddrPort(m_address, m_port);
 }
 
@@ -56,6 +60,7 @@
 	m_hostname(hostname),
 	m_port(port)
 {
+	return; // TODO: implement detecting BD addresses
 	// check for port suffix
 	CString::size_type i = m_hostname.rfind(':');
 	if (i != CString::npos && i + 1 < m_hostname.size()) {
@@ -139,7 +144,10 @@
 		// if hostname is empty then use wildcard address otherwise look
 		// up the name.
 		if (m_hostname.empty()) {
-			m_address = ARCH->newAnyAddr(IArchNetwork::kINET);
+			if(ISocketFactory::GetType() == IArchNetwork::kINET)
+				m_address = ARCH->newAnyAddr(IArchNetwork::kINET);
+			else
+				m_address = ARCH->newAnyAddr(IArchNetwork::kBLUETOOTH);
 		}
 		else {
 			m_address = ARCH->nameToAddr(m_hostname);
diff -Nur synergy-1.3.1/lib/net/CTCPListenSocket.cpp synergy-bluetooth-0.1/lib/net/CTCPListenSocket.cpp
--- synergy-1.3.1/lib/net/CTCPListenSocket.cpp	2005-05-08 18:57:23.000000000 +0100
+++ synergy-bluetooth-0.1/lib/net/CTCPListenSocket.cpp	2009-04-24 17:00:55.000000000 +0100
@@ -24,16 +24,30 @@
 #include "IEventQueue.h"
 #include "CArch.h"
 #include "XArch.h"
-
+#include "CLog.h"
+#include "ISocketFactory.h"
 //
 // CTCPListenSocket
 //
 
 CTCPListenSocket::CTCPListenSocket()
 {
+	LOG((CLOG_INFO "create ctcp listen sock. Type: %d", ISocketFactory::GetType()));
 	m_mutex = new CMutex;
 	try {
-		m_socket = ARCH->newSocket(IArchNetwork::kINET, IArchNetwork::kSTREAM);
+		switch(ISocketFactory::GetType()) {
+		case IArchNetwork::kINET:
+			m_socket = ARCH->newSocket(IArchNetwork::kINET, IArchNetwork::kSTREAM);
+			break;
+		
+		case IArchNetwork::kBLUETOOTH:
+			m_socket = ARCH->newSocket(IArchNetwork::kBLUETOOTH, IArchNetwork::kSTREAM);
+			break;
+		
+		case IArchNetwork::kUNKNOWN:
+			assert(true);
+			break;
+		}
 	}
 	catch (XArchNetwork& e) {
 		throw XSocketCreate(e.what());
diff -Nur synergy-1.3.1/lib/net/CTCPSocket.cpp synergy-bluetooth-0.1/lib/net/CTCPSocket.cpp
--- synergy-1.3.1/lib/net/CTCPSocket.cpp	2006-04-02 02:47:03.000000000 +0100
+++ synergy-bluetooth-0.1/lib/net/CTCPSocket.cpp	2009-04-24 17:00:55.000000000 +0100
@@ -24,7 +24,8 @@
 #include "CArch.h"
 #include "XArch.h"
 #include <string.h>
-
+#include <malloc.h>
+#include "ISocketFactory.h"
 //
 // CTCPSocket
 //
@@ -34,7 +35,19 @@
 	m_flushed(&m_mutex, true)
 {
 	try {
-		m_socket = ARCH->newSocket(IArchNetwork::kINET, IArchNetwork::kSTREAM);
+		switch(ISocketFactory::GetType()) {
+		case IArchNetwork::kINET:
+			m_socket = ARCH->newSocket(IArchNetwork::kINET, IArchNetwork::kSTREAM);
+			break;
+		
+		case IArchNetwork::kBLUETOOTH:
+			m_socket = ARCH->newSocket(IArchNetwork::kBLUETOOTH, IArchNetwork::kSTREAM);
+			break;
+		
+		case IArchNetwork::kUNKNOWN:
+			assert(true);
+			break;
+		}
 	}
 	catch (XArchNetwork& e) {
 		throw XSocketCreate(e.what());
diff -Nur synergy-1.3.1/lib/net/ISocketFactory.cpp synergy-bluetooth-0.1/lib/net/ISocketFactory.cpp
--- synergy-1.3.1/lib/net/ISocketFactory.cpp	1970-01-01 01:00:00.000000000 +0100
+++ synergy-bluetooth-0.1/lib/net/ISocketFactory.cpp	2009-04-24 17:00:55.000000000 +0100
@@ -0,0 +1,24 @@
+/*
+ * synergy -- mouse and keyboard sharing utility
+ * Copyright (C) 2009 Valmantas Palikša
+ * 
+ * This package is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * found in the file COPYING that should have accompanied this file.
+ * 
+ * This package is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+ 
+#include "ISocketFactory.h"
+IArchNetwork::EAddressFamily ISocketFactory::type = IArchNetwork::kINET;
+
+void ISocketFactory::SetType(IArchNetwork::EAddressFamily new_type) {
+	type = new_type;
+}
+
+IArchNetwork::EAddressFamily ISocketFactory::GetType() {
+	return type;	
+}
diff -Nur synergy-1.3.1/lib/net/ISocketFactory.h synergy-bluetooth-0.1/lib/net/ISocketFactory.h
--- synergy-1.3.1/lib/net/ISocketFactory.h	2005-04-24 04:02:15.000000000 +0100
+++ synergy-bluetooth-0.1/lib/net/ISocketFactory.h	2009-04-24 17:00:55.000000000 +0100
@@ -16,6 +16,7 @@
 #define ISOCKETFACTORY_H
 
 #include "IInterface.h"
+#include "IArchNetwork.h"
 
 class IDataSocket;
 class IListenSocket;
@@ -30,12 +31,17 @@
 	//! @name accessors
 	//@{
 
+	static void SetType(IArchNetwork::EAddressFamily);
+	static IArchNetwork::EAddressFamily GetType();
+
 	//! Create data socket
 	virtual IDataSocket*	create() const = 0;
 
 	//! Create listen socket
 	virtual IListenSocket*	createListen() const = 0;
 
+protected:	
+	static IArchNetwork::EAddressFamily type;
 	//@}
 };
 
diff -Nur synergy-1.3.1/lib/platform/CXWindowsScreen.cpp synergy-bluetooth-0.1/lib/platform/CXWindowsScreen.cpp
--- synergy-1.3.1/lib/platform/CXWindowsScreen.cpp	2006-04-02 20:16:39.000000000 +0100
+++ synergy-bluetooth-0.1/lib/platform/CXWindowsScreen.cpp	2009-04-24 10:17:36.000000000 +0100
@@ -26,6 +26,8 @@
 #include "CStringUtil.h"
 #include "IEventQueue.h"
 #include "TMethodEventJob.h"
+#include <malloc.h>
+#include <stdlib.h>
 #include <cstring>
 #if X_DISPLAY_MISSING
 #	error X11 is required to build synergy
diff -Nur synergy-1.3.1/lib/server/CClientProxy1_3.cpp synergy-bluetooth-0.1/lib/server/CClientProxy1_3.cpp
--- synergy-1.3.1/lib/server/CClientProxy1_3.cpp	2006-02-12 19:53:43.000000000 +0000
+++ synergy-bluetooth-0.1/lib/server/CClientProxy1_3.cpp	2009-04-24 10:17:36.000000000 +0100
@@ -17,7 +17,7 @@
 #include "CLog.h"
 #include "IEventQueue.h"
 #include "TMethodEventJob.h"
-
+#include <string.h>
 //
 // CClientProxy1_3
 //
diff -Nur synergy-1.3.1/lib/server/CServer.cpp synergy-bluetooth-0.1/lib/server/CServer.cpp
--- synergy-1.3.1/lib/server/CServer.cpp	2006-04-02 02:47:04.000000000 +0100
+++ synergy-bluetooth-0.1/lib/server/CServer.cpp	2009-04-24 10:17:36.000000000 +0100
@@ -29,7 +29,7 @@
 #include "TMethodEventJob.h"
 #include "CArch.h"
 #include <string.h>
-
+#include <malloc.h>
 //
 // CServer
 //
diff -Nur synergy-1.3.1/lib/synergy/CPacketStreamFilter.cpp synergy-bluetooth-0.1/lib/synergy/CPacketStreamFilter.cpp
--- synergy-1.3.1/lib/synergy/CPacketStreamFilter.cpp	2005-04-24 04:02:16.000000000 +0100
+++ synergy-bluetooth-0.1/lib/synergy/CPacketStreamFilter.cpp	2009-04-24 10:17:36.000000000 +0100
@@ -15,6 +15,7 @@
 #include "CPacketStreamFilter.h"
 #include "IEventQueue.h"
 #include "CLock.h"
+#include <string.h>
 #include "TMethodEventJob.h"
 
 //
diff -Nur synergy-1.3.1/lib/synergy/IKeyState.cpp synergy-bluetooth-0.1/lib/synergy/IKeyState.cpp
--- synergy-1.3.1/lib/synergy/IKeyState.cpp	2006-03-22 05:40:27.000000000 +0000
+++ synergy-bluetooth-0.1/lib/synergy/IKeyState.cpp	2009-04-24 10:17:36.000000000 +0100
@@ -14,6 +14,7 @@
 
 #include "IKeyState.h"
 #include <string.h>
+#include <malloc.h>
 
 //
 // IKeyState
diff -Nur synergy-1.3.1/lib/synergy/IPrimaryScreen.cpp synergy-bluetooth-0.1/lib/synergy/IPrimaryScreen.cpp
--- synergy-1.3.1/lib/synergy/IPrimaryScreen.cpp	2006-03-22 05:40:27.000000000 +0000
+++ synergy-bluetooth-0.1/lib/synergy/IPrimaryScreen.cpp	2009-04-24 10:17:36.000000000 +0100
@@ -13,7 +13,7 @@
  */
 
 #include "IPrimaryScreen.h"
-
+#include <malloc.h>
 //
 // IPrimaryScreen
 //
Download as text