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

VIRT-PHY: osmo_mcast_sock.c coding style cleanup

Change-Id: Ie45ea5911167600cb9a1a79dfcd9656be1e91dab
---
M src/host/virt_phy/src/shared/osmo_mcast_sock.c
1 file changed, 20 insertions(+), 24 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/30/3230/1

diff --git a/src/host/virt_phy/src/shared/osmo_mcast_sock.c 
b/src/host/virt_phy/src/shared/osmo_mcast_sock.c
index 94aa925..b9bf90c 100644
--- a/src/host/virt_phy/src/shared/osmo_mcast_sock.c
+++ b/src/host/virt_phy/src/shared/osmo_mcast_sock.c
@@ -13,10 +13,8 @@
 /* server socket is what we use for transmission. It is not subscribed
  * to a multicast group or locally bound, but it is just a normal UDP
  * socket that's connected to the remote mcast group + port */
-struct mcast_server_sock *mcast_server_sock_setup(void *ctx,
-                                                  char* tx_mcast_group,
-                                                  int tx_mcast_port,
-                                                  int loopback)
+struct mcast_server_sock *
+mcast_server_sock_setup(void *ctx, char* tx_mcast_group, int tx_mcast_port, 
int loopback)
 {
        struct mcast_server_sock *serv_sock = talloc_zero(ctx, struct 
mcast_server_sock);
        int rc;
@@ -38,11 +36,11 @@
        serv_sock->sock_conf->sin_addr.s_addr = inet_addr(tx_mcast_group);
        serv_sock->sock_conf->sin_port = htons(tx_mcast_port);
 
-       // determines whether sent mcast packets should be looped back to the 
local sockets.
-       // loopback must be enabled if the mcast client is on the same machine
+       /* determines whether sent mcast packets should be looped back to the 
local sockets.
+        * loopback must be enabled if the mcast client is on the same machine 
*/
        if (setsockopt(serv_sock->osmo_fd->fd, IPPROTO_IP, IP_MULTICAST_LOOP,
                        &loopback, sizeof(loopback)) < 0) {
-               perror("Failed to disable loopback.\n");
+               perror("Failed to configure multicast loopback.\n");
                return NULL;
        }
 
@@ -52,10 +50,10 @@
 /* the client socket is what we use for reception.  It is a UDP socket
  * that's bound to the GSMTAP UDP port and subscribed to the respective
  * multicast group */
-struct mcast_client_sock *mcast_client_sock_setup(
-                void *ctx, char* mcast_group, int mcast_port,
-                int (*fd_rx_cb)(struct osmo_fd *ofd, unsigned int what),
-                void *osmo_fd_data)
+struct mcast_client_sock *
+mcast_client_sock_setup(void *ctx, char* mcast_group, int mcast_port,
+                       int (*fd_rx_cb)(struct osmo_fd *ofd, unsigned int what),
+                       void *osmo_fd_data)
 {
        struct mcast_client_sock *client_sock = talloc_zero(ctx, struct 
mcast_client_sock);
        int rc, loopback = 1, all = 0;
@@ -106,18 +104,17 @@
        return client_sock;
 }
 
-struct mcast_bidir_sock *mcast_bidir_sock_setup(
-                void *ctx, char* tx_mcast_group, int tx_mcast_port,
-                char* rx_mcast_group, int rx_mcast_port, int loopback,
-                int (*fd_rx_cb)(struct osmo_fd *ofd, unsigned int what),
-                void *osmo_fd_data)
+struct mcast_bidir_sock *
+mcast_bidir_sock_setup(void *ctx, char* tx_mcast_group, int tx_mcast_port,
+                       char* rx_mcast_group, int rx_mcast_port, int loopback,
+                       int (*fd_rx_cb)(struct osmo_fd *ofd, unsigned int what),
+                       void *osmo_fd_data)
 {
-       struct mcast_bidir_sock *bidir_sock = talloc(ctx,
-                       struct mcast_bidir_sock);
+       struct mcast_bidir_sock *bidir_sock = talloc(ctx, struct 
mcast_bidir_sock);
        bidir_sock->rx_sock = mcast_client_sock_setup(ctx, rx_mcast_group,
-                       rx_mcast_port, fd_rx_cb, osmo_fd_data);
+                                                     rx_mcast_port, fd_rx_cb, 
osmo_fd_data);
        bidir_sock->tx_sock = mcast_server_sock_setup(ctx, tx_mcast_group,
-                       tx_mcast_port, loopback);
+                                                     tx_mcast_port, loopback);
        if (!bidir_sock->rx_sock || !bidir_sock->tx_sock) {
                return NULL;
        }
@@ -135,8 +132,7 @@
                          int data_len)
 {
        return sendto(serv_sock->osmo_fd->fd, data, data_len, 0,
-                       (struct sockaddr *)serv_sock->sock_conf,
-                       sizeof(*serv_sock->sock_conf));
+                     (struct sockaddr *)serv_sock->sock_conf, 
sizeof(*serv_sock->sock_conf));
 }
 
 int mcast_bidir_sock_tx(struct mcast_bidir_sock *bidir_sock, void* data,
@@ -144,8 +140,8 @@
 {
        return mcast_server_sock_tx(bidir_sock->tx_sock, data, data_len);
 }
-int mcast_bidir_sock_rx(struct mcast_bidir_sock *bidir_sock, void* buf,
-                        int buf_len)
+
+int mcast_bidir_sock_rx(struct mcast_bidir_sock *bidir_sock, void* buf, int 
buf_len)
 {
        return mcast_client_sock_rx(bidir_sock->rx_sock, buf, buf_len);
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie45ea5911167600cb9a1a79dfcd9656be1e91dab
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <[email protected]>

Reply via email to