分类: C/C++
2016-01-20 17:37:53
一、库函数声明和定义
1. Ah_scd_cli.h -----声明函数ah_scd_del_ipv6_entry
ah_void_t ah_scd_del_ipv6_entry(ah_char_t
*if_name);
2. ah_scd_proc.c-------定义函数
ah_void_t ah_scd_del_ipv6_entry(ah_char_t *if_name)
{
…..
}
3. Scd/libtpa/Ah_tpa_ip_api.c
----调用了ah_scd_del_ipv6_entry
ah_void_t ah_tpa_clear_ipv6_interface(ah_char_t *ifname)
{
ah_scd_del_ipv6_entry(ifname);
……
}
4. /include/usr/ah_tpa_api.h----声明ah_tpa_clear_ipv6_interface
ah_void_t ah_tpa_clear_ipv6_interface(ah_char_t *ifname);
5. 编译成库libah_tpa.so.1.0
二、库函数使用—lah_tpa
在DCD 模块中调用库函数ah_tpa_clear_ipv6_interface,发现编译的时候出错:
arm-brcm-linux-gnueabi-gcc -DAH_MESH_SUPPORT -DAH_BOARD=18 -DAH_VERSION=0x06080100 -DAH_BUILD_DEBUG -DAH_USE_WIFI91 -DAH_LINUX_2636 -DAH_CLEAR_BOOT_MESSAGE -DAH_SUPPORT_CPM -Wno-unused-variable -DAH_BUILD_RELEASE -DAH_OEM_HOST -DAH_SFLOW_SUPPORT -DAH_SUPPORT_IPV6 -DAH_CONSOLE_BAUDRATE=9600 -DAH_SUPPORT_KGDB -DAH_SUPPORT_PROGRAM_BOTH_IMAGES_ONCE -DAH_SUPPORT_HW_BREAKPOINT -DATH_CCX=1 -DATH_SUPPORT_UAPSD=1 -DATH_WPS_IE=1 -DBUILD_AP=1 -DAH_RADIO_BCM -DAH_SUPPORT_11AC -DAH_SUPPORT_WMF -DAH_SUPPORT_HDD -DAH_SUPPORT_DOS -DAH_SUPPORT_IDP -DATH_SUPPORT_SPECTRAL=1 -DSPECTRAL_CLASSIFIER_IN_KERNEL -DWLENT_FFT_SAMPLE -DWLENT_CUSTOM_SCAN -DWLENT_EVENT_SERVICE -DAH_SUPPORT_LTR -DAH_SUPPORT_LCS -DAH_SUPPORT_RADIUS -DAH_SUPPORT_RADSEC -DAH_SUPPORT_HIVEUI -DAH_SUPPORT_TV -DAH_SUPPORT_WINPCAP -DAH_SUPPORT_IPERF -DAH_VPN_ENABLE -DAH_SUPPORT_CDP_LLDP -DAH_NO_SUPPORT_CVG -DAH_SUPPORT_ASD -DAH_SUPPORT_FE_VCON -DAH_L7_SUPPORT -DAH_L7_MULTICORE_SUPPORT -DAH_L3_ROUTER -DAH_SUPPORT_IPFW -DAH_SUPPORT_VOIP_QOS -DAH_USB_MODEM_SUPPORT -DAH_SUPPORT_USBNET -DAH_SUPPORT_MULTIWAN -DAH_SUPPORT_MDM -DAH_SUPPORT_PPPOE -DAH_SUPPORT_OTP -DAH_BONJOUR_GATEWAY_SUPPORT -DAH_DUMP_MDNS_DATA -DAH_BJGW_WITHOUT_L3_INTERFACE -DAH_SUPPORT_8021X -DAH_SUPPORT_BR_CVG -DAH_CVG_COMMON -DAH_SUPPORT_WIFI_PKT_TRACE -DAH_SUPPORT_WPA_SUPP -DAH_SUPPORT_WPA_SUPP_WIRED -DAH_SUPPORT_ACSD -DAH_DISABLE_WPA_ALONE -DAH_CAVC_AP -DAH_SUPPORT_IBEACON -DAH_SUPPORT_EXT_USB_POWER_SETTING -DAH_DYNAMIC_BYPASS_NETFILTER -DAH_SUPPORT_GBE -DAH_HOSTAPD_VERSION_2_3 -DAH_BOARD=18 -I. -I/home/gwwu/p4client/codes/sandbox/IPv6/aeros/build_AP230/include/user -I/home/gwwu/p4client/codes/sandbox/IPv6/aeros/build_AP230/include/user/cli -I/home/gwwu/p4client/codes/sandbox/IPv6/aeros/build_AP230/include/boot -I/home/gwwu/p4client/codes/sandbox/IPv6/aeros/include -I/home/gwwu/p4client/codes/sandbox/IPv6/aeros/include/kernel -I/home/gwwu/p4client/codes/sandbox/IPv6/aeros/include/share -I/home/gwwu/p4client/codes/sandbox/IPv6/aeros/include/user -I/home/gwwu/p4client/codes/sandbox/IPv6/aeros/include/boot -I/home/gwwu/p4client/codes/sandbox/IPv6/aeros/drivers/wl/current -I/home/gwwu/p4client/codes/sandbox/IPv6/aeros/awe2/umod -I/home/gwwu/p4client/codes/sandbox/IPv6/aeros/awe2/kmod -I/home/gwwu/p4client/codes/sandbox/IPv6/aeros/include -include/home/gwwu/p4client/codes/sandbox/IPv6/aeros/include/share/ah_patching_macros.h -I/home/gwwu/p4client/codes/sandbox/IPv6/aeros/build_AP230/drivers/wl/current -I/home/gwwu/p4client/codes/sandbox/IPv6/aeros/build_AP230/drivers/wl/current/include -I/home/gwwu/p4client/codes/sandbox/IPv6/aeros/build_AP230/drivers/wl/current/sys -I/home/gwwu/p4client/codes/sandbox/IPv6/aeros/build_AP230/drivers/wl/current/bcmwifi -I/home/gwwu/p4client/codes/sandbox/IPv6/aeros/build_AP230/drivers/wl/current/phy -I/home/gwwu/p4client/codes/sandbox/IPv6/aeros/build_AP230/drivers/wl/current/ppr/include -I/home/gwwu/p4client/codes/sandbox/IPv6/aeros/build_AP230/drivers/wl/current/clm/include -I/home/gwwu/p4client/codes/sandbox/IPv6/aeros/build_AP230/drivers/wl/current/shared/bcmwifi/include -include/home/gwwu/p4client/codes/sandbox/IPv6/aeros/include/share/ah_patching_macros.h -L/home/gwwu/p4client/codes/sandbox/IPv6/aeros/build_AP230/georgewashington_install/rootfs/lib -L/home/gwwu/p4client/codes/sandbox/IPv6/aeros/build_AP230/georgewashington_install/rootfs/opt/ah/lib -Xlinker -rpath-link=/home/gwwu/p4client/codes/sandbox/IPv6/aeros/build_AP230/georgewashington_install/rootfs/opt/ah/lib -Wno-unused-variable -DAH_BUILD_RELEASE -DAH_OEM_HOST -DAH_SFLOW_SUPPORT -DAH_SUPPORT_IPV6 -DAH_CONSOLE_BAUDRATE=9600 -DAH_SUPPORT_KGDB -DAH_SUPPORT_PROGRAM_BOTH_IMAGES_ONCE -DAH_SUPPORT_HW_BREAKPOINT -lah -lah_radius -lah_libsip_client -lah -lah_event -lah_mpi -lah_sys -lgdbm -lgdbm_compat -lah_db -lah_tpa -lah_user -lah_top -litk -lah_capwap -lah_dcd -lah_cli -lah_rt_sta -lah_client_monitor -lah_scd conftest.c -lnsl -lresolv -lpthread -lah
/home/gwwu/p4client/codes/sandbox/IPv6/aeros/build_AP230/georgewashington_install/rootfs/opt/ah/lib/libah_tpa.so: undefineference to `ah_scd_del_ipv6_entry'
三、原因
库中包括了函数ah_scd_del_ipv6_entry,而ah_scd_del_ipv6_entry定义在ah_scd_proc.c中,ah_scd_proc.c文件没有在库里面,所以编译会出错,提示找不到。
四、解决方案
由于函数ah_scd_del_ipv6_entry定义在ah_scd_proc.c中,而ah_scd_proc.c中的数据是SCD进程特有的,所以增加在DCD删除MGTX.Y的时候,SCD注册删除事件,在接收到删除事件后,在SCD中调用执行ah_scd_del_ipv6_entry