| | |
| | | #include "socket_def.h" |
| | | |
| | | #define BUS_HEAD_SIZE (64 + 2 * sizeof(uint32_t)) |
| | | class BusServerSocket; |
| | | |
| | | struct bus_head_t |
| | | { |
| | |
| | | |
| | | |
| | | class ShmModSocket { |
| | | friend class BusServerSocket; |
| | | private: |
| | | shm_socket_t *shm_socket; |
| | | socket_mod_t mod; |
| | | |
| | | std::set<int> *bus_set; |
| | | |
| | | private: |
| | | inline int _recvfrom_(void **buf, int *size, int *key, struct timespec *timeout, int flags); |
| | | |
| | | int _sub_( char *topic, int size, int key, struct timespec *timeout, int flags); |
| | | int _pub_( char *topic, int topic_size, void *content, int content_size, int key, struct timespec *timeout, int flags); |
| | | int _sub_( char *topic, int size, int key, const struct timespec *timeouts, int flags); |
| | | int _pub_( char *topic, int topic_size, void *content, int content_size, int key, const struct timespec *timeouts, int flags); |
| | | |
| | | int _desub_( char *topic, int size, int key, struct timespec *timeout, int flags); |
| | | int _desub_( char *topic, int size, int key, const struct timespec *timeouts, int flags); |
| | | |
| | | |
| | | static int get_bus_sendbuf(bus_head_t &request_head, void *topic_buf, int topic_size, void *content_buf, int content_size, void **retbuf); |
| | |
| | | */ |
| | | int recvfrom(void **buf, int *size, int *key); |
| | | // 接受信息超时返回。 @sec 秒 , @nsec 纳秒 |
| | | int recvfrom_timeout(void **buf, int *size, int *key, struct timespec *timeout); |
| | | int recvfrom_timeout(void **buf, int *size, int *key, const struct timespec *timeout); |
| | | int recvfrom_nowait(void **buf, int *size, int *key); |
| | | |
| | | /** |
| | |
| | | */ |
| | | int sendandrecv(const void *send_buf, const int send_size, const int key, void **recv_buf, int *recv_size) ; |
| | | // 超时返回。 @sec 秒 , @nsec 纳秒 |
| | | int sendandrecv_timeout(const void *send_buf, const int send_size, const int key, void **recv_buf, int *recv_size, struct timespec *timeout) ; |
| | | int sendandrecv_timeout(const void *send_buf, const int send_size, const int key, void **recv_buf, int *recv_size, const struct timespec *timeout) ; |
| | | int sendandrecv_nowait(const void *send_buf, const int send_size, const int key, void **recv_buf, int *recv_size) ; |
| | | |
| | | |
| | | int sendandrecv_unsafe(const void *send_buf, const int send_size, const int key, void **recv_buf, int *recv_size) ; |
| | | // 超时返回。 @sec 秒 , @nsec 纳秒 |
| | | int sendandrecv_unsafe_timeout(const void *send_buf, const int send_size, const int key, void **recv_buf, int *recv_size, struct timespec *timeout) ; |
| | | int sendandrecv_unsafe_timeout(const void *send_buf, const int send_size, const int key, void **recv_buf, int *recv_size, const struct timespec *timeout) ; |
| | | int sendandrecv_unsafe_nowait(const void *send_buf, const int send_size, const int key, void **recv_buf, int *recv_size) ; |
| | | |
| | | /** |
| | |
| | | */ |
| | | int sub(char *topic, int size, int key); |
| | | // 超时返回。 @sec 秒 , @nsec 纳秒 |
| | | int sub_timeout(char *topic, int size, int key, struct timespec *timeout); |
| | | int sub_timeout(char *topic, int size, int key, const struct timespec *timeout); |
| | | int sub_nowait(char *topic, int size, int key); |
| | | |
| | | |
| | |
| | | */ |
| | | int desub( char *topic, int size, int key); |
| | | // 超时返回。 @sec 秒 , @nsec 纳秒 |
| | | int desub_timeout(char *topic, int size, int key, struct timespec *timeout); |
| | | int desub_timeout(char *topic, int size, int key, const struct timespec *timeout); |
| | | int desub_nowait(char *topic, int size, int key) ; |
| | | |
| | | /** |
| | |
| | | */ |
| | | int pub(char *topic, int topic_size, void *content, int content_size, int key); |
| | | // 超时返回。 @sec 秒 , @nsec 纳秒 |
| | | int pub_timeout(char *topic, int topic_size, void *content, int content_size, int key, struct timespec *timeout); |
| | | int pub_timeout(char *topic, int topic_size, void *content, int content_size, int key, const struct timespec *timeout); |
| | | int pub_nowait(char *topic, int topic_size, void *content, int content_size, int key); |
| | | |
| | | |