session.c (124305) | session.c (124317) |
---|---|
1/* 2 * session.c 3 * 4 * Copyright (c) 2001-2003 Maksim Yevmenkin <m_evmenkin@yahoo.com> 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 12 unchanged lines hidden (view full) --- 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * 28 * $Id: session.c,v 1.2 2003/09/04 22:12:13 max Exp $ | 1/* 2 * session.c 3 * 4 * Copyright (c) 2001-2003 Maksim Yevmenkin <m_evmenkin@yahoo.com> 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 12 unchanged lines hidden (view full) --- 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * 28 * $Id: session.c,v 1.2 2003/09/04 22:12:13 max Exp $ |
29 * $FreeBSD: head/lib/libsdp/session.c 124305 2004-01-09 18:19:12Z emax $ | 29 * $FreeBSD: head/lib/libsdp/session.c 124317 2004-01-09 22:44:28Z emax $ |
30 */ 31 32#include <bluetooth.h> 33#include <errno.h> 34#include <stdlib.h> 35#include <string.h> 36#include <unistd.h> 37 --- 59 unchanged lines hidden (view full) --- 97 } 98 ss->rsp_e = ss->rsp + ss->imtu; 99 ss->error = 0; 100fail: 101 return ((void *) ss); 102} 103 104void * | 30 */ 31 32#include <bluetooth.h> 33#include <errno.h> 34#include <stdlib.h> 35#include <string.h> 36#include <unistd.h> 37 --- 59 unchanged lines hidden (view full) --- 97 } 98 ss->rsp_e = ss->rsp + ss->imtu; 99 ss->error = 0; 100fail: 101 return ((void *) ss); 102} 103 104void * |
105sdp_open_local(void) | 105sdp_open_local(char const *control) |
106{ 107 sdp_session_p ss = NULL; 108 struct sockaddr_un sa; 109 110 if ((ss = calloc(1, sizeof(*ss))) == NULL) 111 goto fail; 112 113 ss->s = socket(PF_UNIX, SOCK_STREAM, 0); 114 if (ss->s < 0) { 115 ss->error = errno; 116 goto fail; 117 } 118 | 106{ 107 sdp_session_p ss = NULL; 108 struct sockaddr_un sa; 109 110 if ((ss = calloc(1, sizeof(*ss))) == NULL) 111 goto fail; 112 113 ss->s = socket(PF_UNIX, SOCK_STREAM, 0); 114 if (ss->s < 0) { 115 ss->error = errno; 116 goto fail; 117 } 118 |
119 if (control == NULL) 120 control = SDP_LOCAL_PATH; 121 |
|
119 sa.sun_len = sizeof(sa); 120 sa.sun_family = AF_UNIX; | 122 sa.sun_len = sizeof(sa); 123 sa.sun_family = AF_UNIX; |
121 strlcpy(sa.sun_path, SDP_LOCAL_PATH, sizeof(sa.sun_path)); | 124 strlcpy(sa.sun_path, control, sizeof(sa.sun_path)); |
122 123 if (connect(ss->s, (struct sockaddr *) &sa, sizeof(sa)) < 0) { 124 ss->error = errno; 125 goto fail; 126 } 127 128 ss->flags |= SDP_SESSION_LOCAL; 129 ss->imtu = ss->omtu = SDP_LOCAL_MTU; --- 45 unchanged lines hidden --- | 125 126 if (connect(ss->s, (struct sockaddr *) &sa, sizeof(sa)) < 0) { 127 ss->error = errno; 128 goto fail; 129 } 130 131 ss->flags |= SDP_SESSION_LOCAL; 132 ss->imtu = ss->omtu = SDP_LOCAL_MTU; --- 45 unchanged lines hidden --- |