summaryrefslogtreecommitdiffstats
path: root/sesman/libscp/libscp_tcp.c
diff options
context:
space:
mode:
authorLaxmikant Rashinkar <LK.Rashinkar@gmail.com>2012-09-19 20:51:34 -0700
committerLaxmikant Rashinkar <LK.Rashinkar@gmail.com>2012-09-19 20:51:34 -0700
commit1123323fda6d128fb98b0427e0ea5f6a2dc9e632 (patch)
tree3407a3771a069f812554312ce7c36db625139cc2 /sesman/libscp/libscp_tcp.c
parent3cedfae76a2351bc8b1e5bd2ee33bbf8630dbacf (diff)
downloadxrdp-proprietary-1123323fda6d128fb98b0427e0ea5f6a2dc9e632.tar.gz
xrdp-proprietary-1123323fda6d128fb98b0427e0ea5f6a2dc9e632.zip
o moved from GNU General Public License to Apache License, Version 2.0
o applied new coding standards to all .c files o moved some files around
Diffstat (limited to 'sesman/libscp/libscp_tcp.c')
-rw-r--r--sesman/libscp/libscp_tcp.c178
1 files changed, 89 insertions, 89 deletions
diff --git a/sesman/libscp/libscp_tcp.c b/sesman/libscp/libscp_tcp.c
index 459992fe..29870563 100644
--- a/sesman/libscp/libscp_tcp.c
+++ b/sesman/libscp/libscp_tcp.c
@@ -1,21 +1,20 @@
-/*
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program 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.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- xrdp: A Remote Desktop Protocol server.
- Copyright (C) Jay Sorg 2005-2010
-*/
+/**
+ * xrdp: A Remote Desktop Protocol server.
+ *
+ * Copyright (C) Jay Sorg 2004-2012
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
/**
*
@@ -33,102 +32,103 @@
#include <stdlib.h>
#include <string.h>
-extern struct log_config* s_log;
+extern struct log_config *s_log;
/*****************************************************************************/
int DEFAULT_CC
-scp_tcp_force_recv(int sck, char* data, int len)
+scp_tcp_force_recv(int sck, char *data, int len)
{
- int rcvd;
- int block;
+ int rcvd;
+ int block;
- LOG_DBG("scp_tcp_force_recv()");
- block = scp_lock_fork_critical_section_start();
+ LOG_DBG("scp_tcp_force_recv()");
+ block = scp_lock_fork_critical_section_start();
- while (len > 0)
- {
- rcvd = g_tcp_recv(sck, data, len, 0);
- if (rcvd == -1)
+ while (len > 0)
{
- if (g_tcp_last_error_would_block(sck))
- {
- g_sleep(1);
- }
- else
- {
- scp_lock_fork_critical_section_end(block);
- return 1;
- }
+ rcvd = g_tcp_recv(sck, data, len, 0);
+
+ if (rcvd == -1)
+ {
+ if (g_tcp_last_error_would_block(sck))
+ {
+ g_sleep(1);
+ }
+ else
+ {
+ scp_lock_fork_critical_section_end(block);
+ return 1;
+ }
+ }
+ else if (rcvd == 0)
+ {
+ scp_lock_fork_critical_section_end(block);
+ return 1;
+ }
+ else
+ {
+ data += rcvd;
+ len -= rcvd;
+ }
}
- else if (rcvd == 0)
- {
- scp_lock_fork_critical_section_end(block);
- return 1;
- }
- else
- {
- data += rcvd;
- len -= rcvd;
- }
- }
- scp_lock_fork_critical_section_end(block);
+ scp_lock_fork_critical_section_end(block);
- return 0;
+ return 0;
}
/*****************************************************************************/
int DEFAULT_CC
-scp_tcp_force_send(int sck, char* data, int len)
+scp_tcp_force_send(int sck, char *data, int len)
{
- int sent;
- int block;
+ int sent;
+ int block;
- LOG_DBG("scp_tcp_force_send()");
- block = scp_lock_fork_critical_section_start();
+ LOG_DBG("scp_tcp_force_send()");
+ block = scp_lock_fork_critical_section_start();
- while (len > 0)
- {
- sent = g_tcp_send(sck, data, len, 0);
- if (sent == -1)
+ while (len > 0)
{
- if (g_tcp_last_error_would_block(sck))
- {
- g_sleep(1);
- }
- else
- {
- scp_lock_fork_critical_section_end(block);
- return 1;
- }
+ sent = g_tcp_send(sck, data, len, 0);
+
+ if (sent == -1)
+ {
+ if (g_tcp_last_error_would_block(sck))
+ {
+ g_sleep(1);
+ }
+ else
+ {
+ scp_lock_fork_critical_section_end(block);
+ return 1;
+ }
+ }
+ else if (sent == 0)
+ {
+ scp_lock_fork_critical_section_end(block);
+ return 1;
+ }
+ else
+ {
+ data += sent;
+ len -= sent;
+ }
}
- else if (sent == 0)
- {
- scp_lock_fork_critical_section_end(block);
- return 1;
- }
- else
- {
- data += sent;
- len -= sent;
- }
- }
- scp_lock_fork_critical_section_end(block);
+ scp_lock_fork_critical_section_end(block);
- return 0;
+ return 0;
}
/*****************************************************************************/
int DEFAULT_CC
-scp_tcp_bind(int sck, char* addr, char* port)
+scp_tcp_bind(int sck, char *addr, char *port)
{
- struct sockaddr_in s;
+ struct sockaddr_in s;
- memset(&s, 0, sizeof(struct sockaddr_in));
- s.sin_family = AF_INET;
- s.sin_port = htons(atoi(port));
- s.sin_addr.s_addr = inet_addr(addr);
- return bind(sck, (struct sockaddr*)&s, sizeof(struct sockaddr_in));
+ memset(&s, 0, sizeof(struct sockaddr_in));
+ s.sin_family = AF_INET;
+ s.sin_port = htons(atoi(port));
+ s.sin_addr.s_addr = inet_addr(addr);
+ return bind(sck, (struct sockaddr *)&s, sizeof(struct sockaddr_in));
}
-