Linux中与“系统网络状态”相关的内核数据结构

news2024/11/24 17:06:03

六、系统网络状态相关的数据结构

6.1 ifconf

  • \linux-2.6.32.63\include\linux\if.h
/* Structure used in SIOCGIFCONF request.  Used to retrieve interface
   configuration for machine (useful for programs which must know all
   networks accessible).  
*/ 
struct ifconf
{
    int ifc_len;        	// Size of buffer.   
    union
    {
    __caddr_t ifcu_buf;
    struct ifreq *ifcu_req;    //保存每块网卡的具体信息的结构体数组
    } ifc_ifcu;
};
#define ifc_buf    ifc_ifcu.ifcu_buf   /* Buffer address.  */
#define ifc_req    ifc_ifcu.ifcu_req   /* Array of structures.  */
#define _IOT_ifconf _IOT(_IOTS(struct ifconf),1,0,0,0,0) /* not right */

6.2 ifreq

  • \linux-2.6.32.63\include\linux\if.h
/*
 * Interface request structure used for socket
 * ioctl's.  All interface ioctl's must have parameter
 * definitions which begin with ifr_name.  The
 * remainder may be interface specific.
*/
struct ifreq 
{
#define IFHWADDRLEN    6
    union
    {
        char    ifrn_name[IFNAMSIZ];        /* if name, e.g. "en0" */
    } ifr_ifrn;
    
    //描述套接口的地址结构
    union 
    {
        struct    sockaddr ifru_addr;
        struct    sockaddr ifru_dstaddr;
        struct    sockaddr ifru_broadaddr;
        struct    sockaddr ifru_netmask;
        struct  sockaddr ifru_hwaddr;
        short    ifru_flags;
        int    ifru_ivalue;
        int    ifru_mtu;
        struct  ifmap ifru_map;
        char    ifru_slave[IFNAMSIZ];    /* Just fits the size */
        char    ifru_newname[IFNAMSIZ];
        void __user *    ifru_data;
        struct    if_settings ifru_settings;
    } ifr_ifru;
};
#define 	ifr_name    ifr_ifrn.ifrn_name    		/* interface name */
#define		ifr_hwaddr    ifr_ifru.ifru_hwaddr    	/* MAC address*/
#define    	ifr_addr    ifr_ifru.ifru_addr    		/* address */
#define    	ifr_dstaddr    ifr_ifru.ifru_dstaddr    /* other end of p-p lnk */
#define    	ifr_broadaddr    ifr_ifru.ifru_broadaddr    /* broadcast address */
#define    	ifr_netmask    ifr_ifru.ifru_netmask    /* interface net mask    */
#define    	ifr_flags    ifr_ifru.ifru_flags    	/* flags */
#define    	ifr_metric    ifr_ifru.ifru_ivalue    	/* metric */
#define    	ifr_mtu        ifr_ifru.ifru_mtu    	/* mtu */
#define 	ifr_map		ifr_ifru.ifru_map    		/* device map */
#define 	ifr_slave    ifr_ifru.ifru_slave   		/* slave device */
#define    	ifr_data    ifr_ifru.ifru_data    		/* for use by interface */
#define 	ifr_ifindex    ifr_ifru.ifru_ivalue		/* interface index */
#define 	ifr_bandwidth    ifr_ifru.ifru_ivalue   /* link bandwidth */
#define 	ifr_qlen    ifr_ifru.ifru_ivalue    	/* Queue length */
#define 	ifr_newname    ifr_ifru.ifru_newname    /* New name */
#define 	ifr_settings    ifr_ifru.ifru_settings  /* Device/proto settings*/

image-20230505231057252

  • 编程示例:

    #include <arpa/inet.h>
    #include <net/if.h>
    #include <net/if_arp.h>
    #include <netinet/in.h>
    #include <stdio.h>
    #include <sys/ioctl.h>
    #include <sys/socket.h>
    #include <unistd.h>
     
    #define MAXINTERFACES 16    /* 最大接口数 */
     
    int fd;         /* 套接字 */
    int if_len;     /* 接口数量 */
    struct ifreq buf[MAXINTERFACES];    /* ifreq结构数组 */
    struct ifconf ifc;                  /* ifconf结构 */
     
    int main(argc, argv)
    {
        /* 建立IPv4的UDP套接字fd */
        if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
        {
            perror("socket(AF_INET, SOCK_DGRAM, 0)");
            return -1;
        }
     
        /* 初始化ifconf结构 */
        ifc.ifc_len = sizeof(buf);
        ifc.ifc_buf = (caddr_t) buf;
     
        /* 获得接口列表 */
        if (ioctl(fd, SIOCGIFCONF, (char *) &ifc) == -1)
        {
            perror("SIOCGIFCONF ioctl");
            return -1;
        }
     
        if_len = ifc.ifc_len / sizeof(struct ifreq); /* 接口数量 */
        printf("接口数量:%d\n", if_len);
     
        while (if_len > 0) /* 遍历每个接口 */
        {
            printf("接口:%s/n", buf[if_len].ifr_name); /* 接口名称 */
     
            /* 获得接口标志 */
            if (!(ioctl(fd, SIOCGIFFLAGS, (char *) &buf[if_len])))
            {
                /* 接口状态 */
                if (buf[if_len].ifr_flags & IFF_UP)
                {
                    printf("接口状态: UP\n");
                }
                else
                {
                    printf("接口状态: DOWN\n");
                }
            }
            else
            {
                char str[256];
                sprintf(str, "SIOCGIFFLAGS ioctl %s", buf[if_len].ifr_name);
                perror(str);
            }
     
     
            /* IP地址 */
            if (!(ioctl(fd, SIOCGIFADDR, (char *) &buf[if_len])))
            {
                printf("IP地址:%s/n",\
                       (char*)inet_ntoa(((struct sockaddr_in*)(&buf[if_len].ifr_addr))->sin_addr));
            }
            else
            {
                char str[256];
                sprintf(str, "SIOCGIFADDR ioctl %s", buf[if_len].ifr_name);
                perror(str);
            }
     
            /* 子网掩码 */
            if (!(ioctl(fd, SIOCGIFNETMASK, (char *) &buf[if_len])))
            {
                printf("子网掩码:%s/n",
                        (char*)inet_ntoa(((struct sockaddr_in*)(&buf[if_len].ifr_addr))->sin_addr));
            }
            else
            {
                char str[256];
                sprintf(str, "SIOCGIFADDR ioctl %s", buf[if_len].ifr_name);
                perror(str);
            }
     
            /* 广播地址 */
            if (!(ioctl(fd, SIOCGIFBRDADDR, (char *) &buf[if_len])))
            {
                printf("广播地址:%s/n",
                        (char*)inet_ntoa(((struct sockaddr_in*) (&buf[if_len].ifr_addr))->sin_addr));
            }
            else
            {
                char str[256];
                sprintf(str, "SIOCGIFADDR ioctl %s", buf[if_len].ifr_name);
                perror(str);
            }
     
            /*MAC地址 */
            if (!(ioctl(fd, SIOCGIFHWADDR, (char *) &buf[if_len])))
            {
                printf("MAC地址:%02x:%02x:%02x:%02x:%02x:%02x/n/n",
                        (unsigned char) buf[if_len].ifr_hwaddr.sa_data[0],
                        (unsigned char) buf[if_len].ifr_hwaddr.sa_data[1],
                        (unsigned char) buf[if_len].ifr_hwaddr.sa_data[2],
                        (unsigned char) buf[if_len].ifr_hwaddr.sa_data[3],
                        (unsigned char) buf[if_len].ifr_hwaddr.sa_data[4],
                        (unsigned char) buf[if_len].ifr_hwaddr.sa_data[5]);
            }
            else
            {
                char str[256];
                sprintf(str, "SIOCGIFHWADDR ioctl %s", buf[if_len].ifr_name);
                perror(str);
            }
        }//while end
     
        //关闭socket
        close(fd);
        return 0;
    }
    
  • 拓展链接

    • http://blog.csdn.net/jk110333/article/details/8832077
    • http://www.360doc.com/content/12/0314/15/5782959_194281431.shtml

6.3 socket

  • \linux-2.6.32.63\include\linux\net.h
struct socket 
{    
    /*
    1. state:socket状态
    typedef enum 
    {
        SS_FREE = 0,            //该socket还未分配
        SS_UNCONNECTED,         //未连向任何socket
        SS_CONNECTING,          //正在连接过程中
        SS_CONNECTED,           //已连向一个socket
        SS_DISCONNECTING        //正在断开连接的过程中
    }socket_state; 
    */
    socket_state        state;

    kmemcheck_bitfield_begin(type);
    /*
    2. type:socket类型
    enum sock_type 
    {
        SOCK_STREAM    	= 1,    //stream (connection) socket
        SOCK_DGRAM    	= 2,    //datagram (conn.less) socket
        SOCK_RAW    	= 3,    //raw socket
        SOCK_RDM    	= 4,    //reliably-delivered message
        SOCK_SEQPACKET  = 5,	//sequential packet socket
        SOCK_DCCP    	= 6,    //Datagram Congestion Control Protocol socket
        SOCK_PACKET    	= 10,   //linux specific way of getting packets at the dev level.
    };
    */
    short            type;
    kmemcheck_bitfield_end(type);

    /*
    3. flags:socket标志
        1) #define SOCK_ASYNC_NOSPACE 	0
        2) #define SOCK_ASYNC_WAITDATA 	1
        3) #define SOCK_NOSPACE 		2
        4) #define SOCK_PASSCRED 		3
        5) #define SOCK_PASSSEC 		4
    */
    unsigned long        flags;

    //fasync_list is used when processes have chosen asynchronous handling of this 'file'
    struct fasync_struct    *fasync_list;
    //4. Not used by sockets in AF_INET
    wait_queue_head_t    wait;

    //5. file holds a reference to the primary file structure associated with this socket
    struct file        *file;

    //6. sk contains most of the useful state associated with a socket. 
    struct sock        *sk;

    //7. ops:定义了当前socket的处理函数
    const struct proto_ops    *ops;
};

6.4 sock

  • struct sock本身不能获取到当前socket的IPPort相关信息,要通过inet_sk()进行转换得到struct inet_sock才能得到IP、Port相关信息。但struct sock保存了当前socket大量的元描述信息。
  • \linux-2.6.32.63\include\net\sock.h
struct sock 
{
    /*
     * Now struct inet_timewait_sock also uses sock_common, so please just
     * don't add nothing before this first member (__sk_common) --acme
     */
    //shared layout with inet_timewait_sock
    struct sock_common    __sk_common;
#define sk_node            __sk_common.skc_node
#define sk_nulls_node        __sk_common.skc_nulls_node
#define sk_refcnt        __sk_common.skc_refcnt

#define sk_copy_start        __sk_common.skc_hash
#define sk_hash            __sk_common.skc_hash
#define sk_family        __sk_common.skc_family
#define sk_state        __sk_common.skc_state
#define sk_reuse        __sk_common.skc_reuse
#define sk_bound_dev_if        __sk_common.skc_bound_dev_if
#define sk_bind_node        __sk_common.skc_bind_node
#define sk_prot            __sk_common.skc_prot
#define sk_net            __sk_common.skc_net

    kmemcheck_bitfield_begin(flags);
    //mask of %SEND_SHUTDOWN and/or %RCV_SHUTDOWN
    unsigned int sk_shutdown  : 2,
                //%SO_NO_CHECK setting, wether or not checkup packets
                sk_no_check  : 2,
                //%SO_SNDBUF and %SO_RCVBUF settings
                sk_userlocks : 4,
                //which protocol this socket belongs in this network family
                sk_protocol  : 8,
                //socket type (%SOCK_STREAM, etc)
                sk_type      : 16;
    kmemcheck_bitfield_end(flags);
    
    int            sk_rcvbuf;	//size of receive buffer in bytes  
    socket_lock_t        sk_lock;	//synchronizer
    /*
     * The backlog queue is special, it is always used with
     * the per-socket spinlock held and requires low latency
     * access. Therefore we special case it's implementation.
     */
    struct 
    {
        struct sk_buff *head;
        struct sk_buff *tail;
    } sk_backlog;
    
    wait_queue_head_t    *sk_sleep;	//sock wait queue
    
    struct dst_entry    *sk_dst_cache;	//destination cache

#ifdef CONFIG_XFRM
    struct xfrm_policy    *sk_policy[2];	//flow policy
#endif

    rwlock_t        sk_dst_lock;    	//destination cache lock
    atomic_t        sk_rmem_alloc;    	//receive queue bytes committed
    atomic_t        sk_wmem_alloc;		//transmit queue bytes committed
    atomic_t        sk_omem_alloc;		//"o" is "option" or "other"

    int            sk_sndbuf;    //size of send buffer in bytes

    struct sk_buff_head    sk_receive_queue;    //incoming packets
    struct sk_buff_head    sk_write_queue;    //Packet sending queue

#ifdef CONFIG_NET_DMA
    struct sk_buff_head    sk_async_wait_queue;    //DMA copied packets
#endif

    int            sk_wmem_queued;    //persistent queue size
    int            sk_forward_alloc;    //space allocated forward
    gfp_t            sk_allocation;    //allocation mode
    int            sk_route_caps;    //route capabilities (e.g. %NETIF_F_TSO)
    int            sk_gso_type;    //GSO type (e.g. %SKB_GSO_TCPV4)
    unsigned int        sk_gso_max_size;    //Maximum GSO segment size to build
    int            sk_rcvlowat;    //%SO_RCVLOWAT setting
    /*
    1. %SO_LINGER (l_onoff)
    2. %SO_BROADCAST
    3. %SO_KEEPALIVE
    4. %SO_OOBINLINE settings
    5. %SO_TIMESTAMPING settings
    */
    unsigned long         sk_flags;
    
    unsigned long            sk_lingertime;	//%SO_LINGER l_linger setting
    struct sk_buff_head    sk_error_queue;    //rarely used
    //sk_prot of original sock creator (see ipv6_setsockopt, IPV6_ADDRFORM for instance)
    struct proto        *sk_prot_creator;
    
    //used with the callbacks in the end of this struct
    rwlock_t        sk_callback_lock;
    //last error
    int            sk_err,
                //rrors that don't cause failure but are the cause of a persistent failure not just 'timed out'
                sk_err_soft;
                    //raw/udp drops counter
    atomic_t        sk_drops;
    //always used with the per-socket spinlock held
    //current listen backlog
    unsigned short        sk_ack_backlog;
    //listen backlog set in listen()
    unsigned short        sk_max_ack_backlog;
    //%SO_PRIORITY setting
    __u32            sk_priority;
    //%SO_PEERCRED setting
    struct ucred        sk_peercred;
    //%SO_RCVTIMEO setting
    long            sk_rcvtimeo;
    //%SO_SNDTIMEO setting
    long            sk_sndtimeo;
    //socket filtering instructions
    struct sk_filter          *sk_filter;
    //private area, net family specific, when not using slab
    void            *sk_protinfo;
    //sock cleanup timer
    struct timer_list    sk_timer;
    //time stamp of last packet received
    ktime_t            sk_stamp;
    //Identd and reporting IO signals
    struct socket        *sk_socket;
    //RPC layer private data
    void            *sk_user_data;
    //cached page for sendmsg
    struct page        *sk_sndmsg_page;
    //front of stuff to transmit
    struct sk_buff        *sk_send_head;
    //cached offset for sendmsg
    __u32            sk_sndmsg_off;
    //a write to stream socket waits to start
    int            sk_write_pending;
#ifdef CONFIG_SECURITY
    //used by security modules
    void            *sk_security;
#endif
    //generic packet mark
    __u32            sk_mark;
    /* XXX 4 bytes hole on 64 bit */
    //callback to indicate change in the state of the sock
    void            (*sk_state_change)(struct sock *sk);
    //callback to indicate there is data to be processed
    void            (*sk_data_ready)(struct sock *sk, int bytes);
    //callback to indicate there is bf sending space available
    void            (*sk_write_space)(struct sock *sk);
    //callback to indicate errors (e.g. %MSG_ERRQUEUE)
    void            (*sk_error_report)(struct sock *sk);
    //callback to process the backlog
      int            (*sk_backlog_rcv)(struct sock *sk, struct sk_buff *skb);  
      //called at sock freeing time, i.e. when all refcnt == 0
    void                    (*sk_destruct)(struct sock *sk);
}

6.5 proto_ops

  • \linux-2.6.32.63\include\linux\net.h
struct proto_ops 
{
    int family;
    struct module    *owner;
    int (*release)(struct socket *sock);
    int (*bind)(struct socket *sock, struct sockaddr *myaddr, int sockaddr_len);
    int (*connect)(struct socket *sock, struct sockaddr *vaddr, int sockaddr_len, int flags);
    int (*socketpair)(struct socket *sock1, struct socket *sock2);
    int (*accept)(struct socket *sock, struct socket *newsock, int flags);
    
    int (*getname)(struct socket *sock, \
                   struct sockaddr *addr, \
                   int *sockaddr_len, int peer);
    
    unsigned int (*poll)(struct file *file, \
                         struct socket *sock, \
                         struct poll_table_struct *wait);
    
    int (*ioctl)(struct socket *sock, unsigned int cmd, unsigned long arg);
    int (*compat_ioctl)(struct socket *sock, unsigned int cmd, unsigned long arg);
    int (*listen)(struct socket *sock, int len);
    int (*shutdown)  (struct socket *sock, int flags);
    
    int (*setsockopt)(struct socket *sock, int level,\
                      int optname, char __user *optval, unsigned int optlen);
    
    int (*getsockopt)(struct socket *sock, int level, \
                      int optname, char __user *optval, int __user *optlen);
    
    int (*compat_setsockopt)(struct socket *sock, int level,\
                             int optname, char __user *optval, unsigned int optlen);
    
    int (*compat_getsockopt)(struct socket *sock, int level, \
                             int optname, char __user *optval, int __user *optlen);
    int (*sendmsg)(struct kiocb *iocb, struct socket *sock, struct msghdr *m, size_t total_len);
    
    /* Notes for implementing recvmsg:
     * ===============================
     * msg->msg_namelen should get updated by the recvmsg handlers
     * iff msg_name != NULL. It is by default 0 to prevent
     * returning uninitialized memory to user space.  The recvfrom
     * handlers can assume that msg.msg_name is either NULL or has
     * a minimum size of sizeof(struct sockaddr_storage).
     */
    int (*recvmsg)(struct kiocb *iocb, struct socket *sock, \
                   struct msghdr *m, size_t total_len, int flags);
    
    int (*mmap)(struct file *file, struct socket *sock, struct vm_area_struct * vma);
    
    ssize_t (*sendpage)(struct socket *sock, \
                        struct page *page, int offset, \
                        size_t size, int flags);
    
    ssize_t (*splice_read)(struct socket *sock,\
                           loff_t *ppos, struct pipe_inode_info *pipe, \
                           size_t len, unsigned int flags);
};

6.6 inet_sock

  • 在实际编程中,我们需要使用inet_sk(),将"struct sock"结果强制转换为"struct inet_sock"之后,才可以从中取出我们想要的IP、Port等信息

  • \linux-2.6.32.63\include\net\inet_sock.h

    static inline struct inet_sock *inet_sk(const struct sock *sk)
    {
        return (struct inet_sock *)sk;
    }
    
  • inet_sock的结构体定义如下

    struct inet_sock 
    {
        /* sk and pinet6 has to be the first two members of inet_sock */
        struct sock        sk;    //ancestor class
    #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
        struct ipv6_pinfo    *pinet6;    //pointer to IPv6 control block
    #endif
        
        /* Socket demultiplex comparisons on incoming packets. */
        //Foreign IPv4 addr
        __be32            daddr;
        //Bound local IPv4 addr
        __be32            rcv_saddr;
        //Destination port
        __be16            dport;
        //Local port
        __u16            num;
        //Sending source
        __be32            saddr;
        //Unicast TTL
        __s16            uc_ttl;
        __u16            cmsg_flags;
        struct ip_options_rcu    *inet_opt;
        //Source port
        __be16            sport;
        //ID counter for DF pkts
        __u16            id;
        //TOS
        __u8            tos;
        //Multicasting TTL
        __u8	mc_ttl;
        __u8    pmtudisc;
        __u8    recverr:1,
                //is this an inet_connection_sock?
                is_icsk:1,
                freebind:1,
                hdrincl:1,
                mc_loop:1,
                transparent:1,
                mc_all:1;
    
        int            mc_index;          //Multicast device index
        __be32            mc_addr;
        struct ip_mc_socklist    *mc_list;
        //info to build ip hdr on each ip frag while socket is corked
        struct 
        {
            unsigned int        flags;
            unsigned int        fragsize;
            struct ip_options    *opt;
            struct dst_entry    *dst;
            int            length; /* Total length of all frames */
            __be32            addr;
            struct flowi        fl;
        } cork;
    };
    

6.7 sockaddr

struct sockaddr 
{
    unsigned short    sa_family;    // address family, AF_xxx
    char	sa_data[14];      // 14 bytes of protocol address
};

/* Structure describing an Internet (IP) socket address. */
#define __SOCK_SIZE__    16        /* sizeof(struct sockaddr)    */

struct sockaddr_in 
{

    sa_family_t	sin_family;        /* Address family */
    __be16	sin_port;    /* Port number */
    struct in_addr    sin_addr;        /* Internet address */

    /* Pad to size of `struct sockaddr'. */
    unsigned char	__pad[__SOCK_SIZE__ - sizeof(short int) - sizeof(unsigned short int) - sizeof(struct in_addr)];
};

#define sin_zero    __pad        /* for BSD UNIX comp. -FvK    */

/* Internet address. */
struct in_addr 
{
    __be32    s_addr;
};

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/518706.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

腾讯云与中电金信发布联合核心方案

5月11日&#xff0c;以“聚力革新&#xff0c;行稳致远”为主题的 “腾讯金融云国产化战略峰会”在北京举办&#xff0c;来自金融业、科技侧、研究机构的专家学者同聚一堂&#xff0c;共同探讨银行核心下移方法论以及国产化转型实践等话题。会议期间&#xff0c;中电金信副总经…

Java面试(2)数据类型

数据类型 1. Java有哪些数据类型 Java基本数据类型 这八种基本类型都有对应的包装类分别为&#xff1a;Byte、Short、Integer、Long、Float、Double、Character、Boolean 。 引用数据类型 引用数据类型非常多&#xff0c;大致包括&#xff1a;类、 接口类型、 数组类型、 枚…

AI低代码平台遍地开花,AI对于低代码到底是帮手还是对手?

AI对于低代码平台到底是帮手还是对手&#xff1f; 近日&#xff0c;CSDN举办的新程序员大会中&#xff0c;对于AI在代码领域的能力进行了5个层级的定义。并且进行了大量的测试&#xff0c;发现当下的AI已经可以去到初级程序员了&#xff0c;而更为强大的GPT-4的代码能力甚至还有…

Goby 漏洞更新 | 铭飞 CMS list 接口 sqlWhere 参数 sql 注入漏洞

漏洞名称&#xff1a;铭飞 CMS list 接口 sqlWhere 参数 sql 注入漏洞 English Name&#xff1a;MCMS list Interface sqlWhere Sql Injection Vulnerability CVSS core: 7.5 影响资产数&#xff1a;3091 漏洞描述&#xff1a; MCMS 是一套基于 java 开发的轻量级开源内容…

【时空权衡】

目录 知识框架No.0 时空权衡一、基本思想 No.1 计数排序二、分布计数 No.2 散列法 知识框架 No.0 时空权衡 一、基本思想 其实时空权衡&#xff1a;是指在算法的设计中&#xff0c;对算法的时间和空间作出权衡。 本文主要是是用空间来换时间的。(应该是这样吧) 对问题的部分或…

同样是做大模型的科技公司,为啥差距这么大呢?

2022年OpenAI亏了30多亿元&#xff0c; 站在风口上&#xff0c;谁的压力会小呢&#xff1f; 【科技明说 &#xff5c; 每日看点】站在风口上。OpenAI公司在2022年亏得十分“灿烂”&#xff0c;和往年同比几乎翻了一倍&#xff0c;亏损约达5.4亿美元&#xff0c;折合人民币约31…

微服架构基础设施环境平台搭建 -(五)Docker常用命令

微服架构基础设施环境平台搭建 -&#xff08;五&#xff09;Docker常用命令 本文主要列出了Docker常用的命令 微服架构基础设施环境平台搭建 系列文章 微服架构基础设施环境平台搭建 -&#xff08;一&#xff09;基础环境准备 微服架构基础设施环境平台搭建 -&#xff08;二&am…

富文本输出如何避免XSS

有时网站为了美观&#xff0c;会允许用户输入一些富文本&#xff0c;这样在显示的时候&#xff0c;就可以显示的更友好。虽然在输入富文本的时候在客户端进行了控制&#xff0c;但是&#xff0c;仍然难易避免一些攻击者通过抓包篡改数据绕过客户端的控制。因此&#xff0c;在服…

【飞行棋】多人游戏-微信小程序开发流程详解

可曾记得小时候玩过的飞行棋游戏&#xff0c;是90后的都有玩过吧&#xff0c;现在重温一下&#xff0c;这是一个可以二到四个人参与的游戏&#xff0c;通过投骰子走棋&#xff0c;一开始靠运气&#xff0c;后面还靠自己选择&#xff0c;谁抢占先机才能赢&#xff0c;还可以和小…

Redis 三大特殊数据类型常见命令

Geospatial 朋友的定位&#xff0c;附近的人&#xff0c;打车距离计算 底层是 Zset&#xff0c;即可以使用Zset的命令操作Geospatial Redis3.2 开始支持的 1.添加地理位置 两极无法添加经度&#xff1a;-180 ~ 180&#xff08;度&#xff09;纬度&#xff1a;-85.05112878 ~ 8…

一、RestTemplate的使用

目录 1、新建项目springcloud&#xff08;File--->New--->Project&#xff09; 使用maven quickstart快速新建Maven项目 输入项目名称和Maven信息 确认Maven目录、配置文件、本地仓库&#xff0c;Finish即可 2、创建聚合项目springcloud-member、springcloud-order(项…

【人力资源管理】第2集 免费开源ERP: Odoo 16 Recruitment招聘管理 构建一体化企业人力资源管理

文章目录 前言一、概览二、主要功能1.组织空缺职位和职位申请2.追踪工作机会&#xff08;查看哪个渠道收到的申请最多&#xff09;3.定制您的招聘流程4.集成文档&#xff08;定义您自己的文件管理流程&#xff09;5.与Odoo应用程序完全集成 总结 前言 轻松处理您的招聘流程。 …

C++ 中到底是应该include .h文件还是应该include .cpp文件

在阅读一个较大的解决方案中&#xff0c;对于其他文件夹下的.h和.cpp文件&#xff0c;有时候#include“XXX.h”文件&#xff0c;有时候是#include“XXX.cpp”文件&#xff0c;而且二者还不能更换。下面就好好分析一下他们二者的区别。 测试 测试&#xff1a;XXX.h和XXX.cpp…

连接器:一种可靠耐用、节约成本的同为科技(TOWE)工业连接器

随着我国经济建设水平的飞速发展&#xff0c;工业连接器被广泛应用于工业、化工、机场、船舶、码头、建筑、铁路、医疗、会展、商业演出等领域。工业连接器的作用是用于连接一个电路导体与另一个电路导体、或一个传输元件与另一个传输元件的装置&#xff0c;并且为两个电路子系…

知识变现海哥:六种常见的知识变现渠道

什么是知识变现&#xff1f;就是用你所会的知识技能&#xff0c;在网上进行展示&#xff0c;吸引人们为其付钱。互联网发展到今天&#xff0c;我们可以看到它各方面已经逐渐完善了&#xff0c;但曾经在互联网上的不花钱的知识&#xff0c;在今天却要为其花费金钱。在此基础上&a…

CCSA TC1演讲分享 | 全域智能,构建平台化生态

日前&#xff0c;中国通信标准化协会&#xff08;CCSA&#xff09;成功召开互联网与应用技术工作委员会&#xff08;TC1&#xff09;第四十次全会&#xff0c;全会期间&#xff0c;TC1 WG7 IT内控与审计技术标准工作组举办了第3次工作组会议。此次会议重点讨论了各项标准文稿及…

微服架构基础设施环境平台搭建 -(四)在Kubernetes集群基础上搭建Kubesphere平台

微服架构基础设施环境平台搭建 -&#xff08;四&#xff09;在Kubernetes集群基础上搭建Kubesphere平台 通过采用微服相关架构构建一套以KubernetesDocker为自动化运维基础平台&#xff0c;以微服务为服务中心&#xff0c;在此基础之上构建业务中台&#xff0c;并通过Jekins自动…

Docker安装及容器安装

Docker安装及容器安装 一、Docker简单介绍 1、Docker是什么 Docker是基于Go语言实现的云开源项目。 Docker是一个开源的应用容器引擎&#xff0c;是容器技术的一种&#xff0c;采用Go编程语言编写。虽然 Docker把容器技术推向了巅峰&#xff0c;但其实&#xff0c;还有其他容…

蓝牙智能升降桌解决方案介绍

传统桌子在办公和学习中具有很大的普及度&#xff0c;但是长时间久坐却会对人体造成可怕的危害。由于不合理的坐姿、长时间久坐等习惯&#xff0c;不仅影响血液循环,让人体感到不适,还会出现视力、颈椎、腰椎、心脏等一系列健康问题。此外&#xff0c;传统桌子通常是固定高度且…

【C++进阶2--多态】面向对象三大特性之一,多种形态像魔法?

今天&#xff0c;带来C多态的讲解。 多态和继承并用&#xff0c;能产生“魔法般的效果”。 *文中不足错漏之处望请斧正&#xff01; 见见多态 是什么 使得父类指针或引用有多种形态。 怎么使它有多种形态呢&#xff1f;咱们先见见猪跑。 见见猪跑 class Base { public:v…