Home / File/ netty_unix_socket.c — netty Source File

netty_unix_socket.c — netty Source File

Architecture documentation for netty_unix_socket.c, a c file in the netty codebase. 17 imports, 0 dependents.

File c NativeTransport 17 imports

Entity Profile

Dependency Diagram

graph LR
  daa4babc_e657_7631_ad9c_10c8bb120f11["netty_unix_socket.c"]
  a4533dad_6113_0c5b_b279_28eaf7391fc5["netty_unix_errors.h"]
  daa4babc_e657_7631_ad9c_10c8bb120f11 --> a4533dad_6113_0c5b_b279_28eaf7391fc5
  a7d65015_0594_5090_5390_74fe05dfdd3e["netty_unix_jni.h"]
  daa4babc_e657_7631_ad9c_10c8bb120f11 --> a7d65015_0594_5090_5390_74fe05dfdd3e
  ab04c67a_6048_b528_995a_66f7103f89d2["netty_unix_socket.h"]
  daa4babc_e657_7631_ad9c_10c8bb120f11 --> ab04c67a_6048_b528_995a_66f7103f89d2
  e811edce_3305_6244_830c_daac1b109259["netty_unix_util.h"]
  daa4babc_e657_7631_ad9c_10c8bb120f11 --> e811edce_3305_6244_830c_daac1b109259
  89cfd132_669d_bc14_f916_80a38e3da8a5["netty_jni_util.h"]
  daa4babc_e657_7631_ad9c_10c8bb120f11 --> 89cfd132_669d_bc14_f916_80a38e3da8a5
  d74a6009_ec80_1e86_97f9_4d3451c5416a["fcntl.h"]
  daa4babc_e657_7631_ad9c_10c8bb120f11 --> d74a6009_ec80_1e86_97f9_4d3451c5416a
  71c52c20_b4aa_1551_58db_42e42fa27aa6["errno.h"]
  daa4babc_e657_7631_ad9c_10c8bb120f11 --> 71c52c20_b4aa_1551_58db_42e42fa27aa6
  6f8e9f3d_28f0_b3bb_e5f8_505aa6fd30ef["unistd.h"]
  daa4babc_e657_7631_ad9c_10c8bb120f11 --> 6f8e9f3d_28f0_b3bb_e5f8_505aa6fd30ef
  57dbba5a_a02c_21b2_1382_79ab5e44c50a["stddef.h"]
  daa4babc_e657_7631_ad9c_10c8bb120f11 --> 57dbba5a_a02c_21b2_1382_79ab5e44c50a
  617ed4cf_d595_a5c7_1593_810f21ce0712["stdint.h"]
  daa4babc_e657_7631_ad9c_10c8bb120f11 --> 617ed4cf_d595_a5c7_1593_810f21ce0712
  d822c438_bcda_8ebc_05f9_1007c55018be["stdlib.h"]
  daa4babc_e657_7631_ad9c_10c8bb120f11 --> d822c438_bcda_8ebc_05f9_1007c55018be
  5cbcd069_b25c_7379_e9c5_47a7dd85985a["string.h"]
  daa4babc_e657_7631_ad9c_10c8bb120f11 --> 5cbcd069_b25c_7379_e9c5_47a7dd85985a
  26653805_922e_c805_7cc7_2ce6bdab1620["un.h"]
  daa4babc_e657_7631_ad9c_10c8bb120f11 --> 26653805_922e_c805_7cc7_2ce6bdab1620
  505c78e3_5429_a273_f5c4_148e73de1d1f["socket.h"]
  daa4babc_e657_7631_ad9c_10c8bb120f11 --> 505c78e3_5429_a273_f5c4_148e73de1d1f
  style daa4babc_e657_7631_ad9c_10c8bb120f11 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/*
 * Copyright 2015 The Netty Project
 *
 * The Netty Project licenses this file to you 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:
 *
 *   https://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.
 */
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <sys/un.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <netinet/tcp.h>

#include "netty_unix_errors.h"
#include "netty_unix_jni.h"
#include "netty_unix_socket.h"
#include "netty_unix_util.h"
#include "netty_jni_util.h"

#define SOCKET_CLASSNAME "io/netty/channel/unix/Socket"
// Define SO_REUSEPORT if not found to fix build issues.
// See https://github.com/netty/netty/issues/2558
#ifndef SO_REUSEPORT
#define SO_REUSEPORT 15
#endif /* SO_REUSEPORT */

// MSG_FASTOPEN is defined in linux 3.6. We define this here so older kernels can compile.
#ifndef MSG_FASTOPEN
#define MSG_FASTOPEN 0x20000000
#endif

static jweak datagramSocketAddressClassWeak = NULL;
static jweak domainDatagramSocketAddressClassWeak = NULL;
static jmethodID datagramSocketAddrMethodId = NULL;
static jmethodID domainDatagramSocketAddrMethodId = NULL;
static jmethodID inetSocketAddrMethodId = NULL;
static jclass inetSocketAddressClass = NULL;
static const unsigned char wildcardAddress[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
static const unsigned char ipv4MappedWildcardAddress[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 };
static const unsigned char ipv4MappedAddress[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff };

// Optional external methods
extern int accept4(int sockFd, struct sockaddr* addr, socklen_t* addrlen, int flags) __attribute__((weak)) __attribute__((weak_import));

// macro to calculate the length of a sockaddr_un struct for a given path length.
// ... (1356 more lines)

Dependencies

Frequently Asked Questions

What does netty_unix_socket.c do?
netty_unix_socket.c is a source file in the netty codebase, written in c. It belongs to the NativeTransport domain.
What does netty_unix_socket.c depend on?
netty_unix_socket.c imports 17 module(s): errno.h, fcntl.h, in.h, inet.h, netty_jni_util.h, netty_unix_errors.h, netty_unix_jni.h, netty_unix_socket.h, and 9 more.
Where is netty_unix_socket.c in the architecture?
netty_unix_socket.c is located at transport-native-unix-common/src/main/c/netty_unix_socket.c (domain: NativeTransport, directory: transport-native-unix-common/src/main/c).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free