Lines Matching refs:server
31 static int CreatePipeServerSocket_(const char *server, int maxClient) in CreatePipeServerSocket_() argument
36 unlink(server); in CreatePipeServerSocket_()
42 ret = strcpy_s(serverAddr.sun_path, sizeof(serverAddr.sun_path), server); in CreatePipeServerSocket_()
45 uint32_t size = offsetof(struct sockaddr_un, sun_path) + strlen(server); in CreatePipeServerSocket_()
54 ret = chmod(server, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); in CreatePipeServerSocket_()
55 LE_CHECK(ret == 0, return -1, "Failed to chmod %s, err %d. ", server, errno); in CreatePipeServerSocket_()
60 static int CreatePipeSocket_(const char *server) in CreatePipeSocket_() argument
75 ret = strcpy_s(serverAddr.sun_path, sizeof(serverAddr.sun_path), server); in CreatePipeSocket_()
86 static LE_STATUS GetSockaddrFromServer_(const char *server, struct sockaddr_in *addr) in GetSockaddrFromServer_() argument
91 const char *portStr = strstr(server, ":"); in GetSockaddrFromServer_()
92 LE_CHECK(portStr != NULL, return LE_FAILURE, "Failed to get addr %s", server); in GetSockaddrFromServer_()
95 ret = inet_pton(AF_INET, server, &addr->sin_addr); in GetSockaddrFromServer_()
96 LE_CHECK(ret >= 0, return LE_FAILURE, "Failed to inet_pton addr %s", server); in GetSockaddrFromServer_()
97 LE_LOGV("CreateTcpSocket server: %s port: %d", server, port); in GetSockaddrFromServer_()
101 static int CreateTcpServerSocket_(const char *server, int maxClient) in CreateTcpServerSocket_() argument
107 GetSockaddrFromServer_(server, &serverAddr); in CreateTcpServerSocket_()
119 static int CreateTcpSocket_(const char *server) in CreateTcpSocket_() argument
130 GetSockaddrFromServer_(server, &serverAddr); in CreateTcpSocket_()
159 int CreateSocket(int flags, const char *server) in CreateSocket() argument
163 LE_LOGV("CreateSocket flags %x type %x server %s", flags, type, server); in CreateSocket()
166 fd = CreateTcpServerSocket_(server, LOOP_MAX_CLIENT); in CreateSocket()
168 fd = CreateTcpSocket_(server); in CreateSocket()
172 fd = CreatePipeServerSocket_(server, LOOP_MAX_CLIENT); in CreateSocket()
174 fd = CreatePipeSocket_(server); in CreateSocket()
178 LE_LOGE("Invalid flags 0x%08x for server %s", flags, server); in CreateSocket()