Annotation of qemu/net.h, revision 1.1.1.4

1.1       root        1: #ifndef QEMU_NET_H
                      2: #define QEMU_NET_H
                      3: 
1.1.1.4 ! root        4: #include "sys-queue.h"
1.1.1.2   root        5: #include "qemu-common.h"
                      6: 
1.1       root        7: /* VLANs support */
                      8: 
                      9: typedef struct VLANClientState VLANClientState;
                     10: 
1.1.1.4 ! root       11: typedef int (NetCanReceive)(VLANClientState *);
        !            12: typedef ssize_t (NetReceive)(VLANClientState *, const uint8_t *, size_t);
        !            13: typedef ssize_t (NetReceiveIOV)(VLANClientState *, const struct iovec *, int);
1.1.1.3   root       14: typedef void (NetCleanup) (VLANClientState *);
1.1.1.2   root       15: typedef void (LinkStatusChanged)(VLANClientState *);
                     16: 
1.1       root       17: struct VLANClientState {
1.1.1.4 ! root       18:     NetReceive *receive;
        !            19:     NetReceiveIOV *receive_iov;
1.1       root       20:     /* Packets may still be sent if this returns zero.  It's used to
                     21:        rate-limit the slirp code.  */
1.1.1.4 ! root       22:     NetCanReceive *can_receive;
1.1.1.3   root       23:     NetCleanup *cleanup;
1.1.1.2   root       24:     LinkStatusChanged *link_status_changed;
                     25:     int link_down;
1.1       root       26:     void *opaque;
                     27:     struct VLANClientState *next;
                     28:     struct VLANState *vlan;
1.1.1.2   root       29:     char *model;
                     30:     char *name;
1.1       root       31:     char info_str[256];
                     32: };
                     33: 
1.1.1.4 ! root       34: typedef struct VLANPacket VLANPacket;
        !            35: 
        !            36: typedef void (NetPacketSent) (VLANClientState *, ssize_t);
        !            37: 
        !            38: struct VLANPacket {
        !            39:     TAILQ_ENTRY(VLANPacket) entry;
        !            40:     VLANClientState *sender;
        !            41:     int size;
        !            42:     NetPacketSent *sent_cb;
        !            43:     uint8_t data[0];
        !            44: };
        !            45: 
1.1       root       46: struct VLANState {
                     47:     int id;
                     48:     VLANClientState *first_client;
                     49:     struct VLANState *next;
                     50:     unsigned int nb_guest_devs, nb_host_devs;
1.1.1.4 ! root       51:     TAILQ_HEAD(send_queue, VLANPacket) send_queue;
        !            52:     int delivering;
1.1       root       53: };
                     54: 
1.1.1.4 ! root       55: VLANState *qemu_find_vlan(int id, int allocate);
1.1       root       56: VLANClientState *qemu_new_vlan_client(VLANState *vlan,
1.1.1.2   root       57:                                       const char *model,
                     58:                                       const char *name,
1.1.1.4 ! root       59:                                       NetCanReceive *can_receive,
        !            60:                                       NetReceive *receive,
        !            61:                                       NetReceiveIOV *receive_iov,
1.1.1.3   root       62:                                       NetCleanup *cleanup,
1.1       root       63:                                       void *opaque);
1.1.1.2   root       64: void qemu_del_vlan_client(VLANClientState *vc);
                     65: VLANClientState *qemu_find_vlan_client(VLANState *vlan, void *opaque);
1.1       root       66: int qemu_can_send_packet(VLANClientState *vc);
1.1.1.2   root       67: ssize_t qemu_sendv_packet(VLANClientState *vc, const struct iovec *iov,
                     68:                           int iovcnt);
1.1.1.4 ! root       69: ssize_t qemu_sendv_packet_async(VLANClientState *vc, const struct iovec *iov,
        !            70:                                 int iovcnt, NetPacketSent *sent_cb);
1.1       root       71: void qemu_send_packet(VLANClientState *vc, const uint8_t *buf, int size);
1.1.1.4 ! root       72: ssize_t qemu_send_packet_async(VLANClientState *vc, const uint8_t *buf,
        !            73:                                int size, NetPacketSent *sent_cb);
        !            74: void qemu_purge_queued_packets(VLANClientState *vc);
        !            75: void qemu_flush_queued_packets(VLANClientState *vc);
1.1.1.2   root       76: void qemu_format_nic_info_str(VLANClientState *vc, uint8_t macaddr[6]);
                     77: void qemu_check_nic_model(NICInfo *nd, const char *model);
                     78: void qemu_check_nic_model_list(NICInfo *nd, const char * const *models,
                     79:                                const char *default_model);
1.1       root       80: void qemu_handler_true(void *opaque);
                     81: 
1.1.1.4 ! root       82: void do_info_network(Monitor *mon);
        !            83: void do_set_link(Monitor *mon, const char *name, const char *up_or_down);
        !            84: 
        !            85: void do_info_usernet(Monitor *mon);
1.1       root       86: 
                     87: /* NIC info */
                     88: 
                     89: #define MAX_NICS 8
1.1.1.4 ! root       90: enum {
        !            91:        NIC_NVECTORS_UNSPECIFIED = -1
        !            92: };
1.1       root       93: 
                     94: struct NICInfo {
                     95:     uint8_t macaddr[6];
                     96:     const char *model;
1.1.1.2   root       97:     const char *name;
1.1.1.4 ! root       98:     const char *devaddr;
        !            99:     const char *id;
1.1       root      100:     VLANState *vlan;
1.1.1.4 ! root      101:     VLANClientState *vc;
1.1.1.2   root      102:     void *private;
                    103:     int used;
1.1.1.4 ! root      104:     int bootable;
        !           105:     int nvectors;
1.1       root      106: };
                    107: 
                    108: extern int nb_nics;
                    109: extern NICInfo nd_table[MAX_NICS];
                    110: 
1.1.1.2   root      111: /* BT HCI info */
                    112: 
                    113: struct HCIInfo {
                    114:     int (*bdaddr_set)(struct HCIInfo *hci, const uint8_t *bd_addr);
                    115:     void (*cmd_send)(struct HCIInfo *hci, const uint8_t *data, int len);
                    116:     void (*sco_send)(struct HCIInfo *hci, const uint8_t *data, int len);
                    117:     void (*acl_send)(struct HCIInfo *hci, const uint8_t *data, int len);
                    118:     void *opaque;
                    119:     void (*evt_recv)(void *opaque, const uint8_t *data, int len);
                    120:     void (*acl_recv)(void *opaque, const uint8_t *data, int len);
                    121: };
                    122: 
                    123: struct HCIInfo *qemu_next_hci(void);
                    124: 
                    125: /* checksumming functions (net-checksum.c) */
                    126: uint32_t net_checksum_add(int len, uint8_t *buf);
                    127: uint16_t net_checksum_finish(uint32_t sum);
                    128: uint16_t net_checksum_tcpudp(uint16_t length, uint16_t proto,
                    129:                              uint8_t *addrs, uint8_t *buf);
                    130: void net_checksum_calculate(uint8_t *data, int length);
                    131: 
                    132: /* from net.c */
1.1.1.4 ! root      133: extern const char *legacy_tftp_prefix;
        !           134: extern const char *legacy_bootp_filename;
        !           135: 
        !           136: int net_client_init(Monitor *mon, const char *device, const char *p);
1.1.1.2   root      137: void net_client_uninit(NICInfo *nd);
                    138: int net_client_parse(const char *str);
                    139: void net_slirp_smb(const char *exported_dir);
1.1.1.4 ! root      140: void net_slirp_hostfwd_add(Monitor *mon, const char *arg1,
        !           141:                            const char *arg2, const char *arg3);
        !           142: void net_slirp_hostfwd_remove(Monitor *mon, const char *arg1,
        !           143:                               const char *arg2, const char *arg3);
1.1.1.2   root      144: void net_slirp_redir(const char *redir_str);
                    145: void net_cleanup(void);
                    146: void net_client_check(void);
1.1.1.4 ! root      147: void net_set_boot_mask(int boot_mask);
        !           148: void net_host_device_add(Monitor *mon, const char *device, const char *opts);
        !           149: void net_host_device_remove(Monitor *mon, int vlan_id, const char *device);
1.1.1.2   root      150: 
                    151: #define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup"
                    152: #define DEFAULT_NETWORK_DOWN_SCRIPT "/etc/qemu-ifdown"
                    153: #ifdef __sun__
                    154: #define SMBD_COMMAND "/usr/sfw/sbin/smbd"
                    155: #else
                    156: #define SMBD_COMMAND "/usr/sbin/smbd"
                    157: #endif
                    158: 
1.1.1.4 ! root      159: void qdev_get_macaddr(DeviceState *dev, uint8_t *macaddr);
        !           160: VLANClientState *qdev_get_vlan_client(DeviceState *dev,
        !           161:                                       NetCanReceive *can_receive,
        !           162:                                       NetReceive *receive,
        !           163:                                       NetReceiveIOV *receive_iov,
        !           164:                                       NetCleanup *cleanup,
        !           165:                                       void *opaque);
        !           166: 
1.1       root      167: #endif

unix.superglobalmegacorp.com