96
* This is used by the postmaster in its communication with frontends. It
96
* This is used by the postmaster in its communication with frontends. It
97
97
* contains all state information needed during this communication before the
98
* backend is run. The Port structure is kept in malloc'd memory and is
99
* still available when a backend is running (see MyProcPort). The data
98
* backend is run. The Port structure is kept in malloc'd memory and is
99
* still available when a backend is running (see MyProcPort). The data
100
100
* it points to must also be malloc'd, or else palloc'd in TopMemoryContext,
101
101
* so that it survives into PostgresMain execution!
103
* remote_hostname is set if we did a successful reverse lookup of the
104
* client's IP address during connection setup.
105
* remote_hostname_resolv tracks the state of hostname verification:
106
* +1 = remote_hostname is known to resolve to client's IP address
107
* -1 = remote_hostname is known NOT to resolve to client's IP address
108
* 0 = we have not done the forward DNS lookup yet
109
* -2 = there was an error in name resolution
110
* If reverse lookup of the client IP address fails, remote_hostname will be
111
* left NULL while remote_hostname_resolv is set to -2. If reverse lookup
112
* succeeds but forward lookup fails, remote_hostname_resolv is also set to -2
113
* (the case is distinguishable because remote_hostname isn't NULL). In
114
* either of the -2 cases, remote_hostname_errcode saves the lookup return
115
* code for possible later use with gai_strerror.
104
118
typedef struct Port
111
125
char *remote_host; /* name (or ip addr) of remote host */
112
126
char *remote_hostname;/* name (not ip addr) of remote host, if
114
int remote_hostname_resolv; /* +1 = remote_hostname is known to
115
* resolve to client's IP address; -1
116
* = remote_hostname is known NOT to
117
* resolve to client's IP address; 0 =
118
* we have not done the forward DNS
128
int remote_hostname_resolv; /* see above */
120
129
char *remote_port; /* text rep of remote port */
121
130
CAC_state canAcceptConnections; /* postmaster connection status */
124
133
* Information that needs to be saved from the startup packet and passed
125
* into backend execution. "char *" fields are NULL if not set.
134
* into backend execution. "char *" fields are NULL if not set.
126
135
* guc_options points to a List of alternating option names and values.
128
137
char *database_name;