Begin converting URL struct into modern C++ class

This commit is contained in:
2025-04-12 22:20:34 -04:00
parent 26b903f02f
commit 27ae7d91c1
18 changed files with 171 additions and 104 deletions

View File

@ -19,14 +19,14 @@ dpid_SOURCES = \
dpid.h \
dpid_common.h \
misc_new.h \
dpi.c \
dpi.cc \
dpi_socket_dir.c \
dpid.c \
dpid.cc \
dpid_common.c \
main.c \
misc_new.c
dpidc_SOURCES = dpidc.c
dpidc_SOURCES = dpidc.cc
sysconf_DATA = dpidrc
CLEANFILES = $(sysconf_DATA)

View File

@ -7,6 +7,12 @@
#ifndef DPI_H
#define DPI_H
#ifdef __cplusplus
extern "C"
{
#endif
#include <unistd.h> /* for socklen_t */
#include <sys/socket.h> /* for socklen_t and AF_LOCAL */
@ -42,4 +48,8 @@ char *a_Dpi_rd_dpi_socket_dir(char *dirname);
char *a_Dpi_srs(void);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -98,7 +98,7 @@ void free_services_list(Dlist *s_list)
struct service *s;
for (i=0; i < dList_length(s_list) ; i++) {
s = dList_nth_data(s_list, i);
s = reinterpret_cast< service * >( dList_nth_data(s_list, i) );
dFree(s->name);
}
dList_free(s_list);
@ -888,7 +888,7 @@ void send_sockport(int sock_fd, char *dpi_tag, struct dp *dpi_attr_list)
dReturn_if_fail((dpi_id = get_message(sock_fd, dpi_tag)) != NULL);
serv = dList_find_custom(services_list,dpi_id,(dCompareFunc)service_match);
serv = reinterpret_cast< service * >( dList_find_custom(services_list,dpi_id,(dCompareFunc)service_match) );
if (serv == NULL || (i = serv->dp_index) == -1)
for (i = 0; i < numdpis; i++)

View File

@ -5,6 +5,11 @@
#ifndef DPID_H
#define DPID_H
#ifdef __cplusplus
extern "C"
{
#endif
#include <sys/socket.h>
#include <sys/select.h> /* for fd_set */
#include <sys/un.h>
@ -112,4 +117,8 @@ int service_match(const struct service *A, const char *B);
void send_sockport(int sock_fd, char * dpi_tag, struct dp *dpi_attr_list);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -9,6 +9,11 @@
* the next patch
*/
#ifdef __cplusplus
extern "C"
{
#endif
#include <dirent.h>
#include <stddef.h> /* size_t */
#include <sys/types.h> /* ssize_t */
@ -51,4 +56,8 @@ void errmsg(char *caller, char *called, int errornum, char *file, int line);
ssize_t ckd_write(int fd, char *msg, char *file, int line);
ssize_t ckd_close(int fd, char *file, int line);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,10 +1,18 @@
#ifndef MISC_NEW_H
#define MISC_NEW_H
#ifdef __cplusplus
extern "C"
{
#endif
Dstr *a_Misc_rdtag(int socket);
char *a_Misc_readtag(int sock);
char *a_Misc_mkdtemp(char *template);
char *a_Misc_mkfname(char *template);
char *a_Misc_mkdtemp(char *template_);
char *a_Misc_mkfname(char *template_);
char *a_Misc_mksecret(int nchar);
#ifdef __cplusplus
}
#endif
#endif