mirror of
https://github.com/simh/simh.git
synced 2026-01-26 04:01:38 +00:00
ALL: Massive 'const' cleanup
These changes facilitate more robust parameter type checking and helps to identify unexpected coding errors. Most simulators can now also be compiled with a C++ compiler without warnings. Additionally, these changes have also been configured to facilitate easier backporting of simulator and device simulation modules to run under the simh v3.9+ SCP framework.
This commit is contained in:
30
sim_ether.h
30
sim_ether.h
@@ -69,6 +69,10 @@
|
||||
#include "sim_defs.h"
|
||||
#include "sim_sock.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* make common BSD code a bit easier to read in this file */
|
||||
/* OS/X seems to define and compile using one of these BSD types */
|
||||
#if defined(__NetBSD__) || defined (__OpenBSD__) || defined (__FreeBSD__)
|
||||
@@ -235,6 +239,11 @@ typedef void (*ETH_PCALLBACK)(int status);
|
||||
typedef struct eth_list ETH_LIST;
|
||||
typedef struct eth_queue ETH_QUE;
|
||||
typedef struct eth_item ETH_ITEM;
|
||||
struct eth_write_request {
|
||||
struct eth_write_request *next;
|
||||
ETH_PACK packet;
|
||||
};
|
||||
typedef struct eth_write_request ETH_WRITE_REQUEST;
|
||||
|
||||
struct eth_device {
|
||||
char* name; /* name of ethernet device */
|
||||
@@ -303,12 +312,9 @@ struct eth_device {
|
||||
pthread_mutex_t writer_lock;
|
||||
pthread_mutex_t self_lock;
|
||||
pthread_cond_t writer_cond;
|
||||
struct write_request {
|
||||
struct write_request *next;
|
||||
ETH_PACK packet;
|
||||
} *write_requests;
|
||||
ETH_WRITE_REQUEST *write_requests;
|
||||
int write_queue_peak;
|
||||
struct write_request *write_buffers;
|
||||
ETH_WRITE_REQUEST *write_buffers;
|
||||
t_stat write_status;
|
||||
#endif
|
||||
};
|
||||
@@ -317,7 +323,7 @@ typedef struct eth_device ETH_DEV;
|
||||
|
||||
/* prototype declarations*/
|
||||
|
||||
t_stat eth_open (ETH_DEV* dev, char* name, /* open ethernet interface */
|
||||
t_stat eth_open (ETH_DEV* dev, const char* name, /* open ethernet interface */
|
||||
DEVICE* dptr, uint32 dbit);
|
||||
t_stat eth_close (ETH_DEV* dev); /* close ethernet interface */
|
||||
t_stat eth_attach_help(FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, const char *cptr);
|
||||
@@ -346,13 +352,13 @@ uint32 eth_crc32(uint32 crc, const void* vbuf, size_t len); /* Compute Ethernet
|
||||
void eth_packet_trace (ETH_DEV* dev, const uint8 *msg, int len, const char* txt); /* trace ethernet packet header+crc */
|
||||
void eth_packet_trace_ex (ETH_DEV* dev, const uint8 *msg, int len, const char* txt, int detail, uint32 reason); /* trace ethernet packet */
|
||||
t_stat eth_show (FILE* st, UNIT* uptr, /* show ethernet devices */
|
||||
int32 val, void* desc);
|
||||
int32 val, CONST void* desc);
|
||||
t_stat eth_show_devices (FILE* st, DEVICE *dptr, /* show ethernet devices */
|
||||
UNIT* uptr, int32 val, char* desc);
|
||||
UNIT* uptr, int32 val, CONST char* desc);
|
||||
void eth_show_dev (FILE*st, ETH_DEV* dev); /* show ethernet device state */
|
||||
|
||||
void eth_mac_fmt (ETH_MAC* add, char* buffer); /* format ethernet mac address */
|
||||
t_stat eth_mac_scan (ETH_MAC* mac, char* strmac); /* scan string for mac, put in mac */
|
||||
void eth_mac_fmt (const ETH_MAC* add, char* buffer); /* format ethernet mac address */
|
||||
t_stat eth_mac_scan (ETH_MAC* mac, const char* strmac); /* scan string for mac, put in mac */
|
||||
|
||||
t_stat ethq_init (ETH_QUE* que, int max); /* initialize FIFO queue */
|
||||
void ethq_clear (ETH_QUE* que); /* clear FIFO queue */
|
||||
@@ -366,4 +372,8 @@ t_stat ethq_destroy(ETH_QUE* que); /* release FIFO queue */
|
||||
|
||||
const char *eth_capabilities(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SIM_ETHER_H */
|
||||
|
||||
Reference in New Issue
Block a user