[PATCH] osmo-msc[master]: Remove unused code

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Max gerrit-no-reply at lists.osmocom.org
Tue Jan 30 17:12:15 UTC 2018


Review at  https://gerrit.osmocom.org/6210

Remove unused code

The socket.* is unused leftover from pre-split time.

Change-Id: Ibf3b539fcbd7f311caa2291af23b8f18ebc6c2e0
---
M include/osmocom/msc/Makefile.am
D include/osmocom/msc/socket.h
M src/libcommon/Makefile.am
D src/libcommon/socket.c
4 files changed, 0 insertions(+), 127 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/10/6210/1

diff --git a/include/osmocom/msc/Makefile.am b/include/osmocom/msc/Makefile.am
index ec231d0..88305db 100644
--- a/include/osmocom/msc/Makefile.am
+++ b/include/osmocom/msc/Makefile.am
@@ -29,7 +29,6 @@
 	silent_call.h \
 	smpp.h \
 	sms_queue.h \
-	socket.h \
 	transaction.h \
 	ussd.h \
 	vlr.h \
diff --git a/include/osmocom/msc/socket.h b/include/osmocom/msc/socket.h
deleted file mode 100644
index 0fd85f1..0000000
--- a/include/osmocom/msc/socket.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef _BSC_SOCKET_H
-#define _BSC_SOCKET_H
-
-#include <osmocom/core/select.h>
-
-#ifndef IPPROTO_GRE
-#define IPPROTO_GRE 47
-#endif
-
-int make_sock(struct osmo_fd *bfd, int proto,
-	      uint32_t ip, uint16_t port, int priv_nr,
-	      int (*cb)(struct osmo_fd *fd, unsigned int what), void *data);
-
-#endif /* _BSC_SOCKET_H */
diff --git a/src/libcommon/Makefile.am b/src/libcommon/Makefile.am
index 8f70da7..30f37d4 100644
--- a/src/libcommon/Makefile.am
+++ b/src/libcommon/Makefile.am
@@ -26,7 +26,6 @@
 	gsm_data.c \
 	gsup_client.c \
 	oap_client.c \
-	socket.c \
 	talloc_ctx.c \
 	gsm_subscriber_base.c \
 	$(NULL)
diff --git a/src/libcommon/socket.c b/src/libcommon/socket.c
deleted file mode 100644
index 2793bcf..0000000
--- a/src/libcommon/socket.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/* OpenBSC sokcet code, taken from Abis input driver for ip.access */
-
-/* (C) 2009 by Harald Welte <laforge at gnumonks.org>
- * (C) 2010 by Holger Hans Peter Freyther
- * (C) 2010 by On-Waves
- *
- * All Rights Reserved
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation; either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <time.h>
-#include <sys/fcntl.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <arpa/inet.h>
-
-#include <osmocom/core/select.h>
-#include <osmocom/gsm/tlv.h>
-#include <osmocom/core/msgb.h>
-#include <osmocom/msc/debug.h>
-#include <osmocom/msc/gsm_data.h>
-#include <osmocom/core/talloc.h>
-
-int make_sock(struct osmo_fd *bfd, int proto,
-	      uint32_t ip, uint16_t port, int priv_nr,
-	      int (*cb)(struct osmo_fd *fd, unsigned int what), void *data)
-{
-	struct sockaddr_in addr;
-	int ret, on = 1;
-	int type = SOCK_STREAM;
-
-	switch (proto) {
-	case IPPROTO_TCP:
-		type = SOCK_STREAM;
-		break;
-	case IPPROTO_UDP:
-		type = SOCK_DGRAM;
-		break;
-#ifdef IPPROTO_GRE
-	case IPPROTO_GRE:
-		type = SOCK_RAW;
-		break;
-#endif
-	default:
-		return -EINVAL;
-	}
-
-	bfd->fd = socket(AF_INET, type, proto);
-	bfd->cb = cb;
-	bfd->when = BSC_FD_READ;
-	bfd->data = data;
-	bfd->priv_nr = priv_nr;
-
-	if (bfd->fd < 0) {
-		LOGP(DLINP, LOGL_ERROR, "could not create socket.\n");
-		return -EIO;
-	}
-
-	memset(&addr, 0, sizeof(addr));
-	addr.sin_family = AF_INET;
-	addr.sin_port = htons(port);
-	if (ip != INADDR_ANY)
-		addr.sin_addr.s_addr = htonl(ip);
-	else
-		addr.sin_addr.s_addr = INADDR_ANY;
-
-	setsockopt(bfd->fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
-
-	ret = bind(bfd->fd, (struct sockaddr *) &addr, sizeof(addr));
-	if (ret < 0) {
-		LOGP(DLINP, LOGL_ERROR, "could not bind socket %s\n",
-			strerror(errno));
-		close(bfd->fd);
-		return -EIO;
-	}
-
-	if (proto == IPPROTO_TCP) {
-		ret = listen(bfd->fd, 1);
-		if (ret < 0) {
-			perror("listen");
-			close(bfd->fd);
-			return ret;
-		}
-	}
-
-	ret = osmo_fd_register(bfd);
-	if (ret < 0) {
-		perror("register_listen_fd");
-		close(bfd->fd);
-		return ret;
-	}
-	return 0;
-}

-- 
To view, visit https://gerrit.osmocom.org/6210
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibf3b539fcbd7f311caa2291af23b8f18ebc6c2e0
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list