GRPC Core
4.0.0
|
#include <grpc/support/port_platform.h>
Go to the source code of this file.
Functions | |
GPRAPI int | gpr_join_host_port (char **out, const char *host, int port) |
Given a host and port, creates a newly-allocated string of the form "host:port" or "[ho:st]:port", depending on whether the host contains colons like an IPv6 literal. More... | |
GPRAPI int | gpr_split_host_port (const char *name, char **host, char **port) |
Given a name in the form "host:port" or "[ho:st]:port", split into hostname and port number, into newly allocated strings, which must later be destroyed using gpr_free(). More... | |
GPRAPI int gpr_join_host_port | ( | char ** | out, |
const char * | host, | ||
int | port | ||
) |
Given a host and port, creates a newly-allocated string of the form "host:port" or "[ho:st]:port", depending on whether the host contains colons like an IPv6 literal.
If the host is already bracketed, then additional brackets will not be added.
Usage is similar to gpr_asprintf: returns the number of bytes written (excluding the final '\0'), and *out points to a string which must later be destroyed using gpr_free().
In the unlikely event of an error, returns -1 and sets *out to NULL.
GPRAPI int gpr_split_host_port | ( | const char * | name, |
char ** | host, | ||
char ** | port | ||
) |
Given a name in the form "host:port" or "[ho:st]:port", split into hostname and port number, into newly allocated strings, which must later be destroyed using gpr_free().
Return 1 on success, 0 on failure. Guarantees *host and *port == NULL on failure.