Skip to content

Commit 6da5041

Browse files
committed
grpc-native: Add gRPC includes
Signed-off-by: Johannes Zottele <[email protected]>
1 parent 65cc9cd commit 6da5041

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+5862
-6
lines changed

cinterop-c/less

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
// Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
2+
3+
/* $NetBSD: getaddrinfo.c,v 1.82 2006/03/25 12:09:40 rpaulo Exp $ */
4+
/* $KAME: getaddrinfo.c,v 1.29 2000/08/31 17:26:57 itojun Exp $ */
5+
/*
6+
* This is an adaptation of Android's implementation of RFC 6724
7+
* (in Android's getaddrinfo.c). It has some cosmetic differences
8+
* from Android's getaddrinfo.c, but Android's getaddrinfo.c was
9+
* used as a guide or example of a way to implement the RFC 6724 spec when
10+
* this was written.
11+
*/
12+
13+
#ifndef ADDRESS_SORTING_H
14+
#define ADDRESS_SORTING_H
15+
16+
#include <stddef.h>
17+
18+
#ifdef __cplusplus
19+
extern "C" {
20+
#endif
21+
22+
typedef struct address_sorting_address {
23+
char addr[128];
24+
size_t len;
25+
} address_sorting_address;
26+
27+
/* address_sorting_sortable represents one entry in a list of destination
28+
* IP addresses to sort. It contains the destination IP address
29+
* "sorting key", along with placeholder and scratch fields. */
30+
typedef struct address_sorting_sortable {
31+
// input data; sorting key
32+
address_sorting_address dest_addr;
33+
// input data; optional value to attach to the sorting key
34+
void* user_data;
35+
// internal fields, these must be zero'd when passed to sort function
36+
address_sorting_address source_addr;
37+
bool source_addr_exists;
38+
size_t original_index;
39+
} address_sorting_sortable;
40+
41+
void address_sorting_rfc_6724_sort(address_sorting_sortable* sortables,
42+
size_t sortables_len);
43+
44+
void address_sorting_init();
45+
void address_sorting_shutdown();
46+
47+
struct address_sorting_source_addr_factory;
48+
49+
/* The interfaces below are exposed only for testing */
50+
typedef struct {
51+
/* Gets the source address that would be used for the passed-in destination
52+
* address, and fills in *source_addr* with it if one exists.
53+
* Returns true if a source address exists for the destination address,
54+
* and false otherwise. */
55+
bool (*get_source_addr)(struct address_sorting_source_addr_factory* factory,
56+
const address_sorting_address* dest_addr,
57+
address_sorting_address* source_addr);
58+
void (*destroy)(struct address_sorting_source_addr_factory* factory);
59+
} address_sorting_source_addr_factory_vtable;
60+
61+
typedef struct address_sorting_source_addr_factory {
62+
const address_sorting_source_addr_factory_vtable* vtable;
63+
} address_sorting_source_addr_factory;
64+
65+
/* Platform-compatible address family types */
66+
typedef enum {
67+
ADDRESS_SORTING_AF_INET,
68+
ADDRESS_SORTING_AF_INET6,
69+
ADDRESS_SORTING_UNKNOWN_FAMILY,
70+
} address_sorting_family;
71+
72+
/* Indicates whether the address is AF_INET, AF_INET6, or another address
73+
* family. */
74+
address_sorting_family address_sorting_abstract_get_family(
75+
const address_sorting_address* address);
76+
77+
void address_sorting_override_source_addr_factory_for_testing(
78+
address_sorting_source_addr_factory* factory);
79+
80+
bool address_sorting_get_source_addr_for_testing(
81+
const address_sorting_address* dest, address_sorting_address* source);
82+
83+
#ifdef __cplusplus
84+
}
85+
#endif
86+
87+
#endif // ADDRESS_SORTING_H
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
2+
3+
#ifndef GRPC_CENSUS_H
4+
#define GRPC_CENSUS_H
5+
6+
#include <grpc/grpc.h>
7+
#include <grpc/support/port_platform.h>
8+
9+
#ifdef __cplusplus
10+
extern "C" {
11+
#endif
12+
13+
/**
14+
A Census Context is a handle used by Census to represent the current tracing
15+
and stats collection information. Contexts should be propagated across RPC's
16+
(this is the responsibility of the local RPC system). */
17+
typedef struct census_context census_context;
18+
19+
#ifdef __cplusplus
20+
}
21+
#endif
22+
23+
#endif /* GRPC_CENSUS_H */

0 commit comments

Comments
 (0)