modify code standard

This commit is contained in:
Liu_Weichao
2021-04-29 16:39:24 +08:00
parent c86adeda94
commit ff2904ac26
13 changed files with 75 additions and 94 deletions

View File

@@ -240,7 +240,7 @@ __exit:
return result;
}
int EthernetPing(struct AdapterAT *adapterAT, const char *destination,struct ping_result *ping_resp)
int EthernetPing(struct AdapterAT *adapterAT, const char *destination,struct PingResult *ping_resp)
{
char *ping_result = NONE;
ping_result = (char *) UserCalloc(1, 17);

View File

@@ -43,9 +43,9 @@ struct Socket
{
uint8_t fd;
uint8_t status ;
struct ADDRESS_IPV4 src_ip;
struct AddressIpv4 src_ip;
uint16_t src_port;
struct ADDRESS_IPV4 dst_ip;
struct AddressIpv4 dst_ip;
uint16_t dst_port;
uint8_t type;
uint8_t af_type;
@@ -59,24 +59,24 @@ struct ATDone
int (*ATOperateUp)(struct AdapterAT *adapterAT);
int (*ATOperateDown)(struct AdapterAT *adapterAT);
int (*ATOperateAddr)(struct AdapterAT *adapterAT, uint ip, uint gateway, uint netmask);
int (*ATOperateDns)(struct AdapterAT *adapterAT, struct ADDRESS_IPV4 *dns_addr, uint8 dns_count);
int (*ATOperateDns)(struct AdapterAT *adapterAT, struct AddressIpv4 *dns_addr, uint8 dns_count);
int (*ATOperateDHCP)(struct AdapterAT *adapterAT, bool enable);
int (*ATPing)(struct AdapterAT *adapterAT, const char *destination, struct ping_result *ping_resp);
int (*ATPing)(struct AdapterAT *adapterAT, const char *destination, struct PingResult *ping_resp);
int (*ATNetstat)(struct AdapterAT *adapterAT);
int (*ATOperateDefault)(struct AdapterAT *adapterAT);
int (*ATSocketCreate)(struct AdapterAT *adapterAT , uint8_t socket_fd , uint8_t type , uint8_t af_type );
int (*ATSocketConnect)(struct AdapterAT *adapterAT , uint8_t socket_fd , struct ADDRESS_IPV4 dst_ip , uint16_t dst_port, uint8 is_client);
int (*ATSocketConnect)(struct AdapterAT *adapterAT , uint8_t socket_fd , struct AddressIpv4 dst_ip , uint16_t dst_port, uint8 is_client);
int (*ATSocketClose)(struct AdapterAT *adapterAT , uint8_t socket_fd );
};
struct AdapterAT {
struct Adapter parent;
struct ATAgent *agent;
struct ADDRESS_IPV4 ip;
struct ADDRESS_IPV4 netmask;
struct ADDRESS_IPV4 gateway;
struct ADDRESS_IPV4 dns[DNS_COUNT];
struct AddressIpv4 ip;
struct AddressIpv4 netmask;
struct AddressIpv4 gateway;
struct AddressIpv4 dns[DNS_COUNT];
uint32 at_adapter_id;
struct Socket socket[SOCKET_MAX];
uint8 hardware_address_len;
@@ -84,7 +84,7 @@ struct AdapterAT {
uint16 flags;
uint16 mtu;
void (*change_cb )(struct AdapterAT *adapterAT, enum cb_type type, enum change_type ch_type_);
void (*change_cb )(struct AdapterAT *adapterAT, enum CbType type, enum ChangeType ch_type_);
struct ATDone atdone;

View File

@@ -42,7 +42,7 @@ int EthernetReceive(struct Adapter *padapter, char *rev_buffer, int buffer_len,
int EthernetSetUp(struct AdapterAT *adapterAT);
int EthernetDHCP(struct AdapterAT *adapterAT, bool enable);
int EthernetPing(struct AdapterAT *adapterAT, const char *destination, struct ping_result *ping_resp);
int EthernetPing(struct AdapterAT *adapterAT, const char *destination, struct PingResult *ping_resp);
int EthernetNetstat(struct AdapterAT *adapterAT);
#endif

View File

@@ -44,7 +44,7 @@ int WifiSetUp(struct AdapterAT *adapter_at);
int WifiSetDown(struct AdapterAT *adapter_at);
int WifiSetAddr(struct AdapterAT *adapter_at, uint ip, uint gateway, uint netmask);
int WifiDHCP(struct AdapterAT *adapter_at, bool enable);
int WifiPing(struct AdapterAT *adapter_at, const char *destination,struct ping_result *ping_resp);
int WifiPing(struct AdapterAT *adapter_at, const char *destination,struct PingResult *ping_resp);
int WifiNetstat(struct AdapterAT *adapter_at);
#endif

View File

@@ -31,7 +31,7 @@ typedef void(*send_success)(void* param);
#define DNS_COUNT 2U
#define HW_MAX 8U
enum cb_type
enum CbType
{
CB_ADDR_IP, /* IP address */
CB_ADDR_NETMASK, /* subnet mask */
@@ -47,24 +47,24 @@ enum cb_type
CB_STATUS_DHCP_DISABLE, /* disable DHCP capability */
};
enum change_type
enum ChangeType
{
addr_change,
status_change,
ADDR_CHANGE,
STATUS_CHANGE,
};
struct ADDRESS_IPV4
struct AddressIpv4
{
uint32 ipv4;
};
struct ping_result
struct PingResult
{
struct ADDRESS_IPV4 ip_addr; /* response IP address */
struct AddressIpv4 ip_addr; /* response IP address */
uint16 data_len; /* response data length */
uint16 ttl; /* time to live */
uint32 ticks; /* response time, unit tick */
void *UserData; /* user-specific data */
void *user_data; /* user-specific data */
};
#define ETHERNET_ADAPTER_ID 0x03U

View File

@@ -304,7 +304,7 @@ __exit:
return result;
}
int WifiPing(struct AdapterAT *adapter_at, const char *destination,struct ping_result *ping_resp)
int WifiPing(struct AdapterAT *adapter_at, const char *destination,struct PingResult *ping_resp)
{
char *ping_result = NONE;
char *dst = NONE;