Make some more parameters const

This commit is contained in:
dmiller 2026-06-10 21:39:42 +00:00
parent 756d012567
commit b7e3657ec7
4 changed files with 11 additions and 11 deletions

View file

@ -454,7 +454,7 @@ private:
const char *device;
struct sockaddr_storage src1, src2;
size_t sslen1, sslen2;
void *ipopts;
const u8 *ipopts;
size_t ipoptslen;
std::list<dns_server> servs;
std::list<request *> new_reqs;
@ -554,7 +554,7 @@ void DNS::Resolver::setLogFunc(void (*log_func)(int lvl, const char *, ...))
impl->log_func = log_func;
}
void DNS::Resolver::setSource(const char *device, struct sockaddr_storage *src, size_t srclen, bool spoof)
void DNS::Resolver::setSource(const char *device, const struct sockaddr_storage *src, size_t srclen, bool spoof)
{
impl->device = device;
if (src) {
@ -571,7 +571,7 @@ void DNS::Resolver::setSource(const char *device, struct sockaddr_storage *src,
}
}
void DNS::Resolver::setIpOptions(void *opts, size_t optslen)
void DNS::Resolver::setIpOptions(const u8 *opts, size_t optslen)
{
impl->ipopts = opts;
impl->ipoptslen = optslen;
@ -1423,7 +1423,7 @@ void DNS::ResolverImpl::connect_dns_servers() {
nsock_iod_set_localaddr(serverI->nsd, &src2, sslen2);
}
if (ipoptslen)
nsock_iod_set_ipoptions(serverI->nsd, ipopts, ipoptslen);
nsock_iod_set_ipoptions(serverI->nsd, (const void *)ipopts, ipoptslen);
serverI->status = dns_server::CONNECTING;
nsock_connect_udp(dnspool, serverI->nsd, &DNS::ResolverImpl::connect_evt_handler, &*serverI, (struct sockaddr *) &serverI->addr, serverI->addr_len, 53);

View file

@ -279,9 +279,9 @@ public:
void setAF(int af);
void setStatusCallback(void (*callback)(const Stats *));
void setLogFunc(void (*log_func)(int lvl, const char *, ...));
void setSource(const char *device, struct sockaddr_storage *src, size_t srclen, bool spoof);
void setIpOptions(void *opts, size_t optslen);
void setProxyChain(nsock_proxychain proxy_chain);
void setSource(const char *device, const struct sockaddr_storage *src, size_t srclen, bool spoof);
void setIpOptions(const u8 *opts, size_t optslen);
void setProxyChain(const nsock_proxychain proxy_chain);
void setServers(const char *servers);
bool isMassDnsOK(const char **err) const;

View file

@ -445,12 +445,12 @@ int nsock_iod_check_ssl(nsock_iod iod);
int nsock_iod_get_peerport(nsock_iod iod);
/* Sets the local address to bind to before connect() */
int nsock_iod_set_localaddr(nsock_iod iod, struct sockaddr_storage *ss, size_t sslen);
int nsock_iod_set_localaddr(nsock_iod iod, const struct sockaddr_storage *ss, size_t sslen);
/* Sets IPv4 options to apply before connect(). It makes a copy of the options,
* so you can free() yours if necessary. This copy is freed when the iod is
* destroyed */
int nsock_iod_set_ipoptions(nsock_iod iod, void *ipopts, size_t ipoptslen);
int nsock_iod_set_ipoptions(nsock_iod iod, const void *ipopts, size_t ipoptslen);
/* Returns that host/port/protocol information for the last communication (or
* comm. attempt) this nsi has been involved with. By "involved" with I mean

View file

@ -389,7 +389,7 @@ int nsock_iod_get_peerport(nsock_iod iod) {
}
/* Sets the local address to bind to before connect() */
int nsock_iod_set_localaddr(nsock_iod iod, struct sockaddr_storage *ss,
int nsock_iod_set_localaddr(nsock_iod iod, const struct sockaddr_storage *ss,
size_t sslen) {
struct niod *nsi = (struct niod *)iod;
@ -406,7 +406,7 @@ int nsock_iod_set_localaddr(nsock_iod iod, struct sockaddr_storage *ss,
/* Sets IPv4 options to apply before connect(). It makes a copy of the options,
* so you can free() yours if necessary. This copy is freed when the iod is
* destroyed. */
int nsock_iod_set_ipoptions(nsock_iod iod, void *opts, size_t optslen) {
int nsock_iod_set_ipoptions(nsock_iod iod, const void *opts, size_t optslen) {
struct niod *nsi = (struct niod *)iod;
assert(nsi);