GRPC Core  9.0.0
socket_factory_posix.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2017 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 #ifndef GRPC_CORE_LIB_IOMGR_SOCKET_FACTORY_POSIX_H
20 #define GRPC_CORE_LIB_IOMGR_SOCKET_FACTORY_POSIX_H
21 
23 
25 #include <grpc/support/sync.h>
27 
29 typedef struct {
31  int (*socket)(grpc_socket_factory* factory, int domain, int type,
32  int protocol);
34  int (*bind)(grpc_socket_factory* factory, int sockfd,
35  const grpc_resolved_address* addr);
37  int (*compare)(grpc_socket_factory* a, grpc_socket_factory* b);
39  void (*destroy)(grpc_socket_factory* factory);
41 
46 };
47 
50  const grpc_socket_factory_vtable* vtable);
51 
54 
57  int type, int protocol);
58 
61  const grpc_resolved_address* addr);
62 
65 
68 
69 #endif /* GRPC_CORE_LIB_IOMGR_SOCKET_FACTORY_POSIX_H */
grpc_socket_factory * grpc_socket_factory_ref(grpc_socket_factory *factory)
int grpc_socket_factory_bind(grpc_socket_factory *factory, int sockfd, const grpc_resolved_address *addr)
Perform the equivalent of a bind(2) operation using factory.
int grpc_socket_factory_socket(grpc_socket_factory *factory, int domain, int type, int protocol)
Perform the equivalent of a socket(2) operation using factory.
grpc_arg grpc_socket_factory_to_arg(grpc_socket_factory *factory)
Wrap factory as a grpc_arg.
void grpc_socket_factory_init(grpc_socket_factory *factory, const grpc_socket_factory_vtable *vtable)
called by concrete implementations to initialize the base struct
int grpc_socket_factory_compare(grpc_socket_factory *a, grpc_socket_factory *b)
Compare if a and b are the same factory or have same settings.
void grpc_socket_factory_unref(grpc_socket_factory *factory)
Definition: sync_generic.h:36
A single argument...
Definition: grpc_types.h:103
Definition: resolve_address.h:44
The virtual table of grpc_socket_factory.
Definition: socket_factory_posix.h:29
The Socket Factory interface allows changes on socket options.
Definition: socket_factory_posix.h:43
const grpc_socket_factory_vtable * vtable
Definition: socket_factory_posix.h:44
gpr_refcount refcount
Definition: socket_factory_posix.h:45