lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | /** |
| 2 | * @file netapi.h |
| 3 | * @brief Public APIs of Sanechips, linux network external interface |
| 4 | * |
| 5 | * Copyright (C) 2017 Sanechips Technology Co., Ltd. |
| 6 | * @author Linxu Gebin |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License version 2 as |
| 10 | * published by the Free Software Foundation. |
| 11 | * |
| 12 | ************************************************************************ |
| 13 | */ |
| 14 | |
| 15 | #ifndef __NETAPI_H__ |
| 16 | #define __NETAPI_H__ |
| 17 | |
| 18 | /******************************************************************************* |
| 19 | * Include header files * |
| 20 | ******************************************************************************/ |
| 21 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 22 | /******************************************************************************* |
| 23 | * Macro definitions * |
| 24 | ******************************************************************************/ |
| 25 | /** |
| 26 | * @brief NVÖµµÄ³¤¶È£¬ÎªÁ˽Úʡջ¿Õ¼äʹÓÃÕâ¸öºê£¬ÈôʹÓÃNV_MAX_KEY_LENÓпÉÄÜ»áÔì³ÉÕ»Ô½½ç |
| 27 | */ |
| 28 | #define NV_NAME_LEN 30 |
| 29 | |
| 30 | #define RJ45_ALL_OUT 0x00 |
| 31 | #define RJ45_LAN_IN 0x01 |
| 32 | #define RJ45_WAN_IN 0x02 |
| 33 | #define RJ45_ALL_IN 0x03 |
| 34 | |
| 35 | #define USB_LAN_OUT 0x00 |
| 36 | #define USB_LAN_IN 0x01 |
| 37 | |
| 38 | |
| 39 | |
| 40 | /** |
| 41 | * @brief ¹©atÏà¹ØÓ¦Óýø³Ìµ÷ÓÃÍøÂç½Ó¿Úʱ¸³Öµ£¬Ö¸Ê¾PDP ¼¤»îµÄ·¢ÆðλÖ㬽ø¶ø¹©ÍøÂçÄÚ²¿½øÐв»Í¬×éÍøºÍ·ÓÉÅäÖà |
| 42 | * @param PDP_LOCAL ±íʾÊDZ¾µØÓ¦Ó÷¢ÆðµÄPDP¼¤»î£¬Èç²ÊÐÅ¡¢VoLTEµÈ |
| 43 | * @param PDP_EXT ±íʾÊÇÓɷDZ¾ºËÄÚ·¢ÆðµÄATÃüÁîÁ÷³Ì£¬Èç´ó°å·¢ÆðµÄATÃüÁÎÒÃǺËÄÚ½ö×÷͸´«£¬´ËʱÐèÒª¶ÔÍø¿Ú½øÐÐÖ±Á¬£» |
| 44 | * @param PDP_NORMAL ±íʾÊDZ¾ºËµÄatserver·¢ÆðµÄPDP¼¤»î£¬ÓÃÓÚNATת»»µÄÍâÍø¿Ú |
| 45 | * @param PDP_PPP ±íʾÊDZ¾ºËµÄPPPÏà¹ØµÄPDP¼¤»î£¬³£¼ûÓÚÄ£¿éµÄPPP¹¦ÄÜÐèÇó |
| 46 | */ |
| 47 | #define PDP_LOCAL 0 |
| 48 | #define PDP_EXT 1 |
| 49 | #define PDP_NORMAL 2 |
| 50 | #define PDP_PPP 3 |
| 51 | |
| 52 | #define NONE_AUTH 0 |
| 53 | #define PAP_AUTH 1 |
| 54 | #define CHAP_AUTH 2 |
| 55 | #define PAP_CHAP_AUTH 3 |
| 56 | #define PPP_NONE_AUTH 4 |
| 57 | #define PPP_CHAP_AUTH 5 |
| 58 | #define PPP_PAP_AUTH PAP_AUTH |
| 59 | |
| 60 | /** |
| 61 | * @brief IPV4µØÖ·³¤¶ÈÉÏÏÞ |
| 62 | */ |
| 63 | #define IPV4ADDLEN_MAX 16 |
| 64 | |
| 65 | /** |
| 66 | * @brief IPV6µØÖ·³¤¶ÈÉÏÏÞ |
| 67 | */ |
| 68 | #define IPV6ADDLEN_MAX 46 |
| 69 | |
| 70 | /** |
| 71 | * @brief MACµØÖ·³¤¶ÈÉÏÏÞ |
| 72 | */ |
| 73 | #define MAX_MACADDR_LEN 14 |
| 74 | |
| 75 | /** |
| 76 | * @brief MACµØÖ·³¤¶È |
| 77 | */ |
| 78 | #define MAC_ADDR_LEN 18 |
| 79 | |
| 80 | /** |
| 81 | * @brief Ö÷»úÃû³¤¶È |
| 82 | */ |
| 83 | #define HOSTNAME_LEN 150 |
| 84 | |
| 85 | /** |
| 86 | * @brief ÍøÖ·³¤¶È |
| 87 | */ |
| 88 | #define SITE_LEN 400 |
| 89 | |
| 90 | |
| 91 | /** |
| 92 | * @brief PPPDʹÓõĺ궨Òå |
| 93 | * @param NUM_PPPD_AUTH Ò»¸öppp½ø³ÌÖ§³ÖµÄÓû§ÊýÁ¿ |
| 94 | * @param USER_MAX Óû§Ãû»òÕßÌôÕ½idµÄ³¤¶ÈÉÏÏÞ |
| 95 | * @param PW_MAX ÃÜÂëµÄ³¤¶ÈÉÏÏÞ |
| 96 | * @param CHALLENGE_MAX ÌôÕ½»ØÓ¦ÉÏÏÞ |
| 97 | */ |
| 98 | #define NUM_PPPD_AUTH 1 |
| 99 | #define USER_MAX 50 |
| 100 | #define PW_MAX 50 |
| 101 | #define CHALLENGE_MAX 50 |
| 102 | |
| 103 | |
| 104 | /** |
| 105 | * @brief ¶¨ÒåPDP¼¤»îÀàÐÍ |
| 106 | * @param V4V6_INVALID ³õʼֵ£¬²»½øÐÐÈκβÙ×÷ |
| 107 | * @param V4_VALID ¶ÔV4½øÐвÙ×÷£¬°üÀ¨¼¤»îºÍÈ¥»î |
| 108 | * @param V6_VALID ¶ÔV6½øÐвÙ×÷£¬°üÀ¨¼¤»îºÍÈ¥»î |
| 109 | * @param V46_VALID ¶ÔV4ºÍV6½øÐвÙ×÷£¬°üÀ¨¼¤»îºÍÈ¥»î |
| 110 | */ |
| 111 | enum ipv4v6_flag { |
| 112 | V4V6_INVALID = 0x00, |
| 113 | V4_VALID, |
| 114 | V6_VALID, |
| 115 | V46_VALID, |
| 116 | }; |
| 117 | |
| 118 | /** |
| 119 | * @brief ¶¨ÒåÍø¿Ú״̬ |
| 120 | * @param DEV_STATE_IDLE ÍøÂçÉ豸´¦ÓÚ¿ÕÏÐ״̬ |
| 121 | * @param DEV_STATE_CONNECT ÍøÂçÉ豸´¦ÓÚ»ñÈ¡µØÖ·×´Ì¬ |
| 122 | * @param DEV_STATE_WORKING ÍøÂçÉ豸»ñÈ¡µØÖ·Íê³É£¬´¦ÓÚ¹¤×÷״̬ |
| 123 | * @param DEV_STATE_DEAD ÍøÂçÉ豸´¦ÓÚÍøÂçÁ¬½Ó¶Ï¿ª×´Ì¬ |
| 124 | */ |
| 125 | enum emDev_State { |
| 126 | DEV_STATE_IDLE, |
| 127 | DEV_STATE_CONNECT, |
| 128 | DEV_STATE_WORKING, |
| 129 | DEV_STATE_DEAD, |
| 130 | }; |
| 131 | |
| 132 | /** |
| 133 | * brief ¶¨ÒåËùÓеÄÄÚÍâÍø¿Ú¡¢¼¶ÁªµÈÍøÂçÉ豸IDºêÖµ |
| 134 | * @param PS_NET_DEV PS ÍøÂçÉ豸±êʶ£¬µ±ÔËÐÐÔÚAPºËʱ£¬Æä¶ÔÓ¦µÄÍøÂçÉ豸ΪUSB¡¢DDRNETµÈÐéÄâ³öµÄÍøÂçÉ豸 |
| 135 | * @param PS_EXT_DEV1 ÓëPS¼¶ÁªµÄÍøÂçÉ豸£¬³£¼ûÓÚÊý¾Ý¿¨ÐÎ̬£¬Ò»°ãΪUSBÎïÀíͨµÀ£¬Ò²¿ÉÄÜÊǹ²ÏíDDRµÈͨµÀ£¬µ«¹²ÏíDDRͨµÀÎÞÈȲå°ÎʼþÉϱ¨ |
| 136 | * @param PS_EXT_DEV2 Ŀǰ֧³Ö1-8µÄCID¹ØÁª |
| 137 | * @param PS_EXT_DEV3 Ŀǰ֧³Ö1-8µÄCID¹ØÁª |
| 138 | * @param PS_EXT_DEV4 Ŀǰ֧³Ö1-8µÄCID¹ØÁª |
| 139 | * @param PS_EXT_DEV5 Ŀǰ֧³Ö1-8µÄCID¹ØÁª |
| 140 | * @param PS_EXT_DEV6 Ŀǰ֧³Ö1-8µÄCID¹ØÁª |
| 141 | * @param PS_EXT_DEV7 Ŀǰ֧³Ö1-8µÄCID¹ØÁª |
| 142 | * @param PS_EXT_DEV8 Ŀǰ֧³Ö1-8µÄCID¹ØÁª |
| 143 | * @param RJ45_WAN_DEV RJ45ÍâÍø¿ÚÉ豸±êʶ£¬Ïà¶ÔÓÚRJ45_LAN_DEV£¬ÓÅÏÈʶ±ð£¬ÒòΪÍâÍø¿ÚÖ§³ÖÄÚÍâÍø×Ô¶¯Çл» |
| 144 | * @param RJ45_LAN_DEV RJ45ÄÚÍø¿ÚÉ豸±êʶ£¬½öÓÃÓÚRJ45ÄÚÍâÍø¿Úͬʱ´æÔÚ³¡¾° |
| 145 | * @param SW_WAN_DEV Realtek switch ÍâÍø¿ÚÉ豸±êʶ£¬Ö§³ÖÈȲå°Î |
| 146 | * @param SW_LAN_DEV Realtek switch ÍâÍø¿ÚÉ豸±êʶ£¬Ö§³ÖÈȲå°Î |
| 147 | * @param WIFI_WAN_DEV stationÍâÍø¿ÚÉ豸±êʶ |
| 148 | * @param WIFI_LAN_DEV stationÄÚÍø¿ÚÉ豸±êʶ |
| 149 | * @param USB_LAN_DEV USBÄÚÍø¿ÚÉ豸±êʶ |
| 150 | * @param NO_DEV ȱʡÍâÍø¿ÚΪ¿Õʱºò±êʶ |
| 151 | */ |
| 152 | enum dev_ID { |
| 153 | PS_NET_DEV, |
| 154 | PS_EXT_DEV1, |
| 155 | PS_EXT_DEV2, |
| 156 | PS_EXT_DEV3, |
| 157 | PS_EXT_DEV4, |
| 158 | PS_EXT_DEV5, |
| 159 | PS_EXT_DEV6, |
| 160 | PS_EXT_DEV7, |
| 161 | PS_EXT_DEV8, |
| 162 | RJ45_WAN_DEV, |
| 163 | RJ45_LAN_DEV, |
| 164 | SW_WAN_DEV, |
| 165 | SW_LAN_DEV, |
| 166 | WIFI_WAN_DEV, |
| 167 | WIFI_LAN_DEV, |
| 168 | USB_LAN_DEV, |
| 169 | NO_DEV, |
| 170 | }; |
| 171 | |
| 172 | /** |
| 173 | * @brief ÍâÍø¿ÚÁªÍøÊ§°ÜµÄÔÒòIDºêÖµ |
| 174 | * @param TIME_OUT Á¬½Ó³¬Ê± |
| 175 | */ |
| 176 | enum dialfail_reason_ID { |
| 177 | TIME_OUT = 0, |
| 178 | }; |
| 179 | |
| 180 | /** |
| 181 | * @brief Íø¿ÚµÄip46µÈµØÖ·ÐÅÏ¢ |
| 182 | * @param ip46flag ipv4/ipv6 ±ê־λ |
| 183 | * @param ip ipv4µØÖ· |
| 184 | * @param gateway Íø¹ØµØÖ· |
| 185 | * @param netmask ÑÚÂë |
| 186 | * @param pri_dns Ê×Ñ¡dnsµØÖ· |
| 187 | * @param sec_dns ´ÎÑ¡dnsµØÖ· |
| 188 | * @param ip6 ipv6 µØÖ· |
| 189 | * @param gateway6 ipv6 Íø¹ØµØÖ· |
| 190 | * @param pri_dns6 ipv6 Ê×Ñ¡dnsµØÖ· |
| 191 | * @param sec_dns6 ipv6 ´ÎÑ¡dnsµØÖ· |
| 192 | * @note ip46flag µÄȡֵ²Î¿¼V46_VALIDµÈºêÖµ |
| 193 | */ |
| 194 | struct netdev_act_info { |
| 195 | unsigned char ip46flag; |
| 196 | char ip[IPV4ADDLEN_MAX]; |
| 197 | char gateway[IPV4ADDLEN_MAX]; |
| 198 | char netmask[IPV4ADDLEN_MAX]; |
| 199 | char pri_dns[IPV4ADDLEN_MAX]; |
| 200 | char sec_dns[IPV4ADDLEN_MAX]; |
| 201 | char ip6[IPV6ADDLEN_MAX]; |
| 202 | char gateway6[IPV6ADDLEN_MAX]; |
| 203 | char pri_dns6[IPV6ADDLEN_MAX]; |
| 204 | char sec_dns6[IPV6ADDLEN_MAX]; |
| 205 | }; |
| 206 | |
| 207 | /** |
| 208 | * @brief ½á¹¹Ìå˵Ã÷:PDP¼¤»îÐÅÏ¢£¬×¨ÓÃÓÚPSÍâÍø¿Ú£¬ÆäÖÐcidÓÃÓÚʶ±ð²»Í¬µÄPSÍâÍø¿Ú |
| 209 | * @param c_id PDPΨһ±êʶ |
| 210 | * @param pdp_type pdp ¼¤»îÀàÐÍ |
| 211 | * @param act_info Íø¿ÚµØÖ·µÈÐÅÏ¢ |
| 212 | * @note pdp type µÄȡֵ²Î¼ûPDP_LOCALµÈºêÖµ |
| 213 | */ |
| 214 | struct pdp_active_info { |
| 215 | int c_id; |
| 216 | unsigned char pdp_type; |
| 217 | struct netdev_act_info act_info; |
| 218 | }; |
| 219 | |
| 220 | /** |
| 221 | * @brief macµØÖ·ºÍ¶ÔÓ¦Ö÷»úÃûÐÅÏ¢ |
| 222 | * @param mac macµØÖ· |
| 223 | * @param hostname macµØÖ·¶ÔÓ¦µÄÖ÷»úÃû |
| 224 | */ |
| 225 | struct mac_hostname_info { |
| 226 | char mac[MAC_ADDR_LEN]; |
| 227 | char hostname[HOSTNAME_LEN]; |
| 228 | }; |
| 229 | |
| 230 | /** |
| 231 | * @brief ¾²Ì¬mac ipµØÖ·ÐÅÏ¢ |
| 232 | * @param mac mac µØÖ· |
| 233 | * @param ip macµØÖ·°ó¶¨µÄ¾²Ì¬ipµØÖ· |
| 234 | */ |
| 235 | struct static_macip_info { |
| 236 | char mac[32]; |
| 237 | char ip[32]; |
| 238 | }; |
| 239 | |
| 240 | /** |
| 241 | * @brief ¼Ò³¤Ä£Ê½°×Ãûµ¥ÍøÕ¾ÐÅÏ¢ |
| 242 | * @param name ÍøÕ¾Ãû³Æ |
| 243 | * @param site ÍøÕ¾ÍøÖ· |
| 244 | */ |
| 245 | struct white_site_info { |
| 246 | char name[HOSTNAME_LEN]; |
| 247 | char site[SITE_LEN]; |
| 248 | }; |
| 249 | |
| 250 | /** |
| 251 | * @brief ȱʡÍâÍø¿ÚÐÅÏ¢ |
| 252 | * @param p46flag ipv4/ipv6±ê־λ |
| 253 | * @param dev_id É豸idºÅ |
| 254 | */ |
| 255 | struct default_dev_info { |
| 256 | unsigned char ip46flag; |
| 257 | unsigned char dev_id; |
| 258 | }; |
| 259 | |
| 260 | /** |
| 261 | * @brief Á÷Á¿¿ØÖÆÐÅÏ¢ |
| 262 | * @param c_id PDPΨһ±êʶ£¬ucÊý¾Ý¿¨Ä£Ê½ÐèÒª´«È룬ufiģʽ²»ÐèÒª |
| 263 | * @param tc_downlink ÏÂÐÐÁ÷Á¿¿ØÖÆÖµ£¬µ¥Î»:±ÈÌØ |
| 264 | * @param tc_uplink ÏÂÐÐÁ÷Á¿¿ØÖÆÖµ£¬µ¥Î»:±ÈÌØ |
| 265 | * @note tc_downlink/tc_uplink 0 ±íʾ²»ÐèÒªÁ÷¿Ø£¬Òòlinux±ê×¼ÃüÁîÊǶÔ×Ö½Ú´¦Àí£¬ËùÒÔ×îÖÕÅäÖÃÖµ»áÕû³ý8 |
| 266 | */ |
| 267 | struct tc_control_info { |
| 268 | int c_id; |
| 269 | unsigned int tc_downlink; |
| 270 | unsigned int tc_uplink; |
| 271 | }; |
| 272 | |
| 273 | /** |
| 274 | * @brief ÁªÍøÊ§°ÜʱµÄÏà¹ØÅäÖÃÏî½á¹¹Ìå |
| 275 | * @param ip46flag ipv4/ipv6 ±ê־λ |
| 276 | * @param dev_id É豸id |
| 277 | * @param dialfail_reason ÁªÍøÊ§°ÜÔÒò |
| 278 | * @note dialfail_reasonȡֵ²Î¼ûTIME_OUTµÈºêÖµ |
| 279 | */ |
| 280 | struct dialfail_dev_info { |
| 281 | unsigned char ip46flag; |
| 282 | unsigned char dev_id; |
| 283 | unsigned char dialfail_reason; |
| 284 | }; |
| 285 | |
| 286 | |
| 287 | /** |
| 288 | * @brief PDPÈ¥¼¤»îÐÅÏ¢£¬×¨ÓÃÓÚPSÍâÍø¿Ú |
| 289 | * @param c_id PDP Ψһ±êʶ |
| 290 | * @param ip46flag ipv4/ipv6 ±êÖ¾ |
| 291 | * @note c_id ÓÃÓÚʶ±ð²»Í¬µÄPSÍâÍø¿Ú |
| 292 | */ |
| 293 | struct pdp_deactive_info { |
| 294 | int c_id; |
| 295 | unsigned char ip46flag; |
| 296 | }; |
| 297 | |
| 298 | #if 0 |
| 299 | typedef struct { |
| 300 | int result; |
| 301 | int cid; |
| 302 | char v6_addr[46]; |
| 303 | } V6ADDR_INFORM; |
| 304 | #endif |
| 305 | |
| 306 | /** |
| 307 | * @brief PPPD·¢ËÍPDP¼¤»îÏûÏ¢ÐÅÏ¢ |
| 308 | * @param auth_type ÈÏÖ¤·½Ê½0´ú±íPAP£¬1´ú±íCHAP |
| 309 | * @param user_len Óû§Ãû ³¤¶È |
| 310 | * @param user Óû§Ãû£¬ÔÚCHAP·½Ê½Ï¸ÃÖµÖÃΪÌôÕ½idºÅ |
| 311 | * @param pw_len ÃÜÂ볤¶È |
| 312 | * @param pw ÃÜÂ룬ֻÓÃÓÚPAP·½Ê½ |
| 313 | * @param chg_len ÌôÕ½³¤¶È |
| 314 | * @param challenge ÌôÕ½id£¬ÓÃÓÚCHAP·½Ê½ |
| 315 | */ |
| 316 | typedef struct pppd_auth { |
| 317 | int auth_type; |
| 318 | int user_len; |
| 319 | char user[USER_MAX]; |
| 320 | int pw_len; |
| 321 | char pw[PW_MAX]; |
| 322 | int chg_len; |
| 323 | char challenge[CHALLENGE_MAX]; |
| 324 | } pppd_auth; |
| 325 | |
xf.li | e31de8b | 2023-12-26 23:38:58 -0800 | [diff] [blame] | 326 | typedef union |
| 327 | { |
| 328 | u_int8_t e8[8]; |
| 329 | u_int16_t e16[4]; |
| 330 | u_int32_t e32[2]; |
| 331 | } netapi_eui64_t; |
| 332 | |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 333 | /******************************************************************************* |
| 334 | * Global function declarations * |
| 335 | ******************************************************************************/ |
| 336 | |
| 337 | |
| 338 | |
| 339 | |
| 340 | /** |
| 341 | * @brief ¸ù¾ÝÍøÂçÉ豸Ãû»ñÈ¡¶ÔÓ¦µÄÉ豸ID,°´ÕÕÓÅÏȼ¶ÓëNVÖеÄÉ豸Ãû½øÐÐÆ¥Åä |
| 342 | * @param dev_name ÍøÂçÉ豸Ãû |
| 343 | * @return ʧ°Ü·µ»Ø-1 |
| 344 | */ |
| 345 | int getDevId_byname(char *dev_name); |
| 346 | |
| 347 | |
| 348 | /** |
| 349 | * @brief PSÍøÂçÉ豸¼¤»î½Ó¿Ú |
| 350 | * @param actinfo pdp ¼¤»îÐÅÏ¢ |
| 351 | * @param src_id µ÷Óô˽ӿڵĽø³Ìid |
| 352 | * @return ³É¹¦ ·µ»Ø 0, ʧ°Ü ·µ»Ø -1 |
| 353 | * @note atÏà¹ØÓ¦Óýø³Ìµ÷Óã¬Èçatserver¡¢pcserver¡¢VoLTE¡¢²ÊÐŵÈÓ¦Óýø³Ì |
| 354 | */ |
| 355 | int pdp_act_proc(struct pdp_active_info *actinfo, int src_id); |
| 356 | |
| 357 | |
| 358 | /** |
| 359 | * @brief PPPÍøÂçÉ豸¼¤»î½Ó¿Ú |
| 360 | * @param ttyname tty É豸Ãû |
| 361 | * @return ³É¹¦ ·µ»Ø 0, ʧ°Ü ·µ»Ø -1 |
| 362 | */ |
| 363 | int ppp_act_proc(char *ttyname); |
| 364 | |
| 365 | /** |
| 366 | * @brief PSÍøÂçÉ豸ȥ»î½Ó¿Ú |
| 367 | * @param c_id PDP¼¤»îc_id |
| 368 | * @param ip46flag ip4/ipv6±êÖ¾ |
| 369 | * @param src_id µ÷Óô˽ӿڵĽø³Ìid |
| 370 | * @return ³É¹¦ ·µ»Ø 0, ʧ°Ü ·µ»Ø -1 |
| 371 | * @note atÏà¹ØÓ¦Óýø³Ìµ÷Óã¬Èçatserver¡¢pcserver¡¢VoLTE¡¢²ÊÐŵÈÓ¦Óýø³Ì |
| 372 | */ |
| 373 | int pdp_deact_proc(int c_id, unsigned char ip46flag, int src_id); |
| 374 | |
| 375 | |
| 376 | /** |
| 377 | * @brief ÈȲå°ÎÉ豸²åÈë,½Ó¿ÚÄÚ²¿¼ì²âÊÇ·ñÐèÒª½øÐв¦ºÅ£¬ÈçÐèÒª£¬Ö´ÐеØÖ··ÖÅä¡¢×éÍøµÈÁ÷³Ì |
| 378 | * @param netdev_id É豸idºÅ |
| 379 | * @param src_id µ÷Óô˽ӿڵĽø³Ìid |
| 380 | * @return ³É¹¦ ·µ»Ø 0, ʧ°Ü ·µ»Ø -1 |
| 381 | * @note É豸Ö÷¿Øµ÷Óô˽ӿÚʱ£¬±íÃ÷¸ÃÍøÂçÉ豸ÎïÀíͨ·ÒÑͨ£¬¿ÉÒÔ½øÐÐIPÊý¾Ý°üµÄÊÕ·¢ÁË£» |
| 382 | * Ö÷¿Ø½ø³ÌÐèÒª±£Ö¤ÈȲå°Îʼþ²»»áÖØ¸´µ÷Óøýӿڣ¬·ñÔòÍøÂçÄÚ²¿»áƵ·±½øÐÐÖØ¸´µÄÖØÅäÖÃIPµØÖ·µÄÁ÷³Ì |
| 383 | */ |
| 384 | int netdev_plugin_proc(unsigned char netdev_id, int src_id); |
| 385 | |
| 386 | /** |
| 387 | * @brief ÈȲå°ÎÉ豸°Î³ö,½Ó¿ÚÄÚ²¿½øÐÐifconfig down£¬²¢É±µôÏàÓ¦µÄµØÖ··ÖÅä½ø³Ì |
| 388 | * @param netdev_id É豸idºÅ |
| 389 | * @param src_id µ÷Óô˽ӿڵĽø³Ìid |
| 390 | * @return ³É¹¦ ·µ»Ø 0, ʧ°Ü ·µ»Ø -1 |
| 391 | * @note É豸Ö÷¿Øµ÷Óô˽ӿÚʱ£¬±íÃ÷¸ÃÍøÂçÉ豸ÎïÀíͨ·ÒѶϣ¬²»ÒªÔÙ½øÐÐIPÊý¾Ý°üÊÕ·¢ |
| 392 | */ |
| 393 | int netdev_plugout_proc(unsigned char netdev_id, int src_id); |
| 394 | |
| 395 | |
| 396 | /** |
| 397 | * @brief webui·¢Ë͵ÄÁ¬½ÓÇëÇó,½Ó¿ÚÄÚ²¿½øÐÐifconfig up£¬²¢Æô¶¯ÏàÓ¦µÄµØÖ··ÖÅä½ø³Ì |
| 398 | * @param netdev_id É豸idºÅ |
| 399 | * @param src_id µ÷Óô˽ӿڵĽø³Ìid |
| 400 | * @return ³É¹¦ ·µ»Ø 0, ʧ°Ü ·µ»Ø -1 |
| 401 | * @note É豸Ö÷¿ØÄ£¿éµ÷Óô˽ӿÚǰ£¬ÐèÒª¼ì²âµ±Ç°É豸ÎïÀíͨ·ÒÑͨ£¬·ñÔò²»Ó¦¸Ãµ÷ÓÃ´Ë½Ó¿Ú |
| 402 | */ |
| 403 | int netdev_connect_internet(unsigned char netdev_id, int src_id); |
| 404 | |
| 405 | |
| 406 | /** |
| 407 | * @brief webui·¢Ë͵ĶϿªÁ¬½ÓÇëÇó,½Ó¿ÚÄÚ²¿½øÐÐifconfig down£¬²¢É±µôÏàÓ¦µÄµØÖ··ÖÅä½ø³Ì |
| 408 | * @param netdev_id É豸idºÅ |
| 409 | * @param src_id µ÷Óô˽ӿڵĽø³Ìid |
| 410 | * @return ³É¹¦ ·µ»Ø 0, ʧ°Ü ·µ»Ø -1 |
| 411 | * @note É豸Ö÷¿ØÄ£¿éµ÷ÓÃ´Ë½Ó¿Ú |
| 412 | */ |
| 413 | int netdev_disconnect_internet(unsigned char netdev_id, int src_id); |
| 414 | |
| 415 | |
| 416 | /** |
| 417 | * @brief Á÷Á¿¿ØÖÆ |
| 418 | * @param tcinfo Á÷Á¿¿ØÖÆÐÅÏ¢£¬ÐèÒªÁ÷Á¿¼à¿ØµÄÉÏÏÂÐÐÁ¿ |
| 419 | * @param src_id Ô´½ø³ÌidºÅ |
| 420 | * @return ²Ù×÷³É¹¦·µ»Ø1£¬Ê§°Ü·µ»Ø0 |
| 421 | * @note ¸øÐèÒªÁ÷Á¿¿ØÖƵÄÓ¦Óõ÷Óã¬ÈçÉÏÐÐÐèÒªÁ÷¿Ø£¬ÇëµÈÄÜÉÏÍâÍøºóÔÙµ÷Ó㬷ñÔòÎÞ·¨»ñÈ¡ÍâÍø¿Ú½øÐÐÁ÷¿Ø |
| 422 | * Õý³£¹Ø»úÖØÐ¿ª»ú£¬Ö®Ç°ÉèÖõÄÁ÷¿ØÒÀÈ»ÓÐЧ |
| 423 | */ |
| 424 | int tc_control(struct tc_control_info *tcinfo, int src_id); |
| 425 | |
| 426 | |
| 427 | /** |
| 428 | * @brief ÈȲå°ÎÉ豸²åÈë,½Ó¿ÚÄÚ²¿¼ì²âÊÇ·ñÐèÒª½øÐÐ×Ô¶¯²¦ºÅ£¬ÈçÐèÒª£¬Ö´ÐеØÖ··ÖÅä¡¢×éÍøµÈÁ÷³Ì |
| 429 | * @param netdev_name ÍøÂçÉ豸Ãû |
| 430 | * @param src_id Ô´½ø³Ì id ºÅ |
| 431 | * @return ²Ù×÷³É¹¦·µ»Ø1£¬Ê§°Ü·µ»Ø0 |
| 432 | * @note É豸Ö÷¿Øµ÷Óô˽ӿÚʱ£¬±íÃ÷¸ÃÍøÂçÉ豸ÎïÀíͨ·ÒÑͨ£¬¿ÉÒÔ½øÐÐIPÊý¾Ý°üµÄÊÕ·¢ÁË |
| 433 | */ |
| 434 | int netdev_plugin_proc_byname(char *netdev_name, int src_id); |
| 435 | |
| 436 | |
| 437 | /** |
| 438 | * @brief ÈȲå°ÎÉ豸°Î³ö,½Ó¿ÚÄÚ²¿½øÐÐifconfig down£¬²¢É±µôÏàÓ¦µÄµØÖ··ÖÅä½ø³Ì |
| 439 | * @param netdev_name ÍøÂçÉ豸Ãû |
| 440 | * @param src_id Ô´½ø³Ì id ºÅ |
| 441 | * @return ²Ù×÷³É¹¦·µ»Ø1£¬Ê§°Ü·µ»Ø0 |
| 442 | * @note É豸Ö÷¿Øµ÷Óô˽ӿÚʱ£¬±íÃ÷¸ÃÍøÂçÉ豸ÎïÀíͨ·ÒѶϣ¬²»ÒªÔÙ½øÐÐIPÊý¾Ý°üÊÕ·¢ |
| 443 | */ |
| 444 | int netdev_plugout_proc_byname(char *netdev_name, int src_id); |
| 445 | |
| 446 | |
| 447 | /** |
| 448 | * @brief »Ö¸´³ö³§ÉèÖÃʱɾ³ý³ÌÐòÔËÐÐÖÐÉú³ÉµÄÎļþ |
| 449 | * @param ÎÞ |
| 450 | * @return ÎÞ |
| 451 | */ |
| 452 | void tcpip_reset_configure(); |
| 453 | |
| 454 | /** |
| 455 | * @brief ÉèÖÃswitchÉ豸eth0.200Íø¿Ú¶ÔÓ¦µÄport3Ϊwan¿Ú»¹ÊÇlan¿Ú |
| 456 | * @param mode:1 => wan¿Ú£¬0 => lan¿Ú |
| 457 | * @return ÎÞ |
| 458 | */ |
| 459 | void set_ethwan_port_mode(int mode); |
| 460 | |
xf.li | e31de8b | 2023-12-26 23:38:58 -0800 | [diff] [blame] | 461 | int netapi_ether_to_eui64(const char *dev_name, netapi_eui64_t *p_eui64); |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 462 | |
| 463 | #endif |
| 464 | |
| 465 | /******************************************************************************* |
| 466 | * Global function implementations * |
| 467 | ******************************************************************************/ |
| 468 | |
| 469 | #endif/* __NETAPI__ */ |