[T106][ZXW-22]7520V3SCV2.01.01.02P42U09_VEC_V0.8_AP_VEC origin source commit
Change-Id: Ic6e05d89ecd62fc34f82b23dcf306c93764aec4b
diff --git a/ap/app/cwmp/netcwmp/cwmpd/include/cwmp_agent.h b/ap/app/cwmp/netcwmp/cwmpd/include/cwmp_agent.h
new file mode 100755
index 0000000..a3c9504
--- /dev/null
+++ b/ap/app/cwmp/netcwmp/cwmpd/include/cwmp_agent.h
@@ -0,0 +1,33 @@
+/************************************************************************
+ * *
+ * Netcwmp/Opencwmp Project *
+ * A software client for enabling TR-069 in embedded devices (CPE). *
+ * *
+ * Copyright (C) 2013-2014 netcwmp.netcwmp group *
+ * *
+ * This program is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU General Public License *
+ * as published by the Free Software Foundation; either version 2 *
+ * of the License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the *
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330, *
+ * Boston, MA 02111-1307 USA *
+ * *
+ * Copyright 2013-2014 Mr.x() <netcwmp@gmail.com> *
+ * *
+ ***********************************************************************/
+
+#ifndef __CWMP_AGENT_H__
+#define __CWMP_AGENT_H__
+
+
+int cwmp_agent_analyse_session(cwmp_session_t * session);
+
+#endif
diff --git a/ap/app/cwmp/netcwmp/cwmpd/include/cwmp_conf.h b/ap/app/cwmp/netcwmp/cwmpd/include/cwmp_conf.h
new file mode 100755
index 0000000..52b9a08
--- /dev/null
+++ b/ap/app/cwmp/netcwmp/cwmpd/include/cwmp_conf.h
@@ -0,0 +1,38 @@
+/************************************************************************
+ * *
+ * Netcwmp/Opencwmp Project *
+ * A software client for enabling TR-069 in embedded devices (CPE). *
+ * *
+ * Copyright (C) 2013-2014 netcwmp.netcwmp group *
+ * *
+ * This program is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU General Public License *
+ * as published by the Free Software Foundation; either version 2 *
+ * of the License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the *
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330, *
+ * Boston, MA 02111-1307 USA *
+ * *
+ * Copyright 2013-2014 Mr.x() <netcwmp@gmail.com> *
+ * *
+ ***********************************************************************/
+
+#ifndef __CWMP_CONF_H__
+#define __CWMP_CONF_H__
+
+
+
+
+void cwmp_conf_init(cwmp_t * cwmp);
+
+
+
+
+#endif
diff --git a/ap/app/cwmp/netcwmp/cwmpd/include/cwmp_httpd.h b/ap/app/cwmp/netcwmp/cwmpd/include/cwmp_httpd.h
new file mode 100755
index 0000000..f6bc17f
--- /dev/null
+++ b/ap/app/cwmp/netcwmp/cwmpd/include/cwmp_httpd.h
@@ -0,0 +1,36 @@
+/************************************************************************
+ * *
+ * Netcwmp/Opencwmp Project *
+ * A software client for enabling TR-069 in embedded devices (CPE). *
+ * *
+ * Copyright (C) 2013-2014 netcwmp.netcwmp group *
+ * *
+ * This program is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU General Public License *
+ * as published by the Free Software Foundation; either version 2 *
+ * of the License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the *
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330, *
+ * Boston, MA 02111-1307 USA *
+ * *
+ * Copyright 2013-2014 Mr.x() <netcwmp@gmail.com> *
+ * *
+ ***********************************************************************/
+
+#ifndef __CWMP_HTTPD_H__
+#define __CWMP_HTTPD_H__
+
+#include "cwmp_module.h"
+
+
+int httpd_build_server(cwmp_t * cwmp);
+
+
+#endif
diff --git a/ap/app/cwmp/netcwmp/cwmpd/include/cwmp_module.h b/ap/app/cwmp/netcwmp/cwmpd/include/cwmp_module.h
new file mode 100755
index 0000000..09ec40e
--- /dev/null
+++ b/ap/app/cwmp/netcwmp/cwmpd/include/cwmp_module.h
@@ -0,0 +1,50 @@
+/************************************************************************
+ * *
+ * Netcwmp/Opencwmp Project *
+ * A software client for enabling TR-069 in embedded devices (CPE). *
+ * *
+ * Copyright (C) 2013-2014 netcwmp.netcwmp group *
+ * *
+ * This program is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU General Public License *
+ * as published by the Free Software Foundation; either version 2 *
+ * of the License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the *
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330, *
+ * Boston, MA 02111-1307 USA *
+ * *
+ * Copyright 2013-2014 Mr.x() <netcwmp@gmail.com> *
+ * *
+ ***********************************************************************/
+
+#ifndef __CWMP_MODULE_H__
+#define __CWMP_MODULE_H__
+
+#include <cwmp/types.h>
+#include <cwmp/cwmp.h>
+#include <cwmp/pool.h>
+#include <cwmp/cfg.h>
+#include <cwmp/session.h>
+#include <cwmp/log.h>
+#include <cwmp/event.h>
+#include <cwmp/queue.h>
+
+#include "cwmp_type.h"
+#include "cwmp_conf.h"
+
+
+
+
+
+
+
+
+
+#endif
diff --git a/ap/app/cwmp/netcwmp/cwmpd/include/cwmp_process.h b/ap/app/cwmp/netcwmp/cwmpd/include/cwmp_process.h
new file mode 100755
index 0000000..67acf2e
--- /dev/null
+++ b/ap/app/cwmp/netcwmp/cwmpd/include/cwmp_process.h
@@ -0,0 +1,34 @@
+/************************************************************************
+ * *
+ * Netcwmp/Opencwmp Project *
+ * A software client for enabling TR-069 in embedded devices (CPE). *
+ * *
+ * Copyright (C) 2013-2014 netcwmp group *
+ * *
+ * This program is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU General Public License *
+ * as published by the Free Software Foundation; either version 2 *
+ * of the License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the *
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330, *
+ * Boston, MA 02111-1307 USA *
+ * *
+ * Copyright 2013-2014 Mr.x() <netcwmp@gmail.com> *
+ * *
+ ***********************************************************************/
+
+#ifndef __CWMP_PROCESS_H__
+#define __CWMP_PROCESS_H__
+#include "cwmp_type.h"
+
+void cwmp_worker_thread_start(cwmp_t * cwmp);
+
+
+#endif
diff --git a/ap/app/cwmp/netcwmp/cwmpd/include/cwmp_signal.h b/ap/app/cwmp/netcwmp/cwmpd/include/cwmp_signal.h
new file mode 100755
index 0000000..bb2a0fc
--- /dev/null
+++ b/ap/app/cwmp/netcwmp/cwmpd/include/cwmp_signal.h
@@ -0,0 +1,51 @@
+/************************************************************************
+ * *
+ * Netcwmp/Opencwmp Project *
+ * A software client for enabling TR-069 in embedded devices (CPE). *
+ * *
+ * Copyright (C) 2013-2014 netcwmp group *
+ * *
+ * This program is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU General Public License *
+ * as published by the Free Software Foundation; either version 2 *
+ * of the License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the *
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330, *
+ * Boston, MA 02111-1307 USA *
+ * *
+ * Copyright 2013-2014 Mr.x() <netcwmp@gmail.com> *
+ * *
+ ***********************************************************************/
+
+#ifndef __CWMP_SIGNAL_H__
+#define __CWMP_SIGNAL_H__
+
+#define cwmp_signal_helper(n) SIG##n
+#define cwmp_signal_value(n) cwmp_signal_helper(n)
+
+#ifdef WIN32
+#define CWMP_SIG_SHUTDOWN TERM
+#else
+#define CWMP_SIG_SHUTDOWN QUIT
+#endif
+#define CWMP_SIG_TERMINATE TERM
+#define CWMP_SIG_NOACCEPT WINCH
+#define CWMP_SIG_RECONFIGURE HUP
+
+
+#if (CWMP_LINUXTHREADS)
+#define CWMP_SIG_REOPEN INFO
+#define CWMP_SIG_CHANGEBIN XCPU
+#else
+#define CWMP_SIG_REOPEN USR1
+#define CWMP_SIG_CHANGEBIN USR2
+#endif
+
+#endif
diff --git a/ap/app/cwmp/netcwmp/cwmpd/include/cwmp_thread.h b/ap/app/cwmp/netcwmp/cwmpd/include/cwmp_thread.h
new file mode 100755
index 0000000..23eb63b
--- /dev/null
+++ b/ap/app/cwmp/netcwmp/cwmpd/include/cwmp_thread.h
@@ -0,0 +1,45 @@
+/************************************************************************
+ * *
+ * Netcwmp/Opencwmp Project *
+ * A software client for enabling TR-069 in embedded devices (CPE). *
+ * *
+ * Copyright (C) 2013-2014 netcwmp.netcwmp group *
+ * *
+ * This program is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU General Public License *
+ * as published by the Free Software Foundation; either version 2 *
+ * of the License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the *
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330, *
+ * Boston, MA 02111-1307 USA *
+ * *
+ * Copyright 2013-2014 Mr.x() <netcwmp@gmail.com> *
+ * *
+ ***********************************************************************/
+
+#ifndef __CWMP_THREAD_H__
+#define __CWMP_THREAD_H__
+
+
+
+
+
+
+#define cwmp_thread_key_create(key) pthread_key_create(key, NULL)
+
+#define cwmp_thread_key_create_s "the tls key creation"
+
+void cwmp_worker_thread_start(cwmp_t * cwmp);
+
+void * cwmp_worker_thread_run(cwmp_t * cwmp);
+
+int cwmp_worker_thread_init(cwmp_t * cwmp, int num, size_t size);
+
+#endif
diff --git a/ap/app/cwmp/netcwmp/cwmpd/include/cwmp_type.h b/ap/app/cwmp/netcwmp/cwmpd/include/cwmp_type.h
new file mode 100755
index 0000000..9bdee92
--- /dev/null
+++ b/ap/app/cwmp/netcwmp/cwmpd/include/cwmp_type.h
@@ -0,0 +1,166 @@
+/************************************************************************
+ * *
+ * Netcwmp/Opencwmp Project *
+ * A software client for enabling TR-069 in embedded devices (CPE). *
+ * *
+ * Copyright (C) 2013-2014 netcwmp.netcwmp group *
+ * *
+ * This program is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU General Public License *
+ * as published by the Free Software Foundation; either version 2 *
+ * of the License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the *
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330, *
+ * Boston, MA 02111-1307 USA *
+ * *
+ * Copyright 2013-2014 Mr.x() <netcwmp@gmail.com> *
+ * *
+ ***********************************************************************/
+
+#ifndef __CWMP_TYPE_H__
+#define __CWMP_TYPE_H__
+
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdarg.h>
+#include <errno.h>
+
+
+
+
+#ifdef WIN32
+
+# include <winsock2.h>
+# include <windows.h>
+# include <process.h>
+
+#else
+
+#include <malloc.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <sys/time.h>
+#include <sys/utsname.h>
+#include <sys/wait.h>
+#include <sys/fcntl.h>
+#include <sys/stat.h>
+#include <sys/mman.h>
+#include <bits/pthreadtypes.h>
+#include <netinet/in.h>
+#include <unistd.h>
+#include <pthread.h>
+#include <dirent.h>
+#include <netdb.h>
+#include <time.h>
+#include <getopt.h>
+#include <syslog.h>
+#include <signal.h>
+#include <ctype.h>
+//#include <mcheck.h> //mtrace including header file
+
+
+#endif
+
+#include <cwmp/types.h>
+
+
+
+/*!
+* @file Common Platform Runtime Library
+* @author
+* @brief
+*/
+
+
+
+
+#ifdef WIN32
+typedef int cwmp_sig_atomic_t ;
+#else
+typedef sig_atomic_t cwmp_sig_atomic_t ;
+#endif
+
+
+
+
+
+typedef unsigned int cwmp_tls_key_t;
+
+
+
+typedef struct cwmp_process_t cwmp_process_t;
+
+typedef struct cwmp_signal_t cwmp_signal_t;
+typedef struct cwmp_channel_t cwmp_channel_t;
+
+
+
+
+/*
+typedef struct cwmp_command_t cwmp_command_t;
+typedef struct cwmp_module_t cwmp_module_t;
+typedef struct cwmp_conf_t cwmp_conf_t;
+typedef struct cwmp_request_t cwmp_request_t;
+typedef struct cwmp_response_t cwmp_response_t;
+typedef struct cwmp_string_t cwmp_string_t;
+typedef struct cwmp_cwmp_buffer_t cwmp_cwmp_buffer_t;
+typedef struct cwmp_cwmp_chunk_t cwmp_cwmp_chunk_t;
+
+
+typedef struct cwmp_core_conf_t cwmp_core_conf_t;
+typedef struct cwmp_sysfile_t cwmp_sysfile_t;
+typedef struct cwmp_conf_file_t cwmp_conf_file_t;
+typedef struct cwmp_context_t cwmp_context_t;
+
+
+#define CWMP_CHUNK_DEFAULT_SIZE 256
+
+#define CWMP_MODULE_V 0, 0, 0, 0, 0, 0, 0, 0
+#define CWMP_MODULE_V_PANDING 0, 0, 0, 0, 0
+
+*/
+
+
+
+#ifdef WIN32
+#define sleep(x) Sleep(1000 * (x))
+#include <signal.h>
+#endif
+
+
+#define cwmp_bzero(b, len) (void)memset(b, 0, len)
+#ifdef WIN32
+#define cwmp_socket_nonblocking(s) 0
+#else
+#define cwmp_socket_nonblocking(s) fcntl(s, F_SETFL, fcntl(s, F_GETFL) | O_NONBLOCK)
+#endif
+#define cwmp_value_helper(n) #n
+#define cwmp_value(n) cwmp_value_helper(n)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#endif
diff --git a/ap/app/cwmp/netcwmp/cwmpd/include/cwmpd.h b/ap/app/cwmp/netcwmp/cwmpd/include/cwmpd.h
new file mode 100755
index 0000000..bfdc9bb
--- /dev/null
+++ b/ap/app/cwmp/netcwmp/cwmpd/include/cwmpd.h
@@ -0,0 +1,38 @@
+/************************************************************************
+ * *
+ * Netcwmp/Opencwmp Project *
+ * A software client for enabling TR-069 in embedded devices (CPE). *
+ * *
+ * Copyright (C) 2013-2014 netcwmp.netcwmp group *
+ * *
+ * This program is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU General Public License *
+ * as published by the Free Software Foundation; either version 2 *
+ * of the License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the *
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330, *
+ * Boston, MA 02111-1307 USA *
+ * *
+ * Copyright 2013-2014 Mr.x() <netcwmp@gmail.com> *
+ * *
+ ***********************************************************************/
+
+#ifndef __CWMPD_H__
+#define __CWMPD_H__
+
+
+#include "cwmp_module.h"
+#include "cwmp_process.h"
+#include "cwmp_thread.h"
+
+
+
+
+#endif
diff --git a/ap/app/cwmp/netcwmp/cwmpd/src/Makefile.am b/ap/app/cwmp/netcwmp/cwmpd/src/Makefile.am
new file mode 100755
index 0000000..7ef131b
--- /dev/null
+++ b/ap/app/cwmp/netcwmp/cwmpd/src/Makefile.am
@@ -0,0 +1,15 @@
+bin_PROGRAMS = cwmpd
+
+cwmpd_SOURCES = conf.c cwmpd.c httpd.c process.c thread.c agent.c modules/data_model.c
+
+
+AM_CPPFLAGS = -DUSE_CWMP_MEMORY_POOL -I$(top_srcdir)/include -I$(top_srcdir)/cwmpd/include -I$(top_srcdir)/libpool/include -I$(top_srcdir)/libxmlet/include -I$(top_srcdir)/libcwmp/include -I$(top_srcdir)/../../include
+
+
+
+cwmpd_LDADD = -L$(top_srcdir)/libpool/src -L$(top_srcdir)/libxmlet/src -L$(top_srcdir)/libcwmp/src -lpool -lxmlet -lcwmp -lpthread -lsoft_timer -L$(top_srcdir)/../../../lib/libsoft_timer -lsoftap -L$(top_srcdir)/../../../lib/libsoftap -lnvram -L$(top_srcdir)/../../../lib/libnvram
+
+
+cwmpd_CPPFLAGS = $(AM_CPPFLAGS)
+
+cwmpd_LDFLAGS = -D_GNU_SOURCE -DUSE_CWMP_MEMORY_POOL
diff --git a/ap/app/cwmp/netcwmp/cwmpd/src/Makefile.in b/ap/app/cwmp/netcwmp/cwmpd/src/Makefile.in
new file mode 100755
index 0000000..30834c5
--- /dev/null
+++ b/ap/app/cwmp/netcwmp/cwmpd/src/Makefile.in
@@ -0,0 +1,623 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = cwmpd$(EXEEXT)
+subdir = cwmpd/src
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/build/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_cwmpd_OBJECTS = cwmpd-conf.$(OBJEXT) cwmpd-cwmpd.$(OBJEXT) \
+ cwmpd-httpd.$(OBJEXT) cwmpd-process.$(OBJEXT) \
+ cwmpd-thread.$(OBJEXT) cwmpd-agent.$(OBJEXT) \
+ cwmpd-data_model.$(OBJEXT)
+cwmpd_OBJECTS = $(am_cwmpd_OBJECTS)
+cwmpd_DEPENDENCIES =
+cwmpd_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(cwmpd_LDFLAGS) \
+ $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/build/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(cwmpd_SOURCES)
+DIST_SOURCES = $(cwmpd_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_CPU = @BUILD_CPU@
+BUILD_OS = @BUILD_OS@
+BUILD_VENDOR = @BUILD_VENDOR@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DSYMUTIL = @DSYMUTIL@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+HOST_CPU = @HOST_CPU@
+HOST_OS = @HOST_OS@
+HOST_VENDOR = @HOST_VENDOR@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NMEDIT = @NMEDIT@
+OBJEXT = @OBJEXT@
+OPENSSL_DIR = @OPENSSL_DIR@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+cwmpd_SOURCES = conf.c cwmpd.c httpd.c process.c thread.c agent.c modules/data_model.c
+AM_CPPFLAGS = -DUSE_CWMP_MEMORY_POOL -I$(top_srcdir)/include -I$(top_srcdir)/cwmpd/include -I$(top_srcdir)/libpool/include -I$(top_srcdir)/libxmlet/include -I$(top_srcdir)/libcwmp/include -I$(top_srcdir)/../../include
+cwmpd_LDADD = -L$(top_srcdir)/libpool/src -L$(top_srcdir)/libxmlet/src -L$(top_srcdir)/libcwmp/src -lpool -lxmlet -lcwmp -lpthread -lsoft_timer -L$(top_srcdir)/../../../lib/libsoft_timer -lsoftap -L$(top_srcdir)/../../../lib/libsoftap -lnvram -L$(top_srcdir)/../../../lib/libnvram
+cwmpd_CPPFLAGS = $(AM_CPPFLAGS)
+cwmpd_LDFLAGS = -D_GNU_SOURCE -DUSE_CWMP_MEMORY_POOL
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign cwmpd/src/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign cwmpd/src/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p || test -f $$p1; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+cwmpd$(EXEEXT): $(cwmpd_OBJECTS) $(cwmpd_DEPENDENCIES)
+ @rm -f cwmpd$(EXEEXT)
+ $(cwmpd_LINK) $(cwmpd_OBJECTS) $(cwmpd_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cwmpd-agent.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cwmpd-conf.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cwmpd-cwmpd.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cwmpd-data_model.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cwmpd-httpd.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cwmpd-process.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cwmpd-thread.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+cwmpd-conf.o: conf.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cwmpd_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cwmpd-conf.o -MD -MP -MF $(DEPDIR)/cwmpd-conf.Tpo -c -o cwmpd-conf.o `test -f 'conf.c' || echo '$(srcdir)/'`conf.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/cwmpd-conf.Tpo $(DEPDIR)/cwmpd-conf.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='conf.c' object='cwmpd-conf.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cwmpd_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cwmpd-conf.o `test -f 'conf.c' || echo '$(srcdir)/'`conf.c
+
+cwmpd-conf.obj: conf.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cwmpd_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cwmpd-conf.obj -MD -MP -MF $(DEPDIR)/cwmpd-conf.Tpo -c -o cwmpd-conf.obj `if test -f 'conf.c'; then $(CYGPATH_W) 'conf.c'; else $(CYGPATH_W) '$(srcdir)/conf.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/cwmpd-conf.Tpo $(DEPDIR)/cwmpd-conf.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='conf.c' object='cwmpd-conf.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cwmpd_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cwmpd-conf.obj `if test -f 'conf.c'; then $(CYGPATH_W) 'conf.c'; else $(CYGPATH_W) '$(srcdir)/conf.c'; fi`
+
+cwmpd-cwmpd.o: cwmpd.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cwmpd_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cwmpd-cwmpd.o -MD -MP -MF $(DEPDIR)/cwmpd-cwmpd.Tpo -c -o cwmpd-cwmpd.o `test -f 'cwmpd.c' || echo '$(srcdir)/'`cwmpd.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/cwmpd-cwmpd.Tpo $(DEPDIR)/cwmpd-cwmpd.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cwmpd.c' object='cwmpd-cwmpd.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cwmpd_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cwmpd-cwmpd.o `test -f 'cwmpd.c' || echo '$(srcdir)/'`cwmpd.c
+
+cwmpd-cwmpd.obj: cwmpd.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cwmpd_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cwmpd-cwmpd.obj -MD -MP -MF $(DEPDIR)/cwmpd-cwmpd.Tpo -c -o cwmpd-cwmpd.obj `if test -f 'cwmpd.c'; then $(CYGPATH_W) 'cwmpd.c'; else $(CYGPATH_W) '$(srcdir)/cwmpd.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/cwmpd-cwmpd.Tpo $(DEPDIR)/cwmpd-cwmpd.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cwmpd.c' object='cwmpd-cwmpd.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cwmpd_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cwmpd-cwmpd.obj `if test -f 'cwmpd.c'; then $(CYGPATH_W) 'cwmpd.c'; else $(CYGPATH_W) '$(srcdir)/cwmpd.c'; fi`
+
+cwmpd-httpd.o: httpd.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cwmpd_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cwmpd-httpd.o -MD -MP -MF $(DEPDIR)/cwmpd-httpd.Tpo -c -o cwmpd-httpd.o `test -f 'httpd.c' || echo '$(srcdir)/'`httpd.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/cwmpd-httpd.Tpo $(DEPDIR)/cwmpd-httpd.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='httpd.c' object='cwmpd-httpd.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cwmpd_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cwmpd-httpd.o `test -f 'httpd.c' || echo '$(srcdir)/'`httpd.c
+
+cwmpd-httpd.obj: httpd.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cwmpd_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cwmpd-httpd.obj -MD -MP -MF $(DEPDIR)/cwmpd-httpd.Tpo -c -o cwmpd-httpd.obj `if test -f 'httpd.c'; then $(CYGPATH_W) 'httpd.c'; else $(CYGPATH_W) '$(srcdir)/httpd.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/cwmpd-httpd.Tpo $(DEPDIR)/cwmpd-httpd.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='httpd.c' object='cwmpd-httpd.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cwmpd_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cwmpd-httpd.obj `if test -f 'httpd.c'; then $(CYGPATH_W) 'httpd.c'; else $(CYGPATH_W) '$(srcdir)/httpd.c'; fi`
+
+cwmpd-process.o: process.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cwmpd_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cwmpd-process.o -MD -MP -MF $(DEPDIR)/cwmpd-process.Tpo -c -o cwmpd-process.o `test -f 'process.c' || echo '$(srcdir)/'`process.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/cwmpd-process.Tpo $(DEPDIR)/cwmpd-process.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='process.c' object='cwmpd-process.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cwmpd_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cwmpd-process.o `test -f 'process.c' || echo '$(srcdir)/'`process.c
+
+cwmpd-process.obj: process.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cwmpd_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cwmpd-process.obj -MD -MP -MF $(DEPDIR)/cwmpd-process.Tpo -c -o cwmpd-process.obj `if test -f 'process.c'; then $(CYGPATH_W) 'process.c'; else $(CYGPATH_W) '$(srcdir)/process.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/cwmpd-process.Tpo $(DEPDIR)/cwmpd-process.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='process.c' object='cwmpd-process.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cwmpd_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cwmpd-process.obj `if test -f 'process.c'; then $(CYGPATH_W) 'process.c'; else $(CYGPATH_W) '$(srcdir)/process.c'; fi`
+
+cwmpd-thread.o: thread.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cwmpd_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cwmpd-thread.o -MD -MP -MF $(DEPDIR)/cwmpd-thread.Tpo -c -o cwmpd-thread.o `test -f 'thread.c' || echo '$(srcdir)/'`thread.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/cwmpd-thread.Tpo $(DEPDIR)/cwmpd-thread.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='thread.c' object='cwmpd-thread.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cwmpd_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cwmpd-thread.o `test -f 'thread.c' || echo '$(srcdir)/'`thread.c
+
+cwmpd-thread.obj: thread.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cwmpd_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cwmpd-thread.obj -MD -MP -MF $(DEPDIR)/cwmpd-thread.Tpo -c -o cwmpd-thread.obj `if test -f 'thread.c'; then $(CYGPATH_W) 'thread.c'; else $(CYGPATH_W) '$(srcdir)/thread.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/cwmpd-thread.Tpo $(DEPDIR)/cwmpd-thread.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='thread.c' object='cwmpd-thread.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cwmpd_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cwmpd-thread.obj `if test -f 'thread.c'; then $(CYGPATH_W) 'thread.c'; else $(CYGPATH_W) '$(srcdir)/thread.c'; fi`
+
+cwmpd-agent.o: agent.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cwmpd_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cwmpd-agent.o -MD -MP -MF $(DEPDIR)/cwmpd-agent.Tpo -c -o cwmpd-agent.o `test -f 'agent.c' || echo '$(srcdir)/'`agent.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/cwmpd-agent.Tpo $(DEPDIR)/cwmpd-agent.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='agent.c' object='cwmpd-agent.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cwmpd_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cwmpd-agent.o `test -f 'agent.c' || echo '$(srcdir)/'`agent.c
+
+cwmpd-agent.obj: agent.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cwmpd_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cwmpd-agent.obj -MD -MP -MF $(DEPDIR)/cwmpd-agent.Tpo -c -o cwmpd-agent.obj `if test -f 'agent.c'; then $(CYGPATH_W) 'agent.c'; else $(CYGPATH_W) '$(srcdir)/agent.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/cwmpd-agent.Tpo $(DEPDIR)/cwmpd-agent.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='agent.c' object='cwmpd-agent.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cwmpd_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cwmpd-agent.obj `if test -f 'agent.c'; then $(CYGPATH_W) 'agent.c'; else $(CYGPATH_W) '$(srcdir)/agent.c'; fi`
+
+cwmpd-data_model.o: modules/data_model.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cwmpd_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cwmpd-data_model.o -MD -MP -MF $(DEPDIR)/cwmpd-data_model.Tpo -c -o cwmpd-data_model.o `test -f 'modules/data_model.c' || echo '$(srcdir)/'`modules/data_model.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/cwmpd-data_model.Tpo $(DEPDIR)/cwmpd-data_model.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='modules/data_model.c' object='cwmpd-data_model.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cwmpd_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cwmpd-data_model.o `test -f 'modules/data_model.c' || echo '$(srcdir)/'`modules/data_model.c
+
+cwmpd-data_model.obj: modules/data_model.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cwmpd_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cwmpd-data_model.obj -MD -MP -MF $(DEPDIR)/cwmpd-data_model.Tpo -c -o cwmpd-data_model.obj `if test -f 'modules/data_model.c'; then $(CYGPATH_W) 'modules/data_model.c'; else $(CYGPATH_W) '$(srcdir)/modules/data_model.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/cwmpd-data_model.Tpo $(DEPDIR)/cwmpd-data_model.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='modules/data_model.c' object='cwmpd-data_model.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cwmpd_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cwmpd-data_model.obj `if test -f 'modules/data_model.c'; then $(CYGPATH_W) 'modules/data_model.c'; else $(CYGPATH_W) '$(srcdir)/modules/data_model.c'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool ctags distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-binPROGRAMS install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am \
+ uninstall-binPROGRAMS
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/ap/app/cwmp/netcwmp/cwmpd/src/agent.c b/ap/app/cwmp/netcwmp/cwmpd/src/agent.c
new file mode 100755
index 0000000..58038f3
--- /dev/null
+++ b/ap/app/cwmp/netcwmp/cwmpd/src/agent.c
@@ -0,0 +1,1207 @@
+/************************************************************************
+ * *
+ * Netcwmp/Opencwmp Project *
+ * A software client for enabling TR-069 in embedded devices (CPE). *
+ * *
+ * Copyright (C) 2013-2014 netcwmp.netcwmp group *
+ * *
+ * This program is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU General Public License *
+ * as published by the Free Software Foundation; either version 2 *
+ * of the License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the *
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330, *
+ * Boston, MA 02111-1307 USA *
+ * *
+ * Copyright 2013-2014 Mr.x(Mr.x) <netcwmp@gmail.com> *
+ * *
+ ***********************************************************************/
+#include "cwmp/periodic.h"
+
+#include "cwmp_module.h"
+#include "cwmp_agent.h"
+#include <cwmp/session.h>
+//#include "modules/data_model.h"
+
+#include "soft_timer.h"
+
+
+#define CWMP_TRUE 1
+
+#define MAX_SESSION_RETRY 3
+
+enum
+{
+ CWMP_ST_START = 0,
+ CWMP_ST_INFORM,
+ CWMP_ST_SEND,
+ CWMP_ST_RESEMD,
+ CWMP_ST_RECV,
+ CWMP_ST_ANSLYSE,
+ CWMP_ST_RETRY,
+ CWMP_ST_END,
+ CWMP_ST_EXIT
+};
+
+#define SECHEDULE_INFORM_TIMER (31)
+
+schedule_inform_info_st g_si;
+
+int get_session_status()
+{
+ return g_si.cwmp->session_running;
+}
+
+void *schedule_inform_timeout(void *arg)
+{
+ FUNCTION_TRACE();
+ int i = 0;
+
+ schedule_inform_info_st *psi = (schedule_inform_info_st *)arg;
+
+ cwmp_log_info("push begin");
+
+ psi->timer_running = 2;
+
+// while(1)
+// {
+// if(SESSION_NO_RUNNING == get_session_status())
+// {
+ psi->cwmp->new_request = CWMP_YES;
+ cwmp_event_set_value(psi->cwmp, INFORM_SCHEDULED, 1, psi->commandKey, 0, 0, 0);
+ cwmp_log_info("commandkey is:%s", psi->commandKey);
+ psi->timer_running = 0;
+
+ cwmp_log_info("push ok");
+
+ return NULL;
+// }
+// else
+// {
+// cwmp_log_info("there is session running");
+// psi->timer_running = 0;
+// g_si.delaytime += 1;
+// if(CWMP_OK != schedule_inform_create_timer(&g_si))
+// {
+// ;
+// }
+// }
+// }
+
+ return NULL;
+}
+
+
+int schedule_inform_create_timer(schedule_inform_info_st* psi)
+{
+ FUNCTION_TRACE();
+
+ if(2 == g_si.timer_running){
+ cwmp_log_info("there is other schedule inform running!");
+ return CWMP_OK;
+ }
+ else if(1 == g_si.timer_running)
+ {
+ // if exist one schedule inform timer, update
+ cwmp_log_info("there is other schedule inform active!");
+ sc_timer_delete(SECHEDULE_INFORM_TIMER);
+ }
+ else
+ {
+ cwmp_log_info("update schedule inform info, create timer");
+ }
+
+ TRstrncpy(g_si.commandKey, psi->commandKey, COMMAND_KEY_LEN);
+ g_si.delaytime = psi->delaytime;
+ g_si.cwmp = psi->cwmp;
+
+
+ cwmp_log_info("begin to create timer!");
+
+ long result = sc_timer_create(SECHEDULE_INFORM_TIMER, TIMER_FLAG_ONCE, psi->delaytime*1000, schedule_inform_timeout, &g_si);
+ g_si.timer_running = 1;
+ cwmp_log_info("end to create timer!");
+
+ cwmp_log_info("commandkey is:%s, delaytime:%d", psi->commandKey, psi->delaytime);
+
+ return CWMP_OK;
+}
+
+
+
+int cwmp_agent_retry_session(cwmp_session_t * session)
+{
+
+ int sec = 0;
+ int count = 1;
+
+ srand(time(NULL));
+ switch (session->retry_count)
+ {
+ case 0:
+ {
+ count = 5; //5~10
+ break;
+ }
+ case 1:
+ {
+ count = 10; //5~15
+ break;
+ }
+ case 2:
+ {
+ count = 20; //5~25
+ break;
+ }
+ default:
+ {
+ count = 30; //5~35
+ break;
+ }
+ }
+
+ sec = 5 + rand()% count;
+
+ while (sec>0)
+ {
+ sleep(1);
+ sec--;
+ }
+
+ if (session->retry_count > MAX_SESSION_RETRY)
+ {
+ session->retry_count = 0;
+ return CWMP_TIMEOUT;
+ }
+ else
+ {
+ session->retry_count ++;
+ return CWMP_OK;
+ }
+
+}
+
+
+int cwmp_agent_create_datetimes(datatime_t *nowtime)
+{
+ struct tm *t;
+ time_t tn;
+
+
+ //FUNCTION_TRACE();
+ tn = time(NULL);
+#ifdef WIN32
+ cwmp_log_debug("inform datatime");
+ //localtime_s(&t, &tn);
+ t = MALLOC(sizeof(struct tm));
+ memset(t, 0, sizeof(struct tm));
+#else
+ t = localtime(&tn);
+#endif
+
+ if(NULL != t)
+ {
+ nowtime->year = t->tm_year + 1900;
+ nowtime->month = t->tm_mon + 1;
+ nowtime->day = t->tm_mday;
+ nowtime->hour = t->tm_hour;
+ nowtime->min = t->tm_min;
+ nowtime->sec = t->tm_sec;
+ }
+ else
+ {
+ cwmp_log_error("localtime return null");
+ }
+
+ return CWMP_OK;
+}
+
+//È¡µÃactive eventÒÔ¼°count
+int cwmp_agent_get_active_event(cwmp_t *cwmp, cwmp_session_t * session, event_list_t **pevent_list)
+{
+ event_list_t * el;
+ event_code_t * ev;
+ int i=0;
+ FUNCTION_TRACE();
+
+ el = cwmp_create_event_list(session->env, INFORM_MAX);
+ if(NULL == el)
+ {
+ cwmp_log_error("el cwmp_create_event_list return NULL");
+ return CWMP_ERROR;
+ }
+
+ event_code_t ** pec = cwmp->el->events;
+
+ int elsize = cwmp->el->count;
+ for(i=0; i<elsize; i++)
+ {
+
+ if(pec[i] && pec[i]->ref > 0)
+ {
+
+ event_code_t * ec = pec[i];
+ ev = cwmp_create_event_code(session->env);
+ if(NULL == ev)
+ {
+ cwmp_log_error("ev cwmp_create_event_code return null");
+ return CWMP_ERROR;
+ }
+
+ ev->event = ec->event;
+ ev->code = ec->code;
+
+ if (pec[i]->event == INFORM_MREBOOT || pec[i]->event == INFORM_BOOTSTRAP)
+ {
+ strncpy(ev->command_key , ec->command_key, COMMAND_KEY_LEN);
+ }
+
+
+ el->events[el->count++] = ev;
+ ev = NULL;
+
+ }
+ }
+ if (el->count == 0)
+ {
+ ev = cwmp_create_event_code(session->env);
+ if(NULL == ev)
+ {
+ cwmp_log_error("ev cwmp_create_event_code return null");
+ return CWMP_ERROR;
+ }
+
+ ev->event = INFORM_BOOT;
+ ev->code = CWMP_INFORM_EVENT_CODE_1;
+ el->events[el->count++] = ev;
+ }
+
+ *pevent_list = el;
+
+ return CWMP_OK;
+}
+
+int cwmp_agent_send_request(cwmp_session_t * session)
+{
+ FUNCTION_TRACE();
+ return cwmp_session_send_request(session);
+}
+
+int cwmp_agent_recv_response(cwmp_session_t * session)
+{
+ return cwmp_session_recv_response(session);
+}
+
+void cwmp_agent_start_session(cwmp_t * cwmp)
+{
+ int rv;
+ cwmp_session_t * session;
+ int session_close = CWMP_NO;
+ xmldoc_t * newdoc;
+ FUNCTION_TRACE();
+ event_list_t *evtlist;
+
+ while (TRUE)
+ {
+ if (cwmp->new_request == CWMP_NO)
+ {
+ cwmp_log_debug("No new request from ACS\n");
+ sleep(2);
+ //cwmp->new_request = CWMP_YES;
+ continue;
+ }
+
+ cwmp_log_debug("New request from ACS\n");
+
+ cwmp_clean_periodic_inform(cwmp);
+
+ cwmp->new_request = CWMP_NO;
+ session = cwmp_session_create(cwmp);
+ if(NULL == session)
+ {
+ cwmp_log_error("session cwmp_session_create return NULL");
+ cwmp->new_request = CWMP_YES;
+ continue;
+ }
+
+ session_close = CWMP_NO;
+ session->timeout = cwmp_conf_get_int("cwmpd:http_timeout");
+ //cwmp_session_set_timeout(cwmp_conf_get_int("cwmpd:http_timeout"));
+ cwmp_log_debug("session timeout is %d", session->timeout);
+
+ cwmp_session_open(session);
+
+ while (!session_close)
+ {
+ //cwmp_log_debug("session status: %d", session->status);
+ switch (session->status)
+ {
+ case CWMP_ST_START:
+ //create a new connection to acs
+ cwmp_log_debug("session stutus: New START\n");
+
+ if (cwmp_session_connect(session, cwmp->acs_url) != CWMP_OK)
+ {
+ cwmp_log_error("connect to acs: %s failed.\n", cwmp->acs_url);
+ session->status = CWMP_ST_RETRY;
+ }
+ else
+ {
+ session->status = CWMP_ST_INFORM;
+ }
+ break;
+ case CWMP_ST_INFORM:
+ evtlist = NULL;
+ cwmp_log_debug("session stutus: INFORM\n");
+ cwmp_agent_get_active_event(cwmp, session, & evtlist);
+ if(evtlist != NULL)
+ {
+ cwmp_event_clear_active(cwmp);
+ }
+ else
+ {
+ cwmp_log_debug("evtlist is null");
+ session->status = CWMP_ST_EXIT;
+ break;
+ }
+
+ cwmp_log_debug("session stutus: INFORM2\n");
+ if (cwmp->acs_auth)
+ {
+ cwmp_session_set_auth(session, cwmp->acs_user, cwmp->acs_pwd );
+ }
+
+ cwmp_log_debug("session stutus: INFORM3\n");
+ newdoc = cwmp_session_create_inform_message(session, evtlist, session->envpool);
+
+ if(NULL != newdoc)
+ {
+ cwmp_write_doc_to_chunk(newdoc, session->writers, session->envpool);
+ session->last_method = CWMP_INFORM_METHOD;
+ session->status = CWMP_ST_SEND;
+ }
+ else
+ {
+ cwmp_log_error("newdoc is null");
+ session->last_method = CWMP_INFORM_METHOD;
+ session->status = CWMP_ST_EXIT;
+ }
+
+ break;
+
+ case CWMP_ST_SEND:
+
+ cwmp_log_debug("session stutus: SEND");
+ cwmp_log_debug("session data request length: %d", cwmp_chunk_length(session->writers));
+ session->newdata = CWMP_NO;
+
+ rv = cwmp_agent_send_request(session);
+
+ if (rv == CWMP_OK)
+ {
+ cwmp_log_debug("session data sended OK, rv=%d", rv);
+ session->status = CWMP_ST_RECV;
+ }
+ else
+ {
+ cwmp_log_debug("session data sended faild! rv=%d", rv);
+ session->status = CWMP_ST_EXIT;
+ /*
+ if (rv == CWMP_COULDNOT_CONNECT)
+ {
+ session->status = CWMP_ST_RETRY;
+ }
+ else
+ {
+ session->status = CWMP_ST_EXIT;
+ }
+ */
+ }
+
+ break;
+ case CWMP_ST_RECV:
+ cwmp_log_debug("session stutus: RECV");
+ cwmp_chunk_clear(session->readers);
+
+ rv = cwmp_agent_recv_response(session);
+
+ if (rv == CWMP_OK)
+ {
+ session->status = CWMP_ST_ANSLYSE;
+ }
+ else
+ {
+ session->status = CWMP_ST_END;
+ }
+ break;
+
+ case CWMP_ST_ANSLYSE:
+ cwmp_log_debug("session stutus: ANSLYSE");
+ rv = cwmp_agent_analyse_session(session);
+ if (rv == CWMP_OK)
+ {
+ session->status = CWMP_ST_SEND;
+ }
+ else
+ {
+ session->status = CWMP_ST_END;
+ }
+ break;
+ case CWMP_ST_RETRY:
+ cwmp_log_debug("session stutus: RETRY");
+ if (cwmp_agent_retry_session(session) == CWMP_TIMEOUT)
+ {
+ cwmp_log_debug("session retry timeover, go out");
+ session->status = CWMP_ST_EXIT;
+ }
+ else
+ {
+ session->status = CWMP_ST_START;
+ }
+ break;
+ case CWMP_ST_END:
+ //close connection of ACS
+ cwmp_log_debug("session stutus: END");
+ //run task from queue
+
+ if (session->newdata == CWMP_YES)
+ {
+ session->status = CWMP_ST_SEND;
+ }
+ else
+ {
+ session->status = CWMP_ST_EXIT;
+ }
+ break;
+
+ case CWMP_ST_EXIT:
+ cwmp_log_debug("session stutus: EXIT");
+ cwmp_session_close(session);
+ if (session->reconnect == CWMP_YES)
+ {
+ session->reconnect = CWMP_NO;
+ session->status = CWMP_ST_START;
+ break;
+ }
+ session_close = CWMP_YES;
+ break;
+
+
+ default:
+ cwmp_log_debug("Unknown session stutus");
+ break;
+ }//end switch
+ }//end while(!session_close)
+
+ cwmp_log_debug("session stutus: EXIT");
+ cwmp_session_free(session);
+ session = NULL;
+
+ cwmp->session_running = SESSION_NO_RUNNING;
+
+ int newtaskres = cwmp_agent_run_tasks(cwmp);
+ if(newtaskres == CWMP_YES)
+ {
+ cwmp->new_request = CWMP_YES;
+ }
+
+ cwmp_reset_periodic_inform(cwmp);
+
+ }//end while(TRUE)
+}
+
+
+int cwmp_agent_analyse_session(cwmp_session_t * session)
+{
+ pool_t * doctmppool = NULL;
+ char * xmlbuf;
+ cwmp_uint32_t len;
+ xmldoc_t * doc;
+ char * method;
+ xmldoc_t * newdoc = NULL;
+ int rc = CWMP_OK;
+
+ static char * xml_fault = "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:cwmp=\"urn:dslforum-org:cwmp-1-0\" xmlns=\"urn:dslforum-org:cwmp-1-0\"><SOAP-ENV:Body SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" id=\"_0\"><SOAP-ENV:Fault>Error Message</SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>";
+
+ cwmp_uint32_t msglength = 0;
+
+ FUNCTION_TRACE();
+ if(NULL == session)
+ {
+ cwmp_log_error("session is null");
+ return CWMP_ERROR;
+ }
+
+ cwmp_t * cwmp = session->cwmp;
+ if(NULL == cwmp)
+ {
+ cwmp_log_error("cwmp is null");
+ return CWMP_ERROR;
+ }
+
+ msglength = cwmp_chunk_length(session->readers);
+ if (msglength<= 0)
+ {
+ session->newdata = CWMP_NO;
+ cwmp_log_debug("analyse receive length is 0");
+ goto eventcheck;
+// return CWMP_ERROR;
+ }
+
+ doctmppool = pool_create(POOL_DEFAULT_SIZE);
+ if(NULL == doctmppool)
+ {
+ cwmp_log_error("doctmppool is null");
+ return CWMP_ERROR;
+ }
+
+ xmlbuf = pool_palloc(doctmppool, msglength+32);
+ if(NULL == xmlbuf)
+ {
+ cwmp_log_error("xmlbuf is null");
+ return CWMP_ERROR;
+ }
+
+ len = sprintf(xmlbuf,"<cwmp>");
+ cwmp_chunk_copy(xmlbuf + len, session->readers, msglength);
+ strncpy(xmlbuf+len+msglength, "</cwmp>", 32-len-1);
+
+ cwmp_log_debug("agent analyse xml: \n%s", xmlbuf);
+
+ doc = XmlParseBuffer(doctmppool, xmlbuf);
+ if (!doc)
+ {
+ cwmp_log_debug("analyse create doc null\n");
+ cwmp_chunk_write_string(session->writers, xml_fault, TRstrlen(xml_fault), session->envpool);
+ goto finished;
+
+ }
+
+ method = cwmp_get_rpc_method_name(doc);
+ cwmp_log_debug("analyse method is: %s\n", method);
+
+ cwmp_chunk_clear(session->writers);
+ pool_clear(session->envpool);
+
+ cwmp_log_info("----------------------------");
+
+ if (TRstrcmp(method, CWMP_RPC_GETRPCMETHODS) == 0)
+ {
+ newdoc = cwmp_session_create_getrpcmethods_response_message(session, doc, doctmppool);
+ }
+ else if (TRstrcmp(method, CWMP_RPC_INFORMRESPONSE) == 0)
+ {
+ newdoc = NULL;
+ }
+ else if (TRstrcmp(method, CWMP_RPC_GETPARAMETERNAMES) == 0)
+ {
+ newdoc = cwmp_session_create_getparameternames_response_message(session, doc, doctmppool);
+ }
+ else if (TRstrcmp(method, CWMP_RPC_GETPARAMETERVALUES) == 0)
+ {
+ newdoc = cwmp_session_create_getparametervalues_response_message(session, doc, doctmppool);
+ }
+ else if (TRstrcmp(method, CWMP_RPC_SETPARAMETERVALUES) == 0)
+ {
+ newdoc = cwmp_session_create_setparametervalues_response_message(session, doc, doctmppool);
+ }
+ else if (TRstrcmp(method, CWMP_RPC_DOWNLOAD) == 0)
+ {
+ newdoc = cwmp_session_create_download_response_message(session, doc, doctmppool);
+ }
+ else if (TRstrcmp(method, CWMP_RPC_UPLOAD) == 0)
+ {
+ newdoc = cwmp_session_create_upload_response_message(session, doc, doctmppool);
+ }
+ else if (TRstrcmp(method, CWMP_RPC_TRANSFERCOMPLETERESPONSE) == 0)
+ {
+ newdoc = NULL;
+ }
+ else if (TRstrcmp(method, CWMP_RPC_REBOOT) == 0)
+ {
+ newdoc = cwmp_session_create_reboot_response_message(session, doc, doctmppool);
+ }
+ else if (TRstrcmp(method, CWMP_RPC_ADDOBJECT) == 0)
+ {
+ newdoc = cwmp_session_create_addobject_response_message(session, doc, doctmppool);
+ }
+ else if (TRstrcmp(method, CWMP_RPC_DELETEOBJECT) == 0)
+ {
+ newdoc = cwmp_session_create_deleteobject_response_message(session, doc, doctmppool);
+ }
+
+ else if (TRstrcmp(method, CWMP_RPC_FACTORYRESET) == 0)
+ {
+ newdoc = cwmp_session_create_factoryreset_response_message(session, doc, doctmppool);
+ }
+ else if (TRstrcmp(method, CWMP_RPC_GETPARAMETERATTRIBUTES) == 0)
+ {
+ newdoc = cwmp_session_create_getparamterattributes_response_message(session, doc, doctmppool);
+ }
+ else if (TRstrcmp(method, CWMP_RPC_SETPARAMETERATTRIBUTES) == 0)
+ {
+ newdoc = cwmp_session_create_setparamterattributes_response_message(session, doc, doctmppool);
+ }
+ else if (TRstrcmp(method, CWMP_RPC_SCHEDULEINFORM) == 0)
+ {
+ schedule_inform_info_st si;
+ si.cwmp = session->cwmp;
+ newdoc = cwmp_session_create_scheduleinform_response_message(session, doc, doctmppool, &si);
+ int rc = schedule_inform_create_timer(&si);
+ }
+ else
+ {
+ //check event queue
+ //newdoc = cwmp_session_create_event_response_message(session, doc, doctmppool);
+ cwmp_log_info("unknown method type:%s", method);
+ }
+
+ cwmp_log_info("----------------------------");
+
+// cwmp_t * cwmp = session->cwmp;
+ if(newdoc == NULL)
+ {
+ cwmp_log_debug("agent analyse newdoc is null. ");
+
+eventcheck:
+ {
+
+ cwmp_log_debug("agent analyse begin check global event, %d", cwmp->event_global.event_flag);
+
+ //check global event for transfercomplete
+
+ if(cwmp->event_global.event_flag & EVENT_REBOOT_TRANSFERCOMPLETE_FLAG)
+ {
+ cwmp->event_global.event_flag &= ~EVENT_REBOOT_TRANSFERCOMPLETE_FLAG;
+ if(!doctmppool)
+ {
+ doctmppool = pool_create(POOL_DEFAULT_SIZE);
+ }
+
+ if(!doctmppool)
+ {
+ cwmp_log_error("doctmppool pool create return null");
+ return CWMP_ERROR;
+ }
+ event_code_t ec;
+ ec.event = INFORM_TRANSFERCOMPLETE;
+ TRstrncpy(ec.command_key, cwmp->event_global.event_key, COMMAND_KEY_LEN);
+ ec.fault_code = cwmp->event_global.fault_code;
+ ec.start = cwmp->event_global.start;
+ ec.end = cwmp->event_global.end;
+ newdoc = cwmp_session_create_transfercomplete_message(session, &ec, doctmppool);
+
+ }
+
+ }
+
+ }
+
+
+ cwmp_log_debug("newdoc %p, msglength: %d", newdoc, msglength );
+ if(newdoc != NULL) // || (newdoc == NULL && msglength == 0 && session->retry_count < 2))
+ {
+ session->newdata = CWMP_YES;
+ cwmp_write_doc_to_chunk(newdoc, session->writers, session->envpool);
+ rc = CWMP_OK;
+ }
+ else if(/*newdoc == NULL && */msglength != 0)
+ {
+ session->newdata = CWMP_YES;
+ cwmp_write_doc_to_chunk(newdoc, session->writers, session->envpool);
+ rc = CWMP_OK;
+ }
+ else
+ {
+ rc = CWMP_ERROR;
+ }
+
+finished:
+ if(doctmppool != NULL)
+ {
+ pool_destroy(doctmppool);
+ }
+
+ return rc;
+}
+
+
+
+static void print_param(parameter_node_t * param, int level)
+{
+ if(!param) return;
+
+ parameter_node_t * child;
+ char fmt[128];
+ //cwmp_log_debug("name: %s, type: %s, level: %d\n", param->name, cwmp_get_type_string(param->type), level);
+ int i=0;
+
+ snprintf(fmt, 127, "|%%-%ds%%s, get:%%p set:%%p refresh:%%p\n", level*4);
+
+ cwmp_log_debug_src(fmt, "----", param->name, param->get, param->set, param->refresh);
+
+ child = param->child;
+
+ if(!child)
+ return;
+ print_param(child, level+1);
+
+ parameter_node_t * next = child->next_sibling;
+
+ while(next)
+ {
+ print_param(next, level+1);
+ next = next->next_sibling;
+ }
+}
+
+
+
+void cwmp_agent_session(cwmp_t * cwmp)
+{
+ char name[1024] = {0};
+ char value[1024]= {0};
+ char local_ip[256];
+
+ char * envstr;
+ char * encstr;
+
+ envstr = "SOAP-ENV"; //cwmp_conf_get("cwmp:soap_env");
+ encstr = "SOAP-ENC"; // cwmp_conf_get("cwmp:soap_enc");
+
+ cwmp_set_envelope_ns(envstr, encstr);
+
+#if 0
+ if (cwmp_session_get_localip(local_ip) == -1)
+ {
+ cwmp_log_error("get local ip error. exited.\n");
+ exit(-1);
+ }
+#else
+ cwmp_session_get_localip(local_ip);
+#endif
+
+ print_param(cwmp->root, 0);
+
+ CWMP_SPRINTF_PARAMETER_NAME(name, 3, InternetGatewayDeviceModule, ManagementServerModule, URLModule);
+ cwmp_data_set_parameter_value(cwmp, cwmp->root, name, cwmp->acs_url, TRstrlen(cwmp->acs_url), cwmp->pool);
+
+ CWMP_SPRINTF_PARAMETER_NAME(name, 3, InternetGatewayDeviceModule, ManagementServerModule, ConnectionRequestURLModule);
+ TRsnprintf(value, 1024, "http://%s:%d", local_ip, cwmp->httpd_port);
+ cwmp_data_set_parameter_value(cwmp, cwmp->root, name, value, TRstrlen(value), cwmp->pool);
+ cwmp_log_debug("set request name:%s, value:%s", name, value);
+
+
+ CWMP_SPRINTF_PARAMETER_NAME(name, 3, InternetGatewayDeviceModule, DeviceInfoModule, ManufacturerModule);
+ cwmp_data_set_parameter_value(cwmp, cwmp->root, name, cwmp->cpe_mf, TRstrlen(cwmp->cpe_mf), cwmp->pool);
+
+
+ CWMP_SPRINTF_PARAMETER_NAME(name, 3, InternetGatewayDeviceModule, DeviceInfoModule, ManufacturerOUIModule);
+ cwmp_data_set_parameter_value(cwmp, cwmp->root, name, cwmp->cpe_oui, TRstrlen(cwmp->cpe_oui), cwmp->pool);
+
+ CWMP_SPRINTF_PARAMETER_NAME(name, 3, InternetGatewayDeviceModule, DeviceInfoModule, ProductClassModule);
+ cwmp_data_set_parameter_value(cwmp, cwmp->root, name, cwmp->cpe_pc, TRstrlen(cwmp->cpe_pc), cwmp->pool);
+
+ CWMP_SPRINTF_PARAMETER_NAME(name, 3, InternetGatewayDeviceModule, DeviceInfoModule, SerialNumberModule);
+ cwmp_data_set_parameter_value(cwmp, cwmp->root, name, cwmp->cpe_sn, TRstrlen(cwmp->cpe_sn), cwmp->pool);
+
+
+ cwmp_agent_start_session(cwmp);
+}
+
+
+/*
+int cwmp_agent_download_file(download_arg_t * dlarg)
+{
+ int faultcode = 0;
+ char url[255];
+ if (TRstrncasecmp(dlarg->url, "ftp://", 6) == 0)
+ {
+ if (dlarg->username != NULL && strlen(dlarg->username) != 0)
+ {
+ TRsnprintf(url, 255, "ftp://%s:%s@%s", dlarg->username, dlarg->password, dlarg->url+6);
+ }
+ else
+ {
+ TRstrncpy(url, dlarg->url, 255);
+ }
+ }
+ else
+ {
+ TRstrncpy(url, dlarg->url, 255);
+ }
+
+ fetchIO * downfile = fetchGetURL(url, "");
+ if (!downfile)
+ {
+ cwmp_log_debug("download file fail: %s", url);
+ faultcode = 9001;
+ }
+ else
+ {
+ char readbuf[1024];
+ int readlen;
+ char targetfile[64];
+ if (dlarg->targetname != NULL && strlen(dlarg->targetname) != 0)
+ {
+ TRsnprintf(targetfile, 64, "/tmp/%s", dlarg->targetname);
+ }
+ else
+ {
+ TRsnprintf(targetfile, 64, "/tmp/%d.file", time(NULL));
+ }
+ FILE * df = fopen(targetfile, "wb+");
+ while (df != NULL)
+ {
+ readlen = fetchIO_read(downfile, readbuf, 1023);
+ if (readlen <= 0)
+ {
+ cwmp_log_debug("fetch io read zero. %s", readlen);
+ break;
+ }
+ readbuf[readlen] = 0;
+ fwrite(readbuf, readlen, 1, df);
+ }
+
+ if (df)
+ {
+ fclose(df);
+ }
+ else
+ {
+ faultcode = 9001;
+ }
+
+ cwmp_log_debug("download file ok: %s, %s", url, targetfile);
+
+
+ fetchIO_close(downfile);
+ }
+
+
+ return faultcode;
+
+}
+
+
+
+int cwmp_agent_upload_file(upload_arg_t * ularg)
+{
+ int faultcode = 0;
+ char url[255];
+
+ if (TRstrncasecmp(ularg->url, "ftp://", 6) == 0)
+ {
+ if (ularg->username != NULL && strlen(ularg->username) != 0)
+ {
+ TRsnprintf(url, 255, "ftp://%s:%s@%s", ularg->username, ularg->password, ularg->url+6);
+ }
+ else
+ {
+ TRstrncpy(url, ularg->url, 255);
+ }
+ }
+ else
+ {
+ TRstrncpy(url, ularg->url, 255);
+ }
+
+ fetchIO * uploadfile = fetchPutURL(url, "");
+ if (!uploadfile)
+ {
+ cwmp_log_debug("upload file fail: %s", url);
+ faultcode = 9001;
+ }
+ else
+ {
+ char readbuf[1024];
+ int readlen;
+ char targetfile[64];
+ FILE * uf;
+ int rc;
+ if(strcmp(ularg->filetype, "1 Vendor Configuration File") == 0)
+ {
+ //¸ù¾Ýʵ¼ÊÇé¿ö, ÐÞ¸ÄÕâÀïµÄÅäÖÃÎļþ·¾¶
+
+ uf = fopen("/tmp/mysystem.cfg", "rb");
+ }
+ else if(strcmp(ularg->filetype, "2 Vendor Log File") == 0)
+ {
+ //¸ù¾Ýʵ¼ÊÇé¿ö, ÐÞ¸ÄÕâÀïµÄÅäÖÃÎļþ·¾¶
+ uf = fopen("/tmp/mysystem.log", "rb");
+ }
+ else
+ {
+ uf = fopen("/tmp/mysystem.log", "rb");
+ }
+
+
+ while (uf != NULL)
+ {
+ readlen = fread(readbuf, 1024, 1, uf);
+ if (readlen <= 0)
+ {
+ cwmp_log_debug("fetch io read zero. %s", readlen);
+
+ break;
+ }
+ readbuf[readlen] = 0;
+
+ rc = fetchIO_write(uploadfile, readbuf, readlen);
+ if(rc <= 0)
+ {
+ faultcode = 9001;
+ break;
+ }
+
+ }
+
+ if(uf)
+ {
+ fclose(uf);
+ }
+ else
+ {
+ faultcode = 9001;
+ }
+
+
+
+ cwmp_log_debug("upload file finished: %s, file:%s", url, targetfile);
+
+
+ fetchIO_close(uploadfile);
+ }
+
+
+ return faultcode;
+
+}
+*/
+
+
+
+int cwmp_agent_download_file(download_arg_t * dlarg)
+{
+ int faultcode = 0;
+ char * fromurl = dlarg->url;
+
+ char tofile[256+1] = {0};
+ char downloadroot[256+1] = {0};
+
+ FUNCTION_TRACE();
+
+ if(!fromurl)
+ {
+ cwmp_log_error("download src file path is null!");
+ return 9001;
+ }
+
+ if(NULL == dlarg->targetname)
+ {
+ if(TRstrcmp(dlarg->filetype, "1 Firmware Upgrade Image") == 0)
+ {
+ cwmp_conf_get("file:download_img_path", tofile);
+ }
+ else if(TRstrcmp(dlarg->filetype, "3 Vendor Configuration File") == 0)
+ {
+ cwmp_conf_get("file:download_cfg_path", tofile);
+ }
+ else
+ {
+ cwmp_conf_get("file:download_unknown_path", tofile);
+ }
+ }
+ else
+ {
+ cwmp_conf_get("file:download_root", downloadroot);
+ TRsnprintf(tofile, 256, "%s/%s", downloadroot, dlarg->targetname);
+ }
+
+ cwmp_log_info("file type:%s, save file(%s) to path:%s", dlarg->filetype, fromurl, tofile);
+
+ if(/*dlarg->url &&*/ TRstrncasecmp("ftp://", dlarg->url, 6) == 0)
+ {
+ cwmp_log_debug("Download url:%s", dlarg->url);
+ return 9001;
+ }
+
+ faultcode = http_receive_file(fromurl, tofile);
+
+ if(faultcode != CWMP_OK)
+ {
+ cwmp_log_debug("faultcode:%d", faultcode);
+ faultcode = 9001;
+ }
+
+ return faultcode;
+}
+
+
+
+int cwmp_agent_upload_file(upload_arg_t * ularg)
+{
+ int faultcode = 0;
+ FUNCTION_TRACE();
+ char * fromfile;
+
+ char cfg_path[256] = {0};
+ char log_path[256] = {0};
+
+ FUNCTION_TRACE();
+
+ cwmp_conf_get("file:upload_cfg_path", cfg_path);
+ cwmp_conf_get("file:upload_log_path", log_path);
+
+ if(TRstrcmp(ularg->filetype, "1 Vendor Configuration File") == 0)
+ {
+ fromfile = cfg_path;
+ }
+ else if(TRstrcmp(ularg->filetype, "2 Vendor Log File") == 0)
+ {
+ fromfile = log_path;
+ }
+ else
+ {
+ fromfile = cfg_path;
+ }
+
+ cwmp_log_info("upload type:%s, send file:%s, url:%s", ularg->filetype, fromfile, ularg->url);
+
+
+ faultcode = http_send_file(fromfile, ularg->url);
+
+ if(faultcode != CWMP_OK)
+ {
+ cwmp_log_error("http send file return[%d], not CWMP_OK, set faultcode 9001", faultcode);
+ faultcode = 9001;
+ }
+
+ return faultcode;
+}
+
+
+
+int cwmp_agent_run_tasks(cwmp_t * cwmp)
+{
+ void * data;
+ int tasktype = 0;;
+ int ok = CWMP_NO;
+ int rc = 0;
+
+ FUNCTION_TRACE();
+
+ while(1)
+ {
+ tasktype = queue_pop(cwmp->queue, &data);
+ if(tasktype == -1)
+ {
+ cwmp_log_debug("no more task to run");
+ break;
+ }
+ ok = CWMP_YES;
+ switch(tasktype)
+ {
+ case TASK_DOWNLOAD_TAG:
+ {
+ cwmp_log_debug("Download begin.....");
+
+ download_arg_t * dlarg = (download_arg_t*)data;
+ //begin download file
+ time_t starttime = time(NULL);
+ int faultcode = 0;
+
+ faultcode = cwmp_agent_download_file(dlarg);
+
+ time_t endtime = time(NULL);
+ cwmp_event_set_value(cwmp, INFORM_TRANSFERCOMPLETE, 1,dlarg->cmdkey, faultcode, starttime, endtime);
+
+
+ FREE(dlarg);
+
+ cwmp_log_debug("Download OK.....");
+ }
+ break;
+
+ case TASK_UPLOAD_TAG:
+ {
+ cwmp_log_debug("Upload begin.....");
+
+ upload_arg_t * ularg = (upload_arg_t*)data;
+ //begin download file
+ time_t starttime = time(NULL);
+ int faultcode = 0;
+
+ faultcode = cwmp_agent_upload_file(ularg);
+
+ time_t endtime = time(NULL);
+ cwmp_event_set_value(cwmp, INFORM_TRANSFERCOMPLETE, 1,ularg->cmdkey, faultcode, starttime, endtime);
+
+
+ FREE(ularg);
+
+ cwmp_log_debug("Upload OK.....");
+ }
+ break;
+
+ case TASK_REBOOT_TAG:
+ {
+ //begin reboot system
+ cwmp_log_debug("reboot ...");
+ cwmp_event_set_value(cwmp, INFORM_MREBOOT, 1, NULL, 0, 0, 0);
+ cwmp_event_clear_active(cwmp);
+
+ // inorder to save file ok
+
+ sleep(20);
+
+ rc = restart_request(MODULE_ID_TR069);
+
+ if(0 != rc)
+ {
+ cwmp_log_info("restart request fail! rc:%d", rc);
+ }
+ }
+ break;
+
+ case TASK_FACTORYRESET_TAG:
+ {
+ //begin factory reset system
+ cwmp_log_debug("factory reset begin...");
+
+ cwmp_event_clear_active(cwmp);
+
+ rc = reset_request(MODULE_ID_TR069);
+
+ if(0 != rc)
+ {
+ cwmp_log_info("reset request fail! rc:%d", rc);
+ }
+
+
+ cwmp_log_debug("factory reset OK.....");
+ }
+ break;
+
+ default:
+
+ break;
+
+ }
+ }
+
+ return ok;
+}
+
+
+
+
+
+
diff --git a/ap/app/cwmp/netcwmp/cwmpd/src/conf.c b/ap/app/cwmp/netcwmp/cwmpd/src/conf.c
new file mode 100755
index 0000000..374c9ab
--- /dev/null
+++ b/ap/app/cwmp/netcwmp/cwmpd/src/conf.c
@@ -0,0 +1,77 @@
+/************************************************************************
+ * *
+ * Netcwmp/Opencwmp Project *
+ * A software client for enabling TR-069 in embedded devices (CPE). *
+ * *
+ * Copyright (C) 2013-2014 netcwmp.netcwmp group *
+ * *
+ * This program is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU General Public License *
+ * as published by the Free Software Foundation; either version 2 *
+ * of the License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the *
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330, *
+ * Boston, MA 02111-1307 USA *
+ * *
+ * Copyright 2013-2014 Mr.x(Mr.x) <netcwmp@gmail.com> *
+ * *
+ ***********************************************************************/
+
+#include "cwmp_module.h"
+#include <cwmp/cfg.h>
+
+
+
+void cwmp_conf_init(cwmp_t * cwmp)
+{
+ pool_t * pool;
+ FUNCTION_TRACE();
+
+ pool = cwmp->pool;
+ cwmp->httpd_port = cwmp_conf_get_int("cwmpd:httpd_port"); //cwmp_nvram_get_int("cwmp:httpd_port");
+
+ cwmp->acs_auth = cwmp_conf_get_int("cwmp:acs_auth");
+ cwmp->cpe_auth = cwmp_conf_get_int("cwmp:cpe_auth");
+
+ if(cwmp->acs_auth)
+ {
+ cwmp->acs_user = cwmp_conf_pool_get(pool, "cwmp:acs_username");
+ cwmp->acs_pwd = cwmp_conf_pool_get(pool, "cwmp:acs_password");
+ }
+
+ if(cwmp->cpe_auth)
+ {
+ cwmp->cpe_user = cwmp_conf_pool_get(pool, "cwmp:cpe_username");
+ cwmp->cpe_pwd = cwmp_conf_pool_get(pool, "cwmp:cpe_password");
+
+ }
+
+ cwmp->acs_url = cwmp_conf_pool_get(pool, "cwmp:acs_url"); // "http://192.168.0.69:8000/otnms/acs/webservice.action";//cwmp_nvram_getdup(pool, "cwmp:acs_url");
+
+ cwmp->cpe_mf = cwmp_conf_pool_get(pool, "cwmp:cpe_manufacture"); // "ZTE"; //cwmp_nvram_getdup(pool, "cwmp:cpe_manufacture");
+
+ cwmp->cpe_oui = cwmp_conf_pool_get(pool, "cwmp:cpe_oui"); // "00D0D0";cwmp_nvram_getdup(pool, "cwmp:cpe_oui");
+
+ cwmp->cpe_sn = cwmp_conf_pool_get(pool, "cwmp:cpe_sn"); // "0410400AA11AA2255"; //cwmp_nvram_getdup(pool, "cwmp:cpe_sn");
+
+ cwmp->cpe_name = cwmp_conf_pool_get(pool, "cwmp:cpe_name"); // "00D0D0"; //cwmp_nvram_getdup(pool, "cwmp:cpe_name");
+
+ cwmp->cpe_pc = cwmp_conf_pool_get(pool, "cwmp:cpe_pc"); // "ZXECS EBG2100";
+
+ cwmp_log_debug("url:%s\nmf:%s\noui:%s\nsn:%s\nname:%s\npc:%s\nhttpd port:%d\n", cwmp->acs_url, cwmp->cpe_mf, cwmp->cpe_oui, cwmp->cpe_sn, cwmp->cpe_name, cwmp->cpe_pc,
+ cwmp->httpd_port);
+
+
+ cwmp->event_filename = cwmp_conf_pool_get(pool, "cwmp:event_filename");
+
+
+
+}
+
diff --git a/ap/app/cwmp/netcwmp/cwmpd/src/core b/ap/app/cwmp/netcwmp/cwmpd/src/core
new file mode 100755
index 0000000..7904cce
--- /dev/null
+++ b/ap/app/cwmp/netcwmp/cwmpd/src/core
Binary files differ
diff --git a/ap/app/cwmp/netcwmp/cwmpd/src/cwmpd.c b/ap/app/cwmp/netcwmp/cwmpd/src/cwmpd.c
new file mode 100755
index 0000000..be0a7c2
--- /dev/null
+++ b/ap/app/cwmp/netcwmp/cwmpd/src/cwmpd.c
@@ -0,0 +1,240 @@
+/************************************************************************
+ * *
+ * Netcwmp/Opencwmp Project *
+ * A software client for enabling TR-069 in embedded devices (CPE). *
+ * *
+ * Copyright (C) 2013-2014 netcwmp.netcwmp group *
+ * *
+ * This program is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU General Public License *
+ * as published by the Free Software Foundation; either version 2 *
+ * of the License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the *
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330, *
+ * Boston, MA 02111-1307 USA *
+ * *
+ * Copyright 2013-2014 Mr.x(Mr.x) <netcwmp@gmail.com> *
+ * *
+ ***********************************************************************/
+
+#include "cwmpd.h"
+
+#include <sys/ipc.h>
+
+#include <errno.h>
+
+
+
+
+
+#define CWMP_VALUE_UNSET -1
+
+
+
+int cwmp_argc;
+char **cwmp_argv;
+
+
+static pool_t * cwmp_global_pool;
+
+
+
+void cwmp_daemon()
+{
+ //daemon(0, 1);
+}
+
+
+
+
+void cwmp_getopt(int argc, char **argv)
+{
+
+}
+
+
+static int cwmp_save_argv( int argc, char *const *argv)
+{
+ cwmp_argv = (char **) argv;
+ cwmp_argc = argc;
+
+ return 0;
+}
+
+
+int cwmp_set_var(cwmp_t * cwmp)
+{
+ FUNCTION_TRACE();
+
+
+ cwmp_bzero(cwmp, sizeof(cwmp_t));
+ cwmp->new_request = CWMP_TRUE;
+ pool_t * pool = pool_create(POOL_DEFAULT_SIZE);
+ if(NULL == pool)
+ {
+ cwmp_log_error("pool create return null, size:POOL_DEFAULT_SIZE");
+ return CWMP_ERROR;
+ }
+
+ cwmp->pool = pool;
+
+
+#if 0
+ cwmp_event_init(cwmp);
+
+ cwmp->queue = queue_create(pool);
+#endif
+
+ return CWMP_OK;
+}
+
+
+
+
+#ifdef USE_CWMP_OPENSSL
+void cwmp_init_ssl(cwmp_t * cwmp)
+{
+ char * cafile = cwmp_conf_pool_get(cwmp_global_pool, "cwmp:ca_file");
+ char * capasswd = cwmp_conf_pool_get(cwmp_global_pool, "cwmp:ca_password");
+ cwmp->ssl_ctx = openssl_initialize_ctx(cafile, capasswd);
+}
+#endif
+
+
+static int copy_file(const char* src, const char* des)
+{
+ int rc = CWMP_OK;
+ FILE *psrc = NULL;
+ FILE *pdes = NULL;
+ psrc = fopen(src, "r");
+ pdes = fopen(des, "w+");
+
+
+ if (psrc && pdes)
+ {
+ int nLen = 0;
+ char szBuf[1024] = {0};
+ while((nLen = fread(szBuf, 1, sizeof szBuf, psrc)) > 0)
+ {
+ fwrite(szBuf, 1, nLen, pdes);
+ }
+ rc = CWMP_OK;
+ }
+ else
+ {
+ rc = CWMP_ERROR;
+ }
+
+
+ if (psrc)
+ {
+ fclose(psrc);
+ psrc = NULL;
+ }
+
+
+ if (pdes)
+ {
+ fclose(pdes);
+ pdes = NULL;
+ }
+
+
+ return rc;
+}
+
+
+cwmp_t *g_cwmp = NULL;
+
+
+#define RO_CWMP_CONF_PATH "/etc_ro/cwmp.conf"
+#define RW_CWMP_CONF_PATH "/cache/cwmp.conf"
+
+int main(int argc, char **argv)
+{
+ cwmp_pid_t pid;
+ cwmp_t * cwmp;
+
+ int syslog_enable = 0;
+ int cwmp_enable = 0;
+
+#ifdef WIN32
+ WSADATA wsaData;
+ WSAStartup(MAKEWORD(2, 2), &wsaData);
+#endif
+ pid = getpid();
+
+// cwmp_log_init("/var/log/cwmpd.log", CWMP_LOG_DEBUG);
+ cwmp_log_init("/cache/cwmpd.log", CWMP_LOG_DEBUG_SQL);
+ cwmp_global_pool = pool_create(POOL_DEFAULT_SIZE);
+ if(NULL == cwmp_global_pool)
+ {
+ cwmp_log_error("cwmp_global_pool pool create fail");
+ return -1;
+ }
+
+
+ cwmp = pool_palloc(cwmp_global_pool, sizeof(cwmp_t));
+ if(NULL == cwmp)
+ {
+ cwmp_log_error("cwmp pool palloc fail");
+ return -1;
+ }
+
+
+ if(access(RW_CWMP_CONF_PATH, F_OK) != 0)
+ {
+ copy_file(RO_CWMP_CONF_PATH, RW_CWMP_CONF_PATH);
+ cwmp_log_info("%s not exist, copy %s to it", RW_CWMP_CONF_PATH, RO_CWMP_CONF_PATH);
+ }
+
+
+ cwmp_conf_open(RW_CWMP_CONF_PATH);
+
+ cwmp_enable=cwmp_conf_get_int("cwmp:enable");
+ if(!cwmp_enable)
+ {
+ cwmp_log_error("cwmp_enable:%d", cwmp_enable);
+ return -1;
+ }
+
+ cwmp_getopt(argc, argv);
+
+ //cwmp_init_db();
+
+ cwmp_set_var(cwmp);
+ cwmp_daemon();
+
+ cwmp_conf_init(cwmp);
+
+
+ cwmp_event_init(cwmp);
+ cwmp->queue = queue_create(cwmp->pool);
+
+ g_cwmp = cwmp;
+
+ ini_periodic_info(cwmp);
+
+
+ init_pdp_type(cwmp);
+
+
+#ifdef USE_CWMP_OPENSSL
+ cwmp_init_ssl(cwmp);
+#endif
+
+ cwmp_model_load(cwmp, "/etc_ro/device.xml");
+ cwmp_process_start_master(cwmp);
+
+ return 0;
+}
+
+
+
diff --git a/ap/app/cwmp/netcwmp/cwmpd/src/device.xml b/ap/app/cwmp/netcwmp/cwmpd/src/device.xml
new file mode 100755
index 0000000..8899edd
--- /dev/null
+++ b/ap/app/cwmp/netcwmp/cwmpd/src/device.xml
@@ -0,0 +1,140 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<cwmp>
+
+ <model>
+ <object name="InternetGatewayDevice">
+ <param name="DeviceSummary" get_func="TRF_Get_DeviceSummary"></param>
+ <param name="LANDeviceNumberOfEntries" get_func="TRF_Get_LANDeviceNumberOfEntries"></param>
+ <param name="WANDeviceNumberOfEntries" get_func="TRF_Get_WANDeviceNumberOfEntries"></param>
+ <object name="DeviceInfo">
+ <param name="SpecVersion" get_func="cpe_get_igd_di_specversion"></param>
+ <param name="HardwareVersion" get_func="cpe_get_igd_di_hardwareversion"></param>
+ <param name="SoftwareVersion" rw="1" get_func="cpe_get_igd_di_softwareversion" set_func="cpe_set_igd_di_softwareversion"></param>
+ <param name="ProvisioningCode" rw="1" get_func="cpe_get_igd_di_provisioningcode" set_func="cpe_set_igd_di_provisioningcode"></param>
+ <param name="Manufacturer" get_func="cpe_get_igd_di_manufacturer"></param>
+ <param name="ManufacturerOUI" get_func="cpe_get_igd_di_manufactureroui"></param>
+ <param name="ProductClass" get_func="cpe_get_igd_di_productclass"></param>
+ <param name="SerialNumber" get_func="cpe_get_igd_di_serialnumber"></param>
+ </object>
+ <object name="ManagementServer">
+ <param name="ConnectionRequestURL" get_func="cpe_get_igd_ms_connectionrequesturl"></param>
+ <param name="ConnectionRequestUsername" rw="1" noti_rw="1" get_func="cpe_get_igd_ms_connectionrequestusername" set_func="cpe_set_igd_ms_connectionrequestusername"></param>
+ <param name="ConnectionRequestPassword" rw="1" noti_rw="1" get_func="cpe_get_igd_ms_connectionrequestpassword" set_func="cpe_set_igd_ms_connectionrequestpassword"></param>
+ <param name="Username" rw="1" noti_rw="1" get_func="cpe_get_igd_ms_username" set_func="cpe_set_igd_ms_username"></param>
+ <param name="Password" rw="1" noti_rw="1" get_func="cpe_get_igd_ms_password" set_func="cpe_set_igd_ms_password"></param>
+ <param name="URL" noti_rw="1" rw="1" get_func="cpe_get_igd_ms_url" set_func="cpe_get_igd_ms_url"></param>
+ <param name="PeriodicInformEnable" rw="1" noti_rw="1" type="s" get_func="" set_func=""></param>
+ <param name="PeriodicInformInterval" rw="1" noti_rw="1" get_func="" set_func=""></param>
+ <param name="PeriodicInformTime" rw="1" type="s" get_func="" set_func=""></param>
+ <param name="ParameterKey" get_func="" set_func=""/>
+ <param name="UDPConnectionRequestAddress" get_func="" set_func=""></param>
+ <param name="UDPConnectionRequestAddressNotificationLimit" get_func=""></param>
+ <param name="STUNEnable" rw="1" type="s" get_func="" set_func=""></param>
+ <param name="STUNServerAddress" rw="1" get_func="" set_func=""></param>
+ <param name="STUNServerPort" rw="1" get_func="" set_func=""></param>
+ <param name="STUNUsername" rw="1" get_func="" set_func=""></param>
+ <param name="STUNPassword" rw="1" get_func="" set_func=""></param>
+ <param name="STUNMaximumKeepAlivePeriod" rw="1" type="s" get_func="" set_func=""></param>
+ <param name="STUNMinimumKeepAlivePeriod" rw="1" type="s" get_func="" set_func=""></param>
+ <param name="NATDetected" type="s" get_func="" set_func=""></param>
+ </object>
+ <object name="WANDevice" rw="1" refresh_func="cpe_refresh_igd_wandevice">
+ <object name="{i}">
+ <param name="WANConnectionNumberOfEntries" get_func=""></param>
+ <object name="WANConnectionDevice" refresh_func="cpe_refresh_igd_wandevice_wanconnection">
+ <object name="{i}">
+ <param name="WANIPConnectionNumberOfEntries" get_func=""></param>
+ <param name="WANPPPConnectionNumberOfEntries" get_func=""></param>
+ <object name="WANIPConnection" refresh_func="cpe_refresh_igd_wandevice_wanconnection_wanipconnection">
+ <object name="{i}">
+ <param name="Enable" rw="1" type="s" get_func="" set_func=""></param>
+ <param name="AddressingType" noti_rw="1" rw="1" get_func="" set_func=""></param>
+ <param name="ExternalIPAddress" noti_rw="1" rw="1" get_func="" set_func=""></param>
+ <param name="SubnetMask" noti_rw="1" rw="1" get_func="" set_func=""></param>
+ <param name="DefaultGateway" rw="1" get_func="" set_func=""></param>
+ <param name="DNSServers" rw="1" get_func="" set_func=""></param>
+ <param name="MACAddress" rw="1" get_func="" set_func=""></param>
+ <object name="Stats">
+ <param name="EthernetBytesSent" get_func=""></param>
+ <param name="EthernetBytesReceived" get_func=""></param>
+ <param name="EthernetPacketsSent" get_func=""></param>
+ <param name="EthernetPacketsReceived" get_func=""></param>
+ </object>
+ </object>
+ </object>
+ <object name="WANPPPConnection" refresh_func="cpe_refresh_igd_wandevice_wanconnection_wanpppconnection">
+ <object name="{i}">
+ <param name="Enable" rw="1" type="s" get_func="" set_func=""></param>
+ <param name="DefaultGateway" get_func=""></param>
+ <param name="Username" noti_rw="1" rw="1" get_func="" set_func=""></param>
+ <param name="Password" noti_rw="1" rw="1" get_func="" set_func=""></param>
+ <param name="ExternalIPAddress" get_func=""></param>
+ <param name="DNSServers" rw="1" get_func="" set_func=""></param>
+ <param name="MACAddress" rw="1" type="s" get_func="" set_func=""></param>
+ <param name="ConnectionTrigger" rw="1" get_func="" set_func=""></param>
+ <object name="Stats">
+ <param name="EthernetBytesSent" get_func=""></param>
+ <param name="EthernetBytesReceived" get_func=""></param>
+ <param name="EthernetPacketsSent" get_func=""></param>
+ <param name="EthernetPacketsReceived" get_func=""></param>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ <object name="IPPingDiagnostics">
+ <param name="DiagnosticsState" rw="1" get_func="" set_func=""></param>
+ <param name="Interface" rw="1" get_func="" set_func=""></param>
+ <param name="Host" rw="1" get_func="" set_func=""></param>
+ <param name="NumberOfRepetitions" rw="1" get_func="" set_func=""></param>
+ <param name="Timeout" rw="1" get_func="" set_func=""></param>
+ <param name="DataBlockSize" rw="1" get_func="" set_func=""></param>
+ <param name="DSCP" rw="1" get_func="" set_func=""></param>
+ <param name="SuccessCount" get_func=""></param>
+ <param name="FailureCount" get_func=""></param>
+ <param name="AverageResponseTime" get_func=""></param>
+ <param name="MinimumResponseTime" get_func=""></param>
+ <param name="MaximumResponseTime" get_func=""></param>
+ </object>
+ <object name="TraceRouteDiagnostics">
+ <param name="DiagnosticsState" rw="1" get_func="" set_func=""></param>
+ <param name="Interface" rw="1" get_func="" set_func=""></param>
+ <param name="Host" rw="1" get_func="" set_func=""></param>
+ <param name="NumberOfTries" rw="1" get_func="" set_func=""></param>
+ <param name="Timeout" rw="1" get_func="" set_func=""></param>
+ <param name="DataBlockSize" rw="1" get_func="" set_func=""></param>
+ <param name="DSCP" rw="1" get_func="" set_func=""></param>
+ <param name="MaxHopCount" rw="1" get_func="" set_func=""></param>
+ <param name="ResponseTime" get_func=""></param>
+ <param name="RouteHopsNumberOfEntries" get_func=""></param>
+ <object name="RouteHops" refresh_func="cpe_refresh_igd_routehops">
+ <object name="{i}">
+ <param name="HopHost" get_func=""></param>
+ <param name="HopHostAddress" get_func=""></param>
+ <param name="HopErrorCode" get_func=""></param>
+ <param name="HopRTTimes" get_func=""></param>
+ </object>
+ </object>
+ </object>
+
+
+ </object>
+ </model>
+
+
+
+
+ <inform>
+ <paramlist>
+ <param name="" />
+
+ </paramlist>
+ </inform>
+ <rpc>
+
+
+ </rpc>
+
+</cwmp>
diff --git a/ap/app/cwmp/netcwmp/cwmpd/src/httpd.c b/ap/app/cwmp/netcwmp/cwmpd/src/httpd.c
new file mode 100755
index 0000000..573b8fe
--- /dev/null
+++ b/ap/app/cwmp/netcwmp/cwmpd/src/httpd.c
@@ -0,0 +1,463 @@
+/************************************************************************
+ * *
+ * Netcwmp/Opencwmp Project *
+ * A software client for enabling TR-069 in embedded devices (CPE). *
+ * *
+ * Copyright (C) 2013-2014 netcwmp.netcwmp group *
+ * *
+ * This program is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU General Public License *
+ * as published by the Free Software Foundation; either version 2 *
+ * of the License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the *
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330, *
+ * Boston, MA 02111-1307 USA *
+ * *
+ * Copyright 2013-2014 Mr.x(Mr.x) <netcwmp@gmail.com> *
+ * *
+ ***********************************************************************/
+
+#include <cwmp/http.h>
+#include <cwmp/event.h>
+#include "cwmp_httpd.h"
+
+
+#define MAX_CLIENT_NUMS 8
+
+
+static char * AuthRealm = "cwmpd";
+static char * AuthQop = "auth";
+static char AuthOpaque[33] = {0};
+static int AuthNonce = 0;
+
+const char * RESPONSE_200 = "HTTP/1.1 200 OK\r\nConnection: close\r\nContent-Length: 2\r\nContent-Type: text/xml; charset=\"utf-8\"\r\n\r\nOK";
+const char * RESPONSE_400 = "HTTP/1.1 400 Bad request\r\nServer: CWMP-Agent\r\nConnection: close\r\nContent-Length: 5\r\n\r\nError";
+//const char * RESPONSE_401 = "HTTP/1.1 401 Unauthorized\r\nWWW-Authenticate: Digest qop=\"%s\" nonce=\"%s\" opaque=\"%s\" realm=\"%s\"\r\nServer: TR069Agent\r\nContent-Length: 0\r\n\r\n";
+
+const char * RESPONSE_401 = "HTTP/1.1 401 Unauthorized\r\nWWW-Authenticate: Digest realm=\"%s\", nonce=\"%s\", qop=\"%s\", opaque=\"%s\"\r\nServer: TR069Agent\r\nContent-Length: 0\r\n\r\n";
+
+
+struct http_session_fd_t
+{
+ //int fd;
+ time_t time;
+ http_socket_t * sock;
+};
+
+
+struct http_session_fd_t sessionfd[MAX_CLIENT_NUMS];
+
+typedef enum
+{
+ PDP_TYPE_UNINIT = -1,
+ PDP_TYPE_IPV4 = 0,
+ PDP_TYPE_IPV6,
+ PDP_TYPE_IPV4V6,
+ PDP_TYPE_UNDEFINE
+}Pdp_Type;
+
+
+void setnonblocking(int fd)
+{
+#ifdef WIN32
+#else
+ int opts;
+ opts=fcntl(fd, F_GETFL);
+ if (opts < 0)
+ {
+ cwmp_log_error("setnonblocking fcntl GETFL failed: fd(%d)\n", fd);
+ return;
+ }
+ opts = opts | O_NONBLOCK;
+ if (fcntl(fd, F_SETFL, opts) < 0)
+ {
+ cwmp_log_error("setnonblocking fcntl SETFL failed: fd(%d)\n", fd);
+ return;
+ }
+ return;
+#endif
+}
+
+int httpd_response_unauthorization(http_socket_t * sock)
+{
+ char buffer[256];
+ char nonce[33];
+ FUNCTION_TRACE();
+ AuthNonce ++;
+ TRsnprintf(buffer, 256, "%d", AuthNonce);
+ cwmp_MD5(nonce, buffer, NULL);
+
+ nonce[32] = 0;
+
+ //TRsnprintf(buffer, 256, RESPONSE_401, AuthQop, nonce, AuthOpaque, AuthRealm);
+
+ TRsnprintf(buffer, 256, RESPONSE_401, AuthRealm, nonce, AuthQop, AuthOpaque);
+
+ return http_socket_write(sock, buffer, TRstrlen(buffer));
+}
+
+int httpd_response_ok(http_socket_t * sock)
+{
+ FUNCTION_TRACE();
+ return http_socket_write(sock, RESPONSE_200, TRstrlen(RESPONSE_200));
+}
+
+int httpd_response_unkonw_error(http_socket_t * sock)
+{
+ FUNCTION_TRACE();
+ return http_socket_write(sock, RESPONSE_400, TRstrlen(RESPONSE_400));
+}
+
+
+static int g_s_pdp_type = PDP_TYPE_UNINIT;
+
+static int check_ipv6_addr()
+{
+ char ipv6_addr[128] = {0};
+ sc_cfg_get("ipv6_br0_addr", ipv6_addr, sizeof(ipv6_addr));
+
+ if(strcmp(ipv6_addr, "") == 0)
+ {
+ cwmp_log_info("ipv6_addr is NULL");
+ return CWMP_ERROR;
+ }
+
+ return CWMP_OK;
+}
+
+int init_pdp_type(cwmp_t * cwmp)
+{
+ char pdp_type[32] = {0};
+
+ int i = 0;
+ sc_cfg_get("pdp_type", pdp_type, sizeof(pdp_type));
+
+ if(strncmp(pdp_type, "IPv4v6", sizeof(pdp_type)) == 0)
+ {
+ while(1)
+ {
+ if(check_ipv6_addr() == CWMP_OK && http_get_host_by_url(cwmp->acs_url, AF_INET6) == CWMP_OK)
+ {
+ g_s_pdp_type = PDP_TYPE_IPV6;
+ return g_s_pdp_type;
+ }
+
+ if(http_get_host_by_url(cwmp->acs_url, AF_INET) == CWMP_OK)
+ {
+ g_s_pdp_type = PDP_TYPE_IPV4;
+ return g_s_pdp_type;
+ }
+
+ cwmp_log_info("gethostbyname return NULL");
+ sleep(1);
+ }
+ }
+ else if(strncmp(pdp_type, "IPv6", sizeof(pdp_type)) == 0)
+ {
+ while(check_ipv6_addr() != CWMP_OK)
+ {
+ cwmp_log_info("IPV6 addr return NULL");
+ sleep(1);
+ }
+
+ while(1)
+ {
+ if(http_get_host_by_url(cwmp->acs_url, AF_INET6) != CWMP_OK)
+ {
+ cwmp_log_info("gethostbyname return NULL");
+ sleep(1);
+ }
+ else
+ {
+ g_s_pdp_type = PDP_TYPE_IPV6;
+ cwmp_log_info("pdp_type:%s, s_pdp_type:%d", pdp_type, g_s_pdp_type);
+ return g_s_pdp_type;
+ }
+ }
+
+// g_s_pdp_type = PDP_TYPE_UNDEFINE;
+
+ }
+ else if(strncmp(pdp_type, "IP", sizeof(pdp_type)) == 0)
+ {
+ g_s_pdp_type = PDP_TYPE_IPV4;
+ while(http_get_host_by_url(cwmp->acs_url, AF_INET) != CWMP_OK)
+ {
+ cwmp_log_info("gethostbyname return NULL");
+ sleep(1);
+ }
+ }
+ else
+ {
+ g_s_pdp_type = PDP_TYPE_UNDEFINE;
+ }
+
+ cwmp_log_info("pdp_type:%s, s_pdp_type:%d", pdp_type, g_s_pdp_type);
+ return g_s_pdp_type;
+
+}
+
+static int get_pdp_type()
+{
+ return g_s_pdp_type;
+}
+
+int get_family_type()
+{
+ int family = -1;
+
+ while(get_pdp_type() == PDP_TYPE_UNINIT){
+ cwmp_log_info("pdp type is not init, waiting");
+ sleep(1);
+ }
+
+ if(get_pdp_type() == PDP_TYPE_IPV6)
+ {
+ family = AF_INET6;
+ }
+ else if(get_pdp_type() == PDP_TYPE_IPV4)
+ {
+ family = AF_INET;
+ }
+ else
+ {
+ cwmp_log_error("unknown pdp type:%d", g_s_pdp_type);
+ }
+
+ return family;
+}
+
+
+
+int httpd_build_server(cwmp_t * cwmp)
+{
+ http_socket_t * lsnsock;
+ pool_t * pool;
+ int rc;
+ int lsnfd, maxfd, nready;
+ int i;
+
+ int fd, newfd;
+ http_socket_t * s;
+ http_request_t * request;
+
+ char * auth;
+ time_t now;
+ fd_set readset, rdset;
+ struct timeval timeout;
+ int port;
+
+ char cpe_user[INI_BUFFERSIZE] = {0};
+ char cpe_pwd[INI_BUFFERSIZE] = {0};
+
+ FUNCTION_TRACE();
+
+
+ port = cwmp->httpd_port;
+
+ pool = pool_create(POOL_DEFAULT_SIZE);
+ if(!pool)
+ {
+ cwmp_log_error("pool create return null");
+ return CWMP_ERROR;
+ }
+
+ rc = http_socket_server(&lsnsock, port, 5, -1, pool);
+ if (rc != CWMP_OK)
+ {
+ cwmp_log_error("build httpd server faild. %s\n", strerror(errno));
+ exit(-1);
+ }
+
+ lsnfd = http_socket_get_fd(lsnsock);
+
+ for (i=0; i < MAX_CLIENT_NUMS; i++)
+ {
+ sessionfd[i].time = 0;
+ sessionfd[i].sock = NULL;
+ }
+
+ FD_ZERO(&readset);
+ FD_SET(lsnfd, &readset);
+
+ maxfd = lsnfd;
+ /*maxi = -1;*/
+ while (1)
+ {
+ FD_ZERO(&rdset);
+ rdset = readset;
+ timeout.tv_sec = 10;
+ timeout.tv_usec = 0;
+ if ((nready = select(maxfd + 1, &rdset, NULL, NULL, &timeout)) <= 0)
+ {
+ sleep(1);
+ cwmp_log_info("select new connection timeout. no new request.\n");
+ now = time(NULL);
+ for (i=0; i<MAX_CLIENT_NUMS; i++)
+ {
+ //cwmp_log_debug("socket time: %d, timeout %d, fd is %d\n", sessionfd[i].time, now - sessionfd[i].time,
+ // sessionfd[i].sock == NULL? -1 : http_socket_get_fd(sessionfd[i].sock));
+ fd = http_socket_get_fd(sessionfd[i].sock);
+ if ((sessionfd[i].sock != NULL) && (now - sessionfd[i].time > 15))
+ {
+ cwmp_log_info("close a timeout socket. fd is %d.\n", fd);
+ FD_CLR(fd, &readset);
+ //http_socket_close(sessionfd[i].sock);
+ http_socket_destroy(sessionfd[i].sock);
+ sessionfd[i].time = 0;
+ sessionfd[i].sock = NULL;
+ }
+ }
+ continue;
+ }
+
+ cwmp_log_info("select info.....\n");
+
+ if (FD_ISSET(lsnfd, &rdset))
+ {
+ http_socket_t * newsock;
+ //FIXME
+ rc = http_socket_accept(lsnsock, &newsock);
+ if(CWMP_OK != rc)
+ {
+ cwmp_log_error("http_socket_accept return error");
+ continue;
+ }
+
+ newfd = http_socket_get_fd(newsock);
+
+ for (i=0; i<MAX_CLIENT_NUMS; i++)
+ {
+ if (sessionfd[i].sock == NULL)
+ {
+ sessionfd[i].sock = newsock;
+ sessionfd[i].time = time(NULL);
+ break;
+ }
+ }
+ if (i == MAX_CLIENT_NUMS)
+ {
+ //http_socket_close(newsock);
+ http_socket_destroy(newsock);
+
+ cwmp_log_error("too many ACS request connection");
+ continue;
+ }
+ FD_SET(newfd, &readset);
+ if (newfd > maxfd)
+ {
+ maxfd = newfd;
+ }
+
+// newfd = -1;
+ if (--nready <= 0)
+ {
+ continue;
+ }
+
+ }
+
+ //readpool = pool_create(POOL_DEFAULT_SIZE);
+ cwmp_log_debug("nready is %d.\n", nready);
+ for (i=0; (i<MAX_CLIENT_NUMS) && (nready > 0) ; i++)
+ {
+ s = sessionfd[i].sock;
+ fd = http_socket_get_fd(s);
+
+ if ((fd != -1) && FD_ISSET(fd, &rdset))
+ {
+ nready--;
+ sessionfd[i].time = time(NULL);
+ pool_t * socket_pool = http_socket_get_pool(s);
+ if (NULL == socket_pool)
+ {
+ cwmp_log_error("http_socket_get_pool return null");
+ httpd_response_unkonw_error(s);
+ goto faild;
+ }
+
+
+ rc = http_request_create(&request, socket_pool);
+ if (CWMP_OK != rc)
+ {
+ cwmp_log_error("http_request_create rc:%d", rc);
+ httpd_response_unkonw_error(s);
+ goto faild;
+ }
+
+
+ socket_pool = http_socket_get_pool(s);
+ if (NULL == socket_pool)
+ {
+ cwmp_log_error("http_socket_get_pool return null");
+ httpd_response_unkonw_error(s);
+ goto faild;
+ }
+
+ rc = http_read_request(s, request, socket_pool);
+ if (rc <= 0)
+ {
+ cwmp_log_error("http_read_request rc:%d", rc);
+ httpd_response_unkonw_error(s);
+ goto faild;
+ }
+
+ if (request->method != HTTP_GET)
+ {
+ cwmp_log_error("request->method:%d (!= HTTP_GET)", request->method);
+ httpd_response_unkonw_error(s);
+ goto faild;
+ }
+
+ cwmp_log_info("cwmp->cpe_auth:%d", cwmp->cpe_auth);
+
+ if (cwmp->cpe_auth)
+ {
+ auth = http_get_variable(request->parser, "Authorization");
+
+ if (!auth)
+ {
+ httpd_response_unauthorization(s);
+ cwmp_log_debug("auth fail. auth=%s\n", auth);
+ goto faild;
+ }
+
+ // may be changed, so get new instead of get cwmp->cpe_user, cwmp->cpe_pwd
+ cwmp_conf_get("cwmp:cpe_username", cpe_user);
+ cwmp_conf_get("cwmp:cpe_password", cpe_pwd);
+
+ cwmp_log_debug("cpe username: %s, cpe password: %s\n", cpe_user, cpe_pwd);
+
+ if (http_check_digest_auth(AuthRealm, auth, cpe_user, cpe_pwd) != 0)
+ {
+ httpd_response_unauthorization(s);
+ goto faild;
+ }
+ }
+
+ httpd_response_ok(s);
+
+ //get a new request from acs
+ cwmp->new_request = CWMP_YES;
+ cwmp_log_debug("set cwmp new request to %d\n", cwmp->new_request);
+ cwmp_event_set_value(cwmp, INFORM_CONNECTIONREQUEST, 1, NULL, 0, 0, 0);
+
+faild:
+ FD_CLR(fd, &readset);
+ sessionfd[i].time = 0;
+ sessionfd[i].sock = NULL;
+ http_socket_destroy(s);
+
+ }
+ }
+ }
+}
+
+
diff --git a/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/DeviceInfo/DeviceInfo.c b/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/DeviceInfo/DeviceInfo.c
new file mode 100755
index 0000000..4d130fb
--- /dev/null
+++ b/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/DeviceInfo/DeviceInfo.c
@@ -0,0 +1,155 @@
+#include "cfg_api.h"
+
+
+
+//InternetGatewayDevice.DeviceInfo.Manufacturer
+int cpe_get_igd_di_manufacturer(cwmp_t * cwmp, const char * name, char ** value, pool_t * pool)
+{
+ FUNCTION_TRACE();
+ *value = cwmp_conf_pool_get(pool, "cwmp:cpe_manufacture");
+ cwmp_log_debug("cpe_get_igd_di_manufacturer: value is %s", *value);
+ return FAULT_CODE_OK;
+}
+
+//InternetGatewayDevice.DeviceInfo.ManufacturerOUI
+int cpe_get_igd_di_manufactureroui(cwmp_t * cwmp, const char * name, char ** value, pool_t * pool)
+{
+ FUNCTION_TRACE();
+ *value = cwmp_conf_pool_get(pool, "cwmp:cpe_oui");
+ return FAULT_CODE_OK;
+}
+
+//InternetGatewayDevice.DeviceInfo.ProductClass
+int cpe_get_igd_di_productclass(cwmp_t * cwmp, const char * name, char ** value, pool_t * pool)
+{
+ FUNCTION_TRACE();
+ *value = cwmp_conf_pool_get(pool, "cwmp:cpe_pc");
+ return FAULT_CODE_OK;
+}
+
+//InternetGatewayDevice.DeviceInfo.SerialNumber
+int cpe_get_igd_di_serialnumber(cwmp_t * cwmp, const char * name, char ** value, pool_t * pool)
+{
+ FUNCTION_TRACE();
+ *value = cwmp_conf_pool_get(pool, "cwmp:cpe_sn");
+ return FAULT_CODE_OK;
+}
+
+//InternetGatewayDevice.DeviceInfo.SpecVersion
+int cpe_get_igd_di_specversion(cwmp_t * cwmp, const char * name, char ** value, pool_t * pool)
+{
+ FUNCTION_TRACE();
+ *value = cwmp_conf_pool_get(pool, "cwmp:cpe_specver");
+ return FAULT_CODE_OK;
+}
+
+//InternetGatewayDevice.DeviceInfo.HardwareVersion
+int cpe_get_igd_di_hardwareversion(cwmp_t * cwmp, const char * name, char ** value, pool_t * pool)
+{
+ FUNCTION_TRACE();
+ char hw[256+1] = {0};
+
+ sc_cfg_get("hardware_version", hw, 256);
+
+ *value = pool_pstrdup(pool, hw);
+ return FAULT_CODE_OK;
+}
+
+//InternetGatewayDevice.DeviceInfo.SoftwareVersion
+int cpe_get_igd_di_softwareversion(cwmp_t * cwmp, const char * name, char ** value, pool_t * pool)
+{
+ FUNCTION_TRACE();
+ char sw[256+1] = {0};
+
+ sc_cfg_get("wa_version", sw, 256);
+
+ *value = pool_pstrdup(pool, sw);
+
+ return FAULT_CODE_OK;
+}
+
+//InternetGatewayDevice.DeviceInfo.ProvisioningCode
+int cpe_get_igd_di_provisioningcode(cwmp_t * cwmp, const char * name, char ** value, pool_t * pool)
+{
+ FUNCTION_TRACE();
+ *value = cwmp_conf_pool_get(pool, "cwmp:cpe_pc");
+ return FAULT_CODE_OK;
+}
+
+
+int cpe_set_igd_di_softwareversion(cwmp_t * cwmp, const char * name, const char * value, int length, callback_register_func_t callback_reg)
+{
+ cwmp_log_info("set softwareversion:%s", value);
+ cwmp_conf_set("cwmp:SoftwareVersion", value);
+ return FAULT_CODE_OK;
+}
+
+
+
+int cpe_set_igd_di_hardwareversion(cwmp_t * cwmp, const char * name, const char * value, int length, callback_register_func_t callback_reg)
+{
+ cwmp_log_info("set hardwareversion:%s", value);
+ cwmp_conf_set("cwmp:HardwareVersion", value);
+ return FAULT_CODE_OK;
+}
+
+
+
+//InternetGatewayDevice.DeviceInfo.VendorConfigFile.Name
+int cpe_get_igd_di_vc_name(cwmp_t * cwmp, const char * name, char ** value, pool_t * pool)
+{
+ FUNCTION_TRACE();
+ *value = pool_pstrdup(pool, "cwmp.conf");
+ return FAULT_CODE_OK;
+}
+
+//InternetGatewayDevice.DeviceInfo.VendorConfigFile.Version
+int cpe_get_igd_di_vc_version(cwmp_t * cwmp, const char * name, char ** value, pool_t * pool)
+{
+ FUNCTION_TRACE();
+ *value = pool_pstrdup(pool, "V0.0.1");
+ return FAULT_CODE_OK;
+}
+
+//InternetGatewayDevice.DeviceInfo.VendorConfigFile.Date
+int cpe_get_igd_di_vc_date(cwmp_t * cwmp, const char * name, char ** value, pool_t * pool)
+{
+ FUNCTION_TRACE();
+
+ struct stat info;
+ char buff[64] = {0};
+ struct tm * timeinfo;
+ const char* unknown_date = "00 00 00:00";
+
+ if(stat("/cache/cwmp.conf", &info)<0)
+ {
+ *value = pool_pstrdup(pool, (void *)unknown_date);
+ }
+ else
+ {
+ timeinfo = localtime (&(info.st_mtime));
+ if(NULL == timeinfo)
+ {
+ *value = pool_pstrdup(pool, (void *)unknown_date);
+ }
+ else
+ {
+ strftime(buff, sizeof(buff), "%b %d %H:%M", timeinfo);
+ *value = pool_pstrdup(pool, buff);
+ }
+ }
+
+ return FAULT_CODE_OK;
+}
+
+//InternetGatewayDevice.DeviceInfo.VendorConfigFile.Description
+int cpe_get_igd_di_vc_description(cwmp_t * cwmp, const char * name, char ** value, pool_t * pool)
+{
+ FUNCTION_TRACE();
+ *value = pool_pstrdup(pool, "config file path: /cache/cwmp.conf");
+ return FAULT_CODE_OK;
+}
+
+
+
+
diff --git a/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/InternetGatewayDevice.c b/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/InternetGatewayDevice.c
new file mode 100755
index 0000000..223f8ca
--- /dev/null
+++ b/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/InternetGatewayDevice.c
@@ -0,0 +1,33 @@
+#include "DeviceInfo/DeviceInfo.c"
+#include "LANDevice/LANDevice.c"
+#include "LANDevice/LANEthernetInterfaceConfig/LANEthernetInterfaceConfig.c"
+#include "LANDevice/LANHostConfigManagement/DHCPStaticAddress/DHCPStaticAddress.c"
+#include "LANDevice/LANHostConfigManagement/IPInterface/IPInterface.c"
+#include "LANDevice/LANHostConfigManagement/LANHostConfigManagement.c"
+#include "LANDevice/WLANConfiguration/WLANConfiguration.c"
+#include "ManagementServer/ManagementServer.c"
+#include "Time/Time.c"
+#include "WANDevice/WANDevice.c"
+#include "WANDevice/COM_WANInterfaceConfig/COM_WANInterfaceConfig.c"
+#include "WANDevice/WANEthernetInterfaceConfig/WANEthernetInterfaceConfig.c"
+#include "WANDevice/WANConnectionDevice/WANConnectionDevice.c"
+#include "WANDevice/WANConnectionDevice/WANIPConnection.c"
+
+
+
+char* cpe_get_igd_device_summary(void * arg, void * pool)
+{
+ //pool_t * p = (pool_t *)pool;
+ return NULL;
+}
+
+char* cpe_get_igd_lan_device_number_of_entries(void * arg, void * pool)
+{
+ //pool_t * p = (pool_t *)pool;
+ return NULL;
+}
+
+
+
+
+
diff --git a/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/LANDevice/LANDevice.c b/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/LANDevice/LANDevice.c
new file mode 100755
index 0000000..2be94f8
--- /dev/null
+++ b/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/LANDevice/LANDevice.c
@@ -0,0 +1,42 @@
+
+int cpe_refresh_igd_landevice(cwmp_t * cwmp, parameter_node_t * param_node, callback_register_func_t callback_reg)
+{
+ FUNCTION_TRACE();
+
+ if(!param_node)
+ {
+ return FAULT_CODE_9002;
+ }
+ parameter_node_t * tmp_param, *tmp_node, *child_param;
+ child_param = param_node->child;
+ if(child_param)
+ {
+ for(tmp_param=child_param->next_sibling; tmp_param; )
+ {
+ cwmp_log_info("refresh LANDevice node, delete param %s\n", tmp_param->name);
+ tmp_node = tmp_param->next_sibling;
+ cwmp_model_delete_parameter(tmp_param);
+ tmp_param = tmp_node;
+ }
+ child_param->next_sibling = NULL;
+
+ parameter_node_t * lan1_param;
+ cwmp_model_copy_parameter(param_node, &lan1_param, 1);
+
+// parameter_node_t * lan2_param;
+// cwmp_model_copy_parameter(param_node, &lan2_param, 2);
+
+ cwmp_model_refresh_object(cwmp, param_node, 0, callback_reg);
+ }
+
+ return FAULT_CODE_OK;
+}
+
+
+
+
+
+
+
+
+
diff --git a/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/LANDevice/LANEthernetInterfaceConfig/LANEthernetInterfaceConfig.c b/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/LANDevice/LANEthernetInterfaceConfig/LANEthernetInterfaceConfig.c
new file mode 100755
index 0000000..ff52046
--- /dev/null
+++ b/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/LANDevice/LANEthernetInterfaceConfig/LANEthernetInterfaceConfig.c
@@ -0,0 +1,45 @@
+
+
+
+int cpe_refresh_igd_ld_lhcm_dhcpstaticaddress(cwmp_t * cwmp, parameter_node_t * param_node, callback_register_func_t callback_reg)
+{
+ FUNCTION_TRACE();
+
+ if(!param_node)
+ {
+ return FAULT_CODE_9002;
+ }
+ parameter_node_t * tmp_param, *tmp_node, *child_param;
+ child_param = param_node->child;
+ if(child_param)
+ {
+ for(tmp_param=child_param->next_sibling; tmp_param; )
+ {
+ cwmp_log_info("refresh LANDevice.{i}.LANHostConfigManagement.IPInterface node, delete param %s\n", tmp_param->name);
+ tmp_node = tmp_param->next_sibling;
+ cwmp_model_delete_parameter(tmp_param);
+ tmp_param = tmp_node;
+ }
+ child_param->next_sibling = NULL;
+
+ cwmp_log_info("ready to get lan index");
+ int lan_index = get_index_after_paramname(param_node, "LANDevice");
+
+ cwmp_log_info("lan index is:%d", lan_index);
+
+ parameter_node_t * lan1conn_param;
+ cwmp_model_copy_parameter(param_node, &lan1conn_param, 1);
+
+ if(lan_index == 2)
+ {
+ parameter_node_t * lan2conn_param;
+ cwmp_model_copy_parameter(param_node, &lan2conn_param, 2);
+ }
+
+ cwmp_model_refresh_object(cwmp, param_node, 0, callback_reg);
+ }
+
+ return FAULT_CODE_OK;
+}
+
+
diff --git a/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/LANDevice/LANHostConfigManagement/DHCPStaticAddress/DHCPStaticAddress.c b/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/LANDevice/LANHostConfigManagement/DHCPStaticAddress/DHCPStaticAddress.c
new file mode 100755
index 0000000..321fd14
--- /dev/null
+++ b/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/LANDevice/LANHostConfigManagement/DHCPStaticAddress/DHCPStaticAddress.c
@@ -0,0 +1,44 @@
+
+
+
+int cpe_refresh_igd_ld_lanethernetinterfaceconfig(cwmp_t * cwmp, parameter_node_t * param_node, callback_register_func_t callback_reg)
+{
+ FUNCTION_TRACE();
+
+ if(!param_node)
+ {
+ return FAULT_CODE_9002;
+ }
+ parameter_node_t * tmp_param, *tmp_node, *child_param;
+ child_param = param_node->child;
+ if(child_param)
+ {
+ for(tmp_param=child_param->next_sibling; tmp_param; )
+ {
+ cwmp_log_info("refresh LANDevice.{i}.LANHostConfigManagement.IPInterface node, delete param %s\n", tmp_param->name);
+ tmp_node = tmp_param->next_sibling;
+ cwmp_model_delete_parameter(tmp_param);
+ tmp_param = tmp_node;
+ }
+ child_param->next_sibling = NULL;
+
+ cwmp_log_info("ready to get lan index");
+ int lan_index = get_index_after_paramname(param_node, "LANDevice");
+
+ cwmp_log_info("lan index is:%d", lan_index);
+
+ parameter_node_t * lan1conn_param;
+ cwmp_model_copy_parameter(param_node, &lan1conn_param, 1);
+
+ if(lan_index == 2)
+ {
+ parameter_node_t * lan2conn_param;
+ cwmp_model_copy_parameter(param_node, &lan2conn_param, 2);
+ }
+
+ cwmp_model_refresh_object(cwmp, param_node, 0, callback_reg);
+ }
+
+ return FAULT_CODE_OK;
+}
+
diff --git a/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/LANDevice/LANHostConfigManagement/IPInterface/IPInterface.c b/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/LANDevice/LANHostConfigManagement/IPInterface/IPInterface.c
new file mode 100755
index 0000000..0963555
--- /dev/null
+++ b/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/LANDevice/LANHostConfigManagement/IPInterface/IPInterface.c
@@ -0,0 +1,84 @@
+
+
+
+int cpe_refresh_igd_ld_lhcm_ipinterface(cwmp_t * cwmp, parameter_node_t * param_node, callback_register_func_t callback_reg)
+{
+ FUNCTION_TRACE();
+
+ if(!param_node)
+ {
+ return FAULT_CODE_9002;
+ }
+ parameter_node_t * tmp_param, *tmp_node, *child_param;
+ child_param = param_node->child;
+ if(child_param)
+ {
+ for(tmp_param=child_param->next_sibling; tmp_param; )
+ {
+ cwmp_log_info("refresh LANDevice.{i}.LANHostConfigManagement.IPInterface node, delete param %s\n", tmp_param->name);
+ tmp_node = tmp_param->next_sibling;
+ cwmp_model_delete_parameter(tmp_param);
+ tmp_param = tmp_node;
+ }
+ child_param->next_sibling = NULL;
+
+ cwmp_log_info("ready to get lan index");
+ int lan_index = get_index_after_paramname(param_node, "LANDevice");
+
+ cwmp_log_info("lan index is:%d", lan_index);
+
+ parameter_node_t * lan1conn_param;
+ cwmp_model_copy_parameter(param_node, &lan1conn_param, 1);
+
+ if(lan_index == 2)
+ {
+ parameter_node_t * lan2conn_param;
+ cwmp_model_copy_parameter(param_node, &lan2conn_param, 2);
+ }
+
+ cwmp_model_refresh_object(cwmp, param_node, 0, callback_reg);
+ }
+
+ return FAULT_CODE_OK;
+}
+
+
+int cpe_get_igd_ld_lhcm_ipinterfaceipaddress(cwmp_t * cwmp, const char * name, char ** value, pool_t * pool)
+{
+ FUNCTION_TRACE();
+
+ *value = pool_pstrdup(pool, "192.168.0.1");
+
+ return FAULT_CODE_OK;
+
+}
+
+
+int cpe_get_igd_ld_lhcm_ipinterfacesubnetMask(cwmp_t * cwmp, const char * name, char ** value, pool_t * pool)
+{
+ FUNCTION_TRACE();
+
+ *value = pool_pstrdup(pool, "255.255.255.0");
+
+ return FAULT_CODE_OK;
+
+}
+
+
+int cpe_set_igd_ld_lhcm_ipinterfaceipaddress(cwmp_t * cwmp, const char * name, const char * value, int length, callback_register_func_t callback_reg)
+{
+ FUNCTION_TRACE();
+ cwmp_log_info("value is:%s", value);
+ return FAULT_CODE_OK;
+}
+
+int cpe_set_igd_ld_lhcm_ipinterfacesubnetMask(cwmp_t * cwmp, const char * name, const char * value, int length, callback_register_func_t callback_reg)
+{
+ FUNCTION_TRACE();
+ cwmp_log_info("value is:%s", value);
+ return FAULT_CODE_OK;
+}
+
+
+
+
diff --git a/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/LANDevice/LANHostConfigManagement/LANHostConfigManagement.c b/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/LANDevice/LANHostConfigManagement/LANHostConfigManagement.c
new file mode 100755
index 0000000..58bece4
--- /dev/null
+++ b/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/LANDevice/LANHostConfigManagement/LANHostConfigManagement.c
@@ -0,0 +1,3 @@
+
+
+
diff --git a/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/LANDevice/WLANConfiguration/WLANConfiguration.c b/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/LANDevice/WLANConfiguration/WLANConfiguration.c
new file mode 100755
index 0000000..43b5c68
--- /dev/null
+++ b/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/LANDevice/WLANConfiguration/WLANConfiguration.c
@@ -0,0 +1,170 @@
+
+
+int cpe_refresh_igd_ld_wlanconfiguration(cwmp_t * cwmp, parameter_node_t * param_node, callback_register_func_t callback_reg)
+{
+ FUNCTION_TRACE();
+
+ if(!param_node)
+ {
+ return FAULT_CODE_9002;
+ }
+ parameter_node_t * tmp_param, *tmp_node, *child_param;
+ child_param = param_node->child;
+ if(child_param)
+ {
+ for(tmp_param=child_param->next_sibling; tmp_param; )
+ {
+ cwmp_log_info("refresh LANDevice.{i}.WLANConfiguration node, delete param %s\n", tmp_param->name);
+ tmp_node = tmp_param->next_sibling;
+ cwmp_model_delete_parameter(tmp_param);
+ tmp_param = tmp_node;
+ }
+ child_param->next_sibling = NULL;
+
+ cwmp_log_info("ready to get lan index");
+ int lan_index = get_index_after_paramname(param_node, "LANDevice");
+
+ cwmp_log_info("lan index is:%d", lan_index);
+
+ parameter_node_t * lan1conn_param;
+ cwmp_model_copy_parameter(param_node, &lan1conn_param, 1);
+
+ if(lan_index == 2)
+ {
+ parameter_node_t * lan2conn_param;
+ cwmp_model_copy_parameter(param_node, &lan2conn_param, 2);
+ }
+
+ cwmp_model_refresh_object(cwmp, param_node, 0, callback_reg);
+ }
+
+ return FAULT_CODE_OK;
+}
+
+
+
+int cpe_get_igd_ld_wc_ssid(cwmp_t * cwmp, const char * name, char ** value, pool_t * pool)
+{
+ FUNCTION_TRACE();
+ char tmp[16] = {0};
+
+ sc_cfg_get("SSID1", tmp, sizeof(tmp)-1);
+
+ *value = pool_pstrdup(pool, tmp);
+
+ return FAULT_CODE_OK;
+}
+
+
+
+
+int cpe_refresh_igd_ld_wc_wepkey(cwmp_t * cwmp, parameter_node_t * param_node, callback_register_func_t callback_reg)
+{
+// FUNCTION_TRACE();
+
+ if(!param_node)
+ {
+ return FAULT_CODE_9002;
+ }
+ parameter_node_t * tmp_param, *tmp_node, *child_param;
+ child_param = param_node->child;
+ if(child_param)
+ {
+ for(tmp_param=child_param->next_sibling; tmp_param; )
+ {
+ cwmp_log_info("refresh WLANConfiguration node, delete param %s\n", tmp_param->name);
+ tmp_node = tmp_param->next_sibling;
+ cwmp_model_delete_parameter(tmp_param);
+ tmp_param = tmp_node;
+ }
+ child_param->next_sibling = NULL;
+
+ int lan_index = get_index_after_paramname(param_node, "LANDevice");
+ int wlan_cof_index = get_index_after_paramname(param_node, "WLANConfiguration");
+
+ if(lan_index == 1)
+ {
+ parameter_node_t * wlan_conf_param;
+ switch(wlan_cof_index)
+ {
+ case 1:
+ cwmp_model_copy_parameter(param_node, &wlan_conf_param, 1);
+ break;
+
+ case 2:
+ cwmp_model_copy_parameter(param_node, &wlan_conf_param, 1);
+ cwmp_model_copy_parameter(param_node, &wlan_conf_param, 2);
+ break;
+
+ }
+
+ }
+ else if(lan_index == 2)
+ {
+ //don't support
+ cwmp_log_info("do not support index 2");
+ }
+
+ cwmp_model_refresh_object(cwmp, param_node, 0, callback_reg);
+ }
+
+ return FAULT_CODE_OK;
+}
+
+
+
+int cpe_refresh_igd_ld_wc_presharekey(cwmp_t * cwmp, parameter_node_t * param_node, callback_register_func_t callback_reg)
+{
+// FUNCTION_TRACE();
+
+ if(!param_node)
+ {
+ return FAULT_CODE_9002;
+ }
+ parameter_node_t * tmp_param, *tmp_node, *child_param;
+ child_param = param_node->child;
+ if(child_param)
+ {
+ for(tmp_param=child_param->next_sibling; tmp_param; )
+ {
+ cwmp_log_info("refresh WLANConfiguration node, delete param %s\n", tmp_param->name);
+ tmp_node = tmp_param->next_sibling;
+ cwmp_model_delete_parameter(tmp_param);
+ tmp_param = tmp_node;
+ }
+ child_param->next_sibling = NULL;
+
+ int lan_index = get_index_after_paramname(param_node, "LANDevice");
+ int wlan_cof_index = get_index_after_paramname(param_node, "WLANConfiguration");
+
+ if(lan_index == 1)
+ {
+ parameter_node_t * wlan_conf_param;
+ switch(wlan_cof_index)
+ {
+ case 1:
+ cwmp_model_copy_parameter(param_node, &wlan_conf_param, 1);
+ break;
+
+ case 2:
+ cwmp_model_copy_parameter(param_node, &wlan_conf_param, 1);
+ cwmp_model_copy_parameter(param_node, &wlan_conf_param, 2);
+ break;
+
+ }
+
+ }
+ else if(lan_index == 2)
+ {
+ //don't support
+ cwmp_log_info("do not support index 2");
+ }
+
+ cwmp_model_refresh_object(cwmp, param_node, 0, callback_reg);
+ }
+
+ return FAULT_CODE_OK;
+}
+
+
+
diff --git a/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/ManagementServer/ManagementServer.c b/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/ManagementServer/ManagementServer.c
new file mode 100755
index 0000000..b784613
--- /dev/null
+++ b/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/ManagementServer/ManagementServer.c
@@ -0,0 +1,382 @@
+
+#include "cfg_api.h"
+
+
+int cpe_get_localip(const char * eth_name, char *hostip)
+{
+
+ sc_cfg_get(eth_name, hostip, 256);
+
+ return CWMP_OK;
+
+
+#if 0
+ register int fd,intrface,retn=0;
+ struct ifreq buf[32];
+ struct ifconf ifc;
+ char domain_host[100] = {0};
+ char local_ip_addr[20] = {0};
+ char local_mac[20] = {0};
+ //Get Domain Name --------------------------------------------------
+ strcpy(local_ip_addr, "127.0.0.1");
+ if (!hostip)
+ return -1;
+ if (getdomainname(&domain_host[0], 100) != 0)
+ {
+ return -1;
+ }
+ //------------------------------------------------------------------
+ //Get IP Address & Mac Address ----------------------------------------
+ if ((fd=socket(AF_INET,SOCK_DGRAM,0))>=0)
+ {
+ ifc.ifc_len=sizeof buf;
+ ifc.ifc_buf=(caddr_t)buf;
+ if (!ioctl(fd,SIOCGIFCONF,(char*)&ifc))
+ {
+ intrface=ifc.ifc_len/sizeof(struct ifreq);
+ while (intrface-->0)
+ {
+ if (!(ioctl(fd,SIOCGIFFLAGS,(char*)&buf[intrface])))
+ {
+ if (buf[intrface].ifr_flags&IFF_PROMISC)
+ {
+ retn++;
+ }
+ }
+ //Get IP Address
+ if (!(ioctl(fd,SIOCGIFADDR,(char*)&buf[intrface])))
+ {
+ if(strcmp(eth_name, buf[intrface].ifr_name) == 0)
+ {
+ sprintf(local_ip_addr, "%s", inet_ntoa(((struct sockaddr_in*)(&buf[intrface].ifr_addr))->sin_addr));
+
+ break;
+ }
+ }
+ //Get Hardware Address
+
+ }//While
+ }
+ }
+ if ( fd > 0 )
+ {
+ close(fd);
+ }
+
+ strcpy(hostip, local_ip_addr);
+
+ return CWMP_OK;
+#endif
+
+}
+
+//InternetGatewayDevice.ManagementServer.Username
+int cpe_get_igd_ms_username(cwmp_t * cwmp, const char * name, char ** value, pool_t * pool)
+{
+ FUNCTION_TRACE();
+ *value = cwmp_conf_pool_get(pool, "cwmp:acs_username");
+ return FAULT_CODE_OK;
+}
+
+//InternetGatewayDevice.ManagementServer.Username
+int cpe_set_igd_ms_username(cwmp_t * cwmp, const char * name, const char * value, int length, callback_register_func_t callback_reg)
+{
+ FUNCTION_TRACE();
+ cwmp_conf_set("cwmp:acs_username", value);
+ pool_pfree(cwmp->pool, cwmp->acs_user);
+ cwmp->acs_user = pool_pstrdup(cwmp->pool, value);
+ return FAULT_CODE_OK;
+}
+
+//InternetGatewayDevice.ManagementServer.Password
+int cpe_get_igd_ms_password(cwmp_t * cwmp, const char * name, char ** value, pool_t * pool)
+{
+ FUNCTION_TRACE();
+ *value = cwmp_conf_pool_get(pool, "cwmp:acs_password");
+ return FAULT_CODE_OK;
+}
+
+int cpe_set_igd_ms_password(cwmp_t * cwmp, const char * name, const char * value, int length, callback_register_func_t callback_reg)
+{
+ FUNCTION_TRACE();
+ cwmp_conf_set("cwmp:acs_password", value);
+ pool_pfree(cwmp->pool, cwmp->acs_pwd);
+ cwmp->acs_pwd = pool_pstrdup(cwmp->pool, value);
+ return FAULT_CODE_OK;
+}
+
+//InternetGatewayDevice.ManagementServer.URL
+int cpe_get_igd_ms_url(cwmp_t * cwmp, const char * name, char ** value, pool_t * pool)
+{
+ FUNCTION_TRACE();
+ *value = cwmp_conf_pool_get(pool, "cwmp:acs_url");
+ return FAULT_CODE_OK;
+}
+
+//InternetGatewayDevice.ManagementServer.URL
+int cpe_set_igd_ms_url(cwmp_t * cwmp, const char * name, const char * value, int length, callback_register_func_t callback_reg)
+{
+ FUNCTION_TRACE();
+ cwmp_conf_set("cwmp:acs_url", value);
+ pool_pfree(cwmp->pool, cwmp->acs_url);
+ cwmp->acs_url = pool_pstrdup(cwmp->pool, value);
+ return FAULT_CODE_OK;
+}
+
+
+int cpe_get_igd_ms_PeriodicInformEnable(cwmp_t * cwmp, const char * name, char ** value, pool_t * pool)
+{
+ FUNCTION_TRACE();
+ *value = cwmp_conf_pool_get(pool, "periodic:enable");
+ return FAULT_CODE_OK;
+}
+
+
+
+int cpe_set_igd_ms_PeriodicInformEnable(cwmp_t * cwmp, const char * name, const char * value, int length, callback_register_func_t callback_reg)
+{
+ FUNCTION_TRACE();
+ cwmp_log_info("set PeriodicInformEnable:%s", value);
+ cwmp_conf_set("periodic:enable", value);
+ update_periodic_info_enable(cwmp);
+ return FAULT_CODE_OK;
+}
+
+
+
+
+int cpe_set_igd_ms_PeriodicInformInterval(cwmp_t * cwmp, const char * name, const char * value, int length, callback_register_func_t callback_reg)
+{
+ FUNCTION_TRACE();
+ cwmp_log_info("set PeriodicInformInterval:%s", value);
+ cwmp_conf_set("periodic:interval", value);
+
+ update_periodic_info_interval(cwmp);
+
+ return FAULT_CODE_OK;
+}
+
+
+
+int cpe_get_igd_ms_PeriodicInformInterval(cwmp_t * cwmp, const char * name, char ** value, pool_t * pool)
+{
+ FUNCTION_TRACE();
+ *value = cwmp_conf_pool_get(pool, "periodic:interval");
+ return FAULT_CODE_OK;
+}
+
+//InternetGatewayDevice.ManagementServer.ConnectionRequestURL
+int cpe_get_igd_ms_connectionrequesturl(cwmp_t * cwmp, const char * name, char ** value, pool_t * pool)
+{
+ char buf[512]={0};
+ char local_ip[256]={0};
+ FUNCTION_TRACE();
+
+ int port = cwmp_conf_get_int("cwmpd:httpd_port");
+ int family = get_family_type();
+
+ if(family == AF_INET)
+ {
+ cpe_get_localip("wan1_ip", local_ip);
+ snprintf(buf, sizeof(buf), "http://%s:%d", local_ip, port);
+ }
+ else if(family == AF_INET6)
+ {
+ cpe_get_localip("ipv6_br0_addr", local_ip);
+ snprintf(buf, sizeof(buf), "http://[%s]:%d", local_ip, port);
+ }
+ else
+ {
+ cpe_get_localip("wan1_ip", local_ip);
+ snprintf(buf, sizeof(buf), "http://%s:%d", local_ip, port);
+ cwmp_log_error("unknown family type:%d", family);
+ }
+
+ cwmp_log_debug("connectionrequesturl:%s", buf);
+
+ *value = PSTRDUP(buf);
+ return FAULT_CODE_OK;
+}
+
+//InternetGatewayDevice.ManagementServer.ConnectionRequestUsername
+int cpe_get_igd_ms_connectionrequestusername(cwmp_t * cwmp, const char * name, char ** value, pool_t * pool)
+{
+ FUNCTION_TRACE();
+ *value = cwmp_conf_pool_get(pool, "cwmp:cpe_username");
+ return FAULT_CODE_OK;
+}
+int cpe_set_igd_ms_connectionrequestusername(cwmp_t * cwmp, const char * name, const char * value, int length, callback_register_func_t callback_reg)
+{
+ FUNCTION_TRACE();
+ cwmp_conf_set("cwmp:cpe_username", value);
+ pool_pfree(cwmp->pool, cwmp->cpe_user);
+ cwmp->cpe_user = pool_pstrdup(cwmp->pool, value);
+ return FAULT_CODE_OK;
+}
+
+
+//InternetGatewayDevice.ManagementServer.ConnectionRequestPassword
+int cpe_get_igd_ms_connectionrequestpassword(cwmp_t * cwmp, const char * name, char ** value, pool_t * pool)
+{
+ *value = cwmp_conf_pool_get(pool, "cwmp:cpe_password");
+ return FAULT_CODE_OK;
+}
+int cpe_set_igd_ms_connectionrequestpassword(cwmp_t * cwmp, const char * name, const char * value, int length, callback_register_func_t callback_reg)
+{
+ int rc = cwmp_conf_set("cwmp:cpe_password", value);
+ cwmp_log_info("set result:%d", rc);
+ pool_pfree(cwmp->pool, cwmp->cpe_pwd);
+ cwmp->cpe_pwd = pool_pstrdup(cwmp->pool, value);
+ return FAULT_CODE_OK;
+}
+
+
+
+int cpe_get_igd_ms_STUNEnable(cwmp_t * cwmp, const char * name, char ** value, pool_t * pool)
+{
+ FUNCTION_TRACE();
+ *value = cwmp_conf_pool_get(pool, "test:stun_enable");
+
+ return FAULT_CODE_OK;
+}
+
+
+int cpe_set_igd_ms_STUNEnable(cwmp_t * cwmp, const char * name, const char * value, int length, callback_register_func_t callback_reg)
+{
+ FUNCTION_TRACE();
+ cwmp_conf_set("test:stun_enable", value);
+ return FAULT_CODE_OK;
+}
+
+
+int cpe_get_igd_ms_parameterkey(cwmp_t * cwmp, const char * name, char ** value, pool_t * pool)
+{
+ FUNCTION_TRACE();
+ *value = cwmp_conf_pool_get(pool, "test:parameterkey");
+
+ return FAULT_CODE_OK;
+}
+
+
+int cpe_set_igd_ms_parameterkey(cwmp_t * cwmp, const char * name, const char * value, int length, callback_register_func_t callback_reg)
+{
+ FUNCTION_TRACE();
+ cwmp_conf_set("test:parameterkey", value);
+ return FAULT_CODE_OK;
+}
+
+
+int cpe_get_igd_ms_stunserveraddress(cwmp_t * cwmp, const char * name, char ** value, pool_t * pool)
+{
+ FUNCTION_TRACE();
+ *value = cwmp_conf_pool_get(pool, "test:stun_serveraddress");
+
+ return FAULT_CODE_OK;
+}
+
+
+int cpe_set_igd_ms_stunserveraddress(cwmp_t * cwmp, const char * name, const char * value, int length, callback_register_func_t callback_reg)
+{
+ FUNCTION_TRACE();
+ cwmp_conf_set("test:stun_serveraddress", value);
+ return FAULT_CODE_OK;
+}
+
+int cpe_get_igd_ms_stunserverport(cwmp_t * cwmp, const char * name, char ** value, pool_t * pool)
+{
+ FUNCTION_TRACE();
+ *value = cwmp_conf_pool_get(pool, "test:stun_serverport");
+
+ return FAULT_CODE_OK;
+}
+
+
+int cpe_set_igd_ms_stunserverport(cwmp_t * cwmp, const char * name, const char * value, int length, callback_register_func_t callback_reg)
+{
+ FUNCTION_TRACE();
+ cwmp_conf_set("test:stun_serverport", value);
+ return FAULT_CODE_OK;
+}
+
+int cpe_get_igd_ms_stunusername(cwmp_t * cwmp, const char * name, char ** value, pool_t * pool)
+{
+ FUNCTION_TRACE();
+ *value = cwmp_conf_pool_get(pool, "test:stun_username");
+
+ return FAULT_CODE_OK;
+}
+
+
+int cpe_set_igd_ms_stunusername(cwmp_t * cwmp, const char * name, const char * value, int length, callback_register_func_t callback_reg)
+{
+ FUNCTION_TRACE();
+ cwmp_conf_set("test:stun_username", value);
+ return FAULT_CODE_OK;
+}
+
+int cpe_get_igd_ms_stunpassword(cwmp_t * cwmp, const char * name, char ** value, pool_t * pool)
+{
+ FUNCTION_TRACE();
+ *value = cwmp_conf_pool_get(pool, "test:stun_password");
+
+ return FAULT_CODE_OK;
+}
+
+
+int cpe_set_igd_ms_stunpassword(cwmp_t * cwmp, const char * name, const char * value, int length, callback_register_func_t callback_reg)
+{
+ FUNCTION_TRACE();
+ cwmp_conf_set("test:stun_password", value);
+ return FAULT_CODE_OK;
+}
+
+int cpe_get_igd_ms_stunmaximumkeepaliveperiod(cwmp_t * cwmp, const char * name, char ** value, pool_t * pool)
+{
+ FUNCTION_TRACE();
+ *value = cwmp_conf_pool_get(pool, "test:stun_maximumkeepaliveperiod");
+
+ return FAULT_CODE_OK;
+}
+
+
+int cpe_set_igd_ms_stunmaximumkeepaliveperiod(cwmp_t * cwmp, const char * name, const char * value, int length, callback_register_func_t callback_reg)
+{
+ FUNCTION_TRACE();
+ cwmp_conf_set("test:stun_maximumkeepaliveperiod", value);
+ return FAULT_CODE_OK;
+}
+
+
+int cpe_get_igd_ms_stunminimumkeepaliveperiod(cwmp_t * cwmp, const char * name, char ** value, pool_t * pool)
+{
+ FUNCTION_TRACE();
+ *value = cwmp_conf_pool_get(pool, "test:stun_minimumkeepaliveperiod");
+
+ return FAULT_CODE_OK;
+}
+
+
+int cpe_set_igd_ms_stunminimumkeepaliveperiod(cwmp_t * cwmp, const char * name, const char * value, int length, callback_register_func_t callback_reg)
+{
+ FUNCTION_TRACE();
+ cwmp_conf_set("test:stun_minimumkeepaliveperiod", value);
+ return FAULT_CODE_OK;
+}
+
+int cpe_get_igd_ms_natdetected(cwmp_t * cwmp, const char * name, char ** value, pool_t * pool)
+{
+ FUNCTION_TRACE();
+ *value = cwmp_conf_pool_get(pool, "test:natdetected");
+
+ return FAULT_CODE_OK;
+}
+
+
+int cpe_set_igd_ms_natdetected(cwmp_t * cwmp, const char * name, const char * value, int length, callback_register_func_t callback_reg)
+{
+ FUNCTION_TRACE();
+ cwmp_conf_set("test:natdetected", value);
+ return FAULT_CODE_OK;
+}
+
+
diff --git a/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/Time/Time.c b/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/Time/Time.c
new file mode 100755
index 0000000..67a6a3a
--- /dev/null
+++ b/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/Time/Time.c
@@ -0,0 +1,146 @@
+#include "cfg_api.h"
+#include <time.h>
+
+//InternetGatewayDevice.Time
+
+int cpe_get_igd_time_ntpserver0(cwmp_t * cwmp, const char * name, char ** value, pool_t * pool)
+{
+ FUNCTION_TRACE();
+ char tmp[64+1] = {0};
+
+ sc_cfg_get("sntp_server0", tmp, sizeof(tmp)-1);
+
+ *value = pool_pstrdup(pool, tmp);
+
+ return FAULT_CODE_OK;
+
+}
+
+
+int cpe_set_igd_time_ntpserver0(cwmp_t * cwmp, const char * name, const char * value, int length, callback_register_func_t callback_reg)
+{
+ FUNCTION_TRACE();
+ sc_cfg_set("sntp_server0", value);
+ sc_cfg_save();
+ return FAULT_CODE_OK;
+}
+
+
+int cpe_get_igd_time_ntpserver1(cwmp_t * cwmp, const char * name, char ** value, pool_t * pool)
+{
+ FUNCTION_TRACE();
+ char tmp[64+1] = {0};
+
+ sc_cfg_get("sntp_server1", tmp, sizeof(tmp)-1);
+
+ *value = pool_pstrdup(pool, tmp);
+
+ return FAULT_CODE_OK;
+
+}
+
+int cpe_set_igd_time_ntpserver1(cwmp_t * cwmp, const char * name, const char * value, int length, callback_register_func_t callback_reg)
+{
+ FUNCTION_TRACE();
+ sc_cfg_set("sntp_server1", value);
+ sc_cfg_save();
+ return FAULT_CODE_OK;
+}
+
+
+int cpe_get_igd_time_ntpserver2(cwmp_t * cwmp, const char * name, char ** value, pool_t * pool)
+{
+ FUNCTION_TRACE();
+ char tmp[64+1] = {0};
+
+ sc_cfg_get("sntp_server2", tmp, sizeof(tmp)-1);
+
+ *value = pool_pstrdup(pool, tmp);
+
+ return FAULT_CODE_OK;
+
+}
+
+
+
+int cpe_set_igd_time_ntpserver2(cwmp_t * cwmp, const char * name, const char * value, int length, callback_register_func_t callback_reg)
+{
+ FUNCTION_TRACE();
+ sc_cfg_set("sntp_server2", value);
+ sc_cfg_save();
+ return FAULT_CODE_OK;
+}
+
+
+
+int cpe_get_igd_time_currentlocaltime(cwmp_t * cwmp, const char * name, char ** value, pool_t * pool)
+{
+ FUNCTION_TRACE();
+ char tmp[64+1] = {0};
+
+ struct tm *ptm;
+ time_t tn;
+
+ tn = time(NULL);
+#ifdef WIN32
+ cwmp_log_debug("inform datatime");
+ memset(t, 0, sizeof(struct tm));
+#else
+ ptm = localtime(&tn);
+ if(NULL == ptm)
+ {
+ cwmp_log_error("localtime return NULL");
+ *value = pool_pstrdup(pool, "1900-00-00T00:00:00");
+ return FAULT_CODE_OK;
+ }
+#endif
+
+ TRsnprintf(tmp, sizeof(tmp)-1, "%4d-%02d-%02dT%02d:%02d:%02d",
+ ptm->tm_year + 1900,
+ ptm->tm_mon,
+ ptm->tm_mday,
+ ptm->tm_hour,
+ ptm->tm_min,
+ ptm->tm_sec);
+
+
+ *value = pool_pstrdup(pool, tmp);
+
+ return FAULT_CODE_OK;
+}
+
+
+
+int cpe_get_igd_time_localtimezone(cwmp_t * cwmp, const char * name, char ** value, pool_t * pool)
+{
+ FUNCTION_TRACE();
+ char tmp[64+1] = {0};
+
+ sc_cfg_get("sntp_timezone_index", tmp, sizeof(tmp)-1);
+
+ *value = pool_pstrdup(pool, tmp);
+
+ return FAULT_CODE_OK;
+
+}
+
+
+
+int cpe_get_igd_time_localtimezonename(cwmp_t * cwmp, const char * name, char ** value, pool_t * pool)
+{
+ FUNCTION_TRACE();
+ char tmp[64+1] = {0};
+
+ sc_cfg_get("sntp_timezone", tmp, sizeof(tmp)-1);
+
+ *value = pool_pstrdup(pool, tmp);
+
+ return FAULT_CODE_OK;
+
+}
+
+
+
+
+
+
diff --git a/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/WANDevice/COM_WANInterfaceConfig/COM_WANInterfaceConfig.c b/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/WANDevice/COM_WANInterfaceConfig/COM_WANInterfaceConfig.c
new file mode 100755
index 0000000..d638a1e
--- /dev/null
+++ b/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/WANDevice/COM_WANInterfaceConfig/COM_WANInterfaceConfig.c
@@ -0,0 +1,45 @@
+
+int cpe_refresh_igd_wd_comwaninterfaceconfig(cwmp_t * cwmp, parameter_node_t * param_node, callback_register_func_t callback_reg)
+{
+ FUNCTION_TRACE();
+
+ if(!param_node)
+ {
+ return FAULT_CODE_9002;
+ }
+ parameter_node_t * tmp_param, *tmp_node, *child_param;
+ child_param = param_node->child;
+ if(child_param)
+ {
+ for(tmp_param=child_param->next_sibling; tmp_param; )
+ {
+ cwmp_log_info("refresh WANConnectionDevice node, delete param %s\n", tmp_param->name);
+ tmp_node = tmp_param->next_sibling;
+ cwmp_model_delete_parameter(tmp_param);
+ tmp_param = tmp_node;
+ }
+ child_param->next_sibling = NULL;
+
+ cwmp_log_info("ready to get wan index");
+ int wan_index = get_index_after_paramname(param_node, "WANDevice");
+
+ cwmp_log_info("wan index is:%d", wan_index);
+
+ parameter_node_t * wan1conn_param;
+ cwmp_model_copy_parameter(param_node, &wan1conn_param, 1);
+
+ if(wan_index == 2)
+ {
+ parameter_node_t * wan2conn_param;
+ cwmp_model_copy_parameter(param_node, &wan2conn_param, 2);
+ }
+
+ cwmp_model_refresh_object(cwmp, param_node, 0, callback_reg);
+ }
+
+ return FAULT_CODE_OK;
+}
+
+
+
+
diff --git a/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/WANDevice/WANConnectionDevice/WANConnectionDevice.c b/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/WANDevice/WANConnectionDevice/WANConnectionDevice.c
new file mode 100755
index 0000000..10ce08c
--- /dev/null
+++ b/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/WANDevice/WANConnectionDevice/WANConnectionDevice.c
@@ -0,0 +1,52 @@
+
+
+int cpe_refresh_igd_wd_wanconnectiondevice(cwmp_t * cwmp, parameter_node_t * param_node, callback_register_func_t callback_reg)
+{
+ FUNCTION_TRACE();
+
+ if(!param_node)
+ {
+ return FAULT_CODE_9002;
+ }
+ parameter_node_t * tmp_param, *tmp_node, *child_param;
+ child_param = param_node->child;
+ if(child_param)
+ {
+ for(tmp_param=child_param->next_sibling; tmp_param; )
+ {
+ cwmp_log_info("refresh WANConnectionDevice node, delete param %s\n", tmp_param->name);
+ tmp_node = tmp_param->next_sibling;
+ cwmp_model_delete_parameter(tmp_param);
+ tmp_param = tmp_node;
+ }
+ child_param->next_sibling = NULL;
+
+ cwmp_log_info("ready to get wan index");
+ int wan_index = get_index_after_paramname(param_node, "WANDevice");
+
+ cwmp_log_info("wan index is:%d", wan_index);
+
+ parameter_node_t * wan1conn_param;
+ cwmp_model_copy_parameter(param_node, &wan1conn_param, 1);
+
+ if(wan_index == 2)
+ {
+ parameter_node_t * wan2conn_param;
+ cwmp_model_copy_parameter(param_node, &wan2conn_param, 2);
+ }
+
+ cwmp_model_refresh_object(cwmp, param_node, 0, callback_reg);
+ }
+
+ return FAULT_CODE_OK;
+}
+
+
+int cpe_del_igd_wanconnectiondevice(cwmp_t * cwmp, parameter_node_t * param_node, int instance_number, callback_register_func_t callback_reg)
+{
+ cwmp_log_info("del object:1 ");
+
+ return FAULT_CODE_OK;
+}
+
+
diff --git a/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/WANDevice/WANConnectionDevice/WANIPConnection.c b/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/WANDevice/WANConnectionDevice/WANIPConnection.c
new file mode 100755
index 0000000..01cd984
--- /dev/null
+++ b/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/WANDevice/WANConnectionDevice/WANIPConnection.c
@@ -0,0 +1,108 @@
+
+
+
+
+int cpe_refresh_igd_wd_wcd_wanipconnection(cwmp_t * cwmp, parameter_node_t * param_node, callback_register_func_t callback_reg)
+{
+// FUNCTION_TRACE();
+
+ if(!param_node)
+ {
+ return FAULT_CODE_9002;
+ }
+ parameter_node_t * tmp_param, *tmp_node, *child_param;
+ child_param = param_node->child;
+ if(child_param)
+ {
+ for(tmp_param=child_param->next_sibling; tmp_param; )
+ {
+ cwmp_log_info("refresh WANConnectionDevice node, delete param %s\n", tmp_param->name);
+ tmp_node = tmp_param->next_sibling;
+ cwmp_model_delete_parameter(tmp_param);
+ tmp_param = tmp_node;
+ }
+ child_param->next_sibling = NULL;
+
+ int wan_index = get_index_after_paramname(param_node, "WANDevice");
+ int wan_conn_dev_index = get_index_after_paramname(param_node, "WANConnectionDevice");
+
+ if(wan_index == 1)
+ {
+ parameter_node_t * ipconn_param;
+ switch(wan_conn_dev_index)
+ {
+ case 1:
+ cwmp_model_copy_parameter(param_node, &ipconn_param, 1);
+ break;
+
+ case 2:
+ cwmp_model_copy_parameter(param_node, &ipconn_param, 1);
+ cwmp_model_copy_parameter(param_node, &ipconn_param, 2);
+ break;
+
+ }
+
+ }
+ else if(wan_index == 2)
+ {
+ //don't support
+ cwmp_log_info("do not support wan index 2");
+ }
+
+ cwmp_model_refresh_object(cwmp, param_node, 0, callback_reg);
+ }
+
+ return FAULT_CODE_OK;
+}
+
+
+
+int cpe_add_igd_wanpppconnection(cwmp_t * cwmp, parameter_node_t * param_node, int *pinstance_number, callback_register_func_t callback_reg)
+{
+ cwmp_log_info("add object:1 ");
+
+ return FAULT_CODE_OK;
+}
+
+int cpe_get_igd_wd_wcd_wic_enable(cwmp_t * cwmp, const char * name, char ** value, pool_t * pool)
+{
+ FUNCTION_TRACE();
+ char tmp[3] = {0};
+
+ sc_cfg_get("PortMapEnable", tmp, sizeof(tmp)-1);
+
+ *value = pool_pstrdup(pool, tmp);
+
+ return FAULT_CODE_OK;
+
+}
+
+int cpe_get_igd_wd_wcd_wic_rsrp(cwmp_t * cwmp, const char * name, char ** value, pool_t * pool)
+{
+ FUNCTION_TRACE();
+ char tmp[16] = {0};
+
+ sc_cfg_get("lte_rsrp", tmp, sizeof(tmp)-1);
+
+ *value = pool_pstrdup(pool, tmp);
+
+ return FAULT_CODE_OK;
+
+}
+
+int cpe_get_igd_wd_wcd_wic_rssi(cwmp_t * cwmp, const char * name, char ** value, pool_t * pool)
+{
+ FUNCTION_TRACE();
+ char tmp[16] = {0};
+
+ sc_cfg_get("rssi", tmp, sizeof(tmp)-1);
+
+ *value = pool_pstrdup(pool, tmp);
+
+ return FAULT_CODE_OK;
+
+}
+
+
+
+
diff --git a/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/WANDevice/WANDevice.c b/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/WANDevice/WANDevice.c
new file mode 100755
index 0000000..cfdda07
--- /dev/null
+++ b/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/WANDevice/WANDevice.c
@@ -0,0 +1,36 @@
+
+int cpe_refresh_igd_wandevice(cwmp_t * cwmp, parameter_node_t * param_node, callback_register_func_t callback_reg)
+{
+ FUNCTION_TRACE();
+
+ if(!param_node)
+ {
+ return FAULT_CODE_9002;
+ }
+ parameter_node_t * tmp_param, *tmp_node, *child_param;
+ child_param = param_node->child;
+ if(child_param)
+ {
+ for(tmp_param=child_param->next_sibling; tmp_param; )
+ {
+ cwmp_log_info("refresh WANDevice node, delete param %s\n", tmp_param->name);
+ tmp_node = tmp_param->next_sibling;
+ cwmp_model_delete_parameter(tmp_param);
+ tmp_param = tmp_node;
+ }
+ child_param->next_sibling = NULL;
+
+ parameter_node_t * wan1_param;
+ cwmp_model_copy_parameter(param_node, &wan1_param, 1);
+
+// parameter_node_t * wan2_param;
+// cwmp_model_copy_parameter(param_node, &wan2_param, 2);
+
+ cwmp_model_refresh_object(cwmp, param_node, 0, callback_reg);
+ }
+
+ return FAULT_CODE_OK;
+}
+
+
+
diff --git a/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/WANDevice/WANEthernetInterfaceConfig/WANEthernetInterfaceConfig.c b/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/WANDevice/WANEthernetInterfaceConfig/WANEthernetInterfaceConfig.c
new file mode 100755
index 0000000..375ceba
--- /dev/null
+++ b/ap/app/cwmp/netcwmp/cwmpd/src/modules/InternetGatewayDevice/WANDevice/WANEthernetInterfaceConfig/WANEthernetInterfaceConfig.c
@@ -0,0 +1,42 @@
+
+int cpe_refresh_igd_wd_wanetherinterfaceconfig(cwmp_t * cwmp, parameter_node_t * param_node, callback_register_func_t callback_reg)
+{
+ FUNCTION_TRACE();
+
+ if(!param_node)
+ {
+ return FAULT_CODE_9002;
+ }
+ parameter_node_t * tmp_param, *tmp_node, *child_param;
+ child_param = param_node->child;
+ if(child_param)
+ {
+ for(tmp_param=child_param->next_sibling; tmp_param; )
+ {
+ cwmp_log_info("refresh WANConnectionDevice node, delete param %s\n", tmp_param->name);
+ tmp_node = tmp_param->next_sibling;
+ cwmp_model_delete_parameter(tmp_param);
+ tmp_param = tmp_node;
+ }
+ child_param->next_sibling = NULL;
+
+ cwmp_log_info("ready to get wan index");
+ int wan_index = get_index_after_paramname(param_node, "WANDevice");
+
+ cwmp_log_info("wan index is:%d", wan_index);
+
+ parameter_node_t * wan1conn_param;
+ cwmp_model_copy_parameter(param_node, &wan1conn_param, 1);
+
+ if(wan_index == 2)
+ {
+ parameter_node_t * wan2conn_param;
+ cwmp_model_copy_parameter(param_node, &wan2conn_param, 2);
+ }
+
+ cwmp_model_refresh_object(cwmp, param_node, 0, callback_reg);
+ }
+
+ return FAULT_CODE_OK;
+}
+
diff --git a/ap/app/cwmp/netcwmp/cwmpd/src/modules/data_model.c b/ap/app/cwmp/netcwmp/cwmpd/src/modules/data_model.c
new file mode 100755
index 0000000..dcb543e
--- /dev/null
+++ b/ap/app/cwmp/netcwmp/cwmpd/src/modules/data_model.c
@@ -0,0 +1,150 @@
+#include "cwmp/model.h"
+#include "data_model.h"
+#include "cwmp_module.h"
+#include "InternetGatewayDevice/InternetGatewayDevice.c"
+
+
+model_func_t ModelFunction[] =
+{
+ //InternetGatewayDevice.DeviceInfo.
+ {"get_igd_di_manufacturer", cpe_get_igd_di_manufacturer},
+ {"get_igd_di_manufactureroui", cpe_get_igd_di_manufactureroui},
+ {"get_igd_di_productclass", cpe_get_igd_di_productclass},
+ {"get_igd_di_serialnumber", cpe_get_igd_di_serialnumber},
+ {"get_igd_di_specversion", cpe_get_igd_di_specversion},
+ {"get_igd_di_hardwareversion", cpe_get_igd_di_hardwareversion},
+ {"get_igd_di_softwareversion", cpe_get_igd_di_softwareversion},
+ {"get_igd_di_provisioningcode", cpe_get_igd_di_provisioningcode},
+ {"set_igd_di_softwareversion", cpe_set_igd_di_softwareversion},
+ {"set_igd_di_hardwareversion", cpe_set_igd_di_hardwareversion},
+
+ //InternetGatewayDevice.DeviceInfo.VendorConfigFile.
+ {"get_igd_di_vc_name", cpe_get_igd_di_vc_name},
+ {"get_igd_di_vc_version", cpe_get_igd_di_vc_version},
+ {"get_igd_di_vc_date", cpe_get_igd_di_vc_date},
+ {"get_igd_di_vc_description", cpe_get_igd_di_vc_description},
+
+ //InternetGatewayDevice.ManagementServer.
+ {"get_igd_ms_username", cpe_get_igd_ms_username},
+ {"set_igd_ms_username", cpe_set_igd_ms_username},
+ {"get_igd_ms_password", cpe_get_igd_ms_password},
+ {"set_igd_ms_password", cpe_set_igd_ms_password},
+ {"get_igd_ms_url", cpe_get_igd_ms_url},
+ {"set_igd_ms_url", cpe_set_igd_ms_url},
+ {"get_igd_ms_connectionrequesturl", cpe_get_igd_ms_connectionrequesturl},
+ {"get_igd_ms_connectionrequestusername", cpe_get_igd_ms_connectionrequestusername},
+ {"set_igd_ms_connectionrequestusername", cpe_set_igd_ms_connectionrequestusername},
+ {"get_igd_ms_connectionrequestpassword", cpe_get_igd_ms_connectionrequestpassword},
+ {"set_igd_ms_connectionrequestpassword", cpe_set_igd_ms_connectionrequestpassword},
+ {"get_igd_ms_STUNEnable", cpe_get_igd_ms_STUNEnable},
+ {"set_igd_ms_STUNEnable", cpe_set_igd_ms_STUNEnable},
+ {"get_igd_ms_parameterkey", cpe_get_igd_ms_parameterkey},
+ {"set_igd_ms_parameterkey", cpe_set_igd_ms_parameterkey},
+ {"get_igd_ms_stunserveraddress", cpe_get_igd_ms_stunserveraddress},
+ {"set_igd_ms_stunserveraddress", cpe_set_igd_ms_stunserveraddress},
+ {"get_igd_ms_stunserverport", cpe_get_igd_ms_stunserverport},
+ {"set_igd_ms_stunserverport", cpe_set_igd_ms_stunserverport},
+ {"get_igd_ms_stunusername", cpe_get_igd_ms_stunusername},
+ {"set_igd_ms_stunusername", cpe_set_igd_ms_stunusername},
+ {"get_igd_ms_stunpassword", cpe_get_igd_ms_stunpassword},
+ {"set_igd_ms_stunpassword", cpe_set_igd_ms_stunpassword},
+ {"get_igd_ms_stunmaximumkeepaliveperiod", cpe_get_igd_ms_stunmaximumkeepaliveperiod},
+ {"set_igd_ms_stunmaximumkeepaliveperiod", cpe_set_igd_ms_stunmaximumkeepaliveperiod},
+ {"get_igd_ms_stunminimumkeepaliveperiod", cpe_get_igd_ms_stunminimumkeepaliveperiod},
+ {"set_igd_ms_stunminimumkeepaliveperiod", cpe_set_igd_ms_stunminimumkeepaliveperiod},
+ {"get_igd_ms_natdetected", cpe_get_igd_ms_natdetected},
+ {"set_igd_ms_natdetected", cpe_set_igd_ms_natdetected},
+ {"get_igd_ms_PeriodicInformEnable", cpe_get_igd_ms_PeriodicInformEnable},
+ {"set_igd_ms_PeriodicInformEnable", cpe_set_igd_ms_PeriodicInformEnable},
+ {"get_igd_ms_PeriodicInformInterval", cpe_get_igd_ms_PeriodicInformInterval},
+ {"set_igd_ms_PeriodicInformInterval", cpe_set_igd_ms_PeriodicInformInterval},
+
+ {"add_igd_wanpppconnection", cpe_add_igd_wanpppconnection},
+
+ {"del_igd_wanconnectiondevice", cpe_del_igd_wanconnectiondevice},
+
+ {"refresh_igd_landevice", cpe_refresh_igd_landevice},
+
+ //InternetGatewayDevice.Time
+ {"get_igd_time_ntpserver0", cpe_get_igd_time_ntpserver0},
+ {"get_igd_time_ntpserver1", cpe_get_igd_time_ntpserver1},
+ {"get_igd_time_ntpserver2", cpe_get_igd_time_ntpserver2},
+ {"set_igd_time_ntpserver0", cpe_set_igd_time_ntpserver0},
+ {"set_igd_time_ntpserver1", cpe_set_igd_time_ntpserver1},
+ {"set_igd_time_ntpserver2", cpe_set_igd_time_ntpserver2},
+ {"get_igd_time_currentlocaltime", cpe_get_igd_time_currentlocaltime},
+ {"get_igd_time_localtimezone", cpe_get_igd_time_localtimezone},
+ {"get_igd_time_localtimezonename", cpe_get_igd_time_localtimezonename},
+
+ //InternetGatewayDevice.WANDevice
+ {"refresh_igd_wandevice", cpe_refresh_igd_wandevice},
+
+ //InternetGatewayDevice.WANDevice.WANConnectionDevice
+ {"refresh_igd_wd_wanconnectiondevice", cpe_refresh_igd_wd_wanconnectiondevice},
+
+ //InternetGatewayDevice.WANDevice.WANConnectionDevice.WANIPConnection
+ {"refresh_igd_wd_wcd_wanipconnection", cpe_refresh_igd_wd_wcd_wanipconnection},
+ {"get_igd_wd_wcd_wic_enable", cpe_get_igd_wd_wcd_wic_enable},
+ {"get_igd_wd_wcd_wic_rsrp", cpe_get_igd_wd_wcd_wic_rsrp},
+ {"get_igd_wd_wcd_wic_rssi", cpe_get_igd_wd_wcd_wic_rssi},
+
+ //InternetGatewayDevice.WANDevice.COM_WANInterfaceConfig
+ {"refresh_igd_wd_comwaninterfaceconfig", cpe_refresh_igd_wd_comwaninterfaceconfig},
+
+ //InternetGatewayDevice.WANDevice.WANEthernetInterfaceConfig
+ {"refresh_igd_wd_wanetherinterfaceconfig", cpe_refresh_igd_wd_wanetherinterfaceconfig},
+
+ //InternetGatewayDevice.LANDevice
+ {"refresh_igd_landevice", cpe_refresh_igd_landevice},
+
+ //InternetGatewayDevice.LANDevice.LANHostConfigManagement.IPInterface
+ {"refresh_igd_ld_lhcm_ipinterface", cpe_refresh_igd_ld_lhcm_ipinterface},
+
+ {"get_igd_ld_lhcm_ipinterfaceipaddress", cpe_get_igd_ld_lhcm_ipinterfaceipaddress},
+ {"set_igd_ld_lhcm_ipinterfaceipaddress", cpe_set_igd_ld_lhcm_ipinterfaceipaddress},
+ {"get_igd_ld_lhcm_ipinterfacesubnetMask", cpe_get_igd_ld_lhcm_ipinterfacesubnetMask},
+ {"set_igd_ld_lhcm_ipinterfacesubnetMask", cpe_set_igd_ld_lhcm_ipinterfacesubnetMask},
+
+ //InternetGatewayDevice.LANDevice.LANHostConfigManagement.DHCPStaticAddress
+ {"refresh_igd_ld_lhcm_dhcpstaticaddress", cpe_refresh_igd_ld_lhcm_dhcpstaticaddress},
+
+ //InternetGatewayDevice.LANDevice.LANEthernetInterfaceConfig
+ {"refresh_igd_ld_lanethernetinterfaceconfig", cpe_refresh_igd_ld_lanethernetinterfaceconfig},
+
+ //InternetGatewayDevice.LANDevice.WLANConfiguration
+ {"refresh_igd_ld_wlanconfiguration", cpe_refresh_igd_ld_wlanconfiguration},
+
+ {"get_igd_ld_wc_ssid", cpe_get_igd_ld_wc_ssid},
+
+ //InternetGatewayDevice.LANDevice.WLANConfiguration.WEPKey
+ {"refresh_igd_ld_wc_wepkey", cpe_refresh_igd_ld_wc_wepkey},
+
+ //InternetGatewayDevice.LANDevice.WLANConfiguration.PreSharedKey
+ {"refresh_igd_ld_wc_presharekey", cpe_refresh_igd_ld_wc_presharekey},
+};
+
+int get_index_after_paramname(parameter_node_t * param, const char * tag_name)
+{
+ parameter_node_t * parent;
+ parameter_node_t * tmp;
+ for(parent=param->parent, tmp = param; parent; tmp = parent, parent = parent->parent)
+ {
+ if(TRstrcmp(parent->name, tag_name) == 0)
+ {
+ if(is_digit(tmp->name) == 0)
+ {
+ return TRatoi(tmp->name);
+ }
+ }
+ }
+ return -1;
+}
+
+
+void cwmp_model_load(cwmp_t * cwmp, const char * xmlfile)
+{
+
+ cwmp_model_load_xml(cwmp, xmlfile, ModelFunction, sizeof(ModelFunction)/sizeof(model_func_t));
+}
+
+
diff --git a/ap/app/cwmp/netcwmp/cwmpd/src/modules/data_model.h b/ap/app/cwmp/netcwmp/cwmpd/src/modules/data_model.h
new file mode 100755
index 0000000..3077ba6
--- /dev/null
+++ b/ap/app/cwmp/netcwmp/cwmpd/src/modules/data_model.h
@@ -0,0 +1,9 @@
+#ifndef __CWMP_DATA_MODEL_H__
+#define __CWMP_DATA_MODEL_H__
+
+#include <cwmp/cwmp.h>
+
+int get_index_after_paramname(parameter_node_t * param, const char * tag_name);
+void cwmp_model_load(cwmp_t * cwmp, const char * xmlfile);
+
+#endif
diff --git a/ap/app/cwmp/netcwmp/cwmpd/src/process.c b/ap/app/cwmp/netcwmp/cwmpd/src/process.c
new file mode 100755
index 0000000..2b1b880
--- /dev/null
+++ b/ap/app/cwmp/netcwmp/cwmpd/src/process.c
@@ -0,0 +1,43 @@
+/************************************************************************
+ * *
+ * Netcwmp/Opencwmp Project *
+ * A software client for enabling TR-069 in embedded devices (CPE). *
+ * *
+ * Copyright (C) 2013-2014 netcwmp.netcwmp group *
+ * *
+ * This program is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU General Public License *
+ * as published by the Free Software Foundation; either version 2 *
+ * of the License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the *
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330, *
+ * Boston, MA 02111-1307 USA *
+ * *
+ * Copyright 2013-2014 Mr.x(Mr.x) <netcwmp@gmail.com> *
+ * *
+ ***********************************************************************/
+
+#include "cwmp_module.h"
+#include "cwmp_process.h"
+//#include "cwmp_thread.h"
+
+
+
+
+
+void cwmp_process_start_master(cwmp_t * cwmp)
+{
+ cwmp_worker_thread_start(cwmp);
+}
+
+
+
+
+
diff --git a/ap/app/cwmp/netcwmp/cwmpd/src/thread.c b/ap/app/cwmp/netcwmp/cwmpd/src/thread.c
new file mode 100755
index 0000000..d027dd1
--- /dev/null
+++ b/ap/app/cwmp/netcwmp/cwmpd/src/thread.c
@@ -0,0 +1,125 @@
+/************************************************************************
+ * *
+ * Netcwmp/Opencwmp Project *
+ * A software client for enabling TR-069 in embedded devices (CPE). *
+ * *
+ * Copyright (C) 2013-2014 netcwmp.netcwmp group *
+ * *
+ * This program is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU General Public License *
+ * as published by the Free Software Foundation; either version 2 *
+ * of the License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the *
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330, *
+ * Boston, MA 02111-1307 USA *
+ * *
+ * Copyright 2013-2014 Mr.x(Mr.x) <netcwmp@gmail.com> *
+ * *
+ ***********************************************************************/
+
+#include "cwmp_module.h"
+#include "cwmp_thread.h"
+#include "cwmp_httpd.h"
+
+
+static int cwmp_max_threads;
+
+static int cwmp_worker_threaded;
+
+
+#ifdef WIN32
+#else
+static pthread_attr_t cwmp_worker_thread_attr;
+
+int
+cwmp_worker_thread_init(cwmp_t * cwmp, int num, size_t size)
+{
+ int err;
+
+ cwmp_max_threads = num;
+
+ err = pthread_attr_init(&cwmp_worker_thread_attr);
+
+ if (err != 0)
+ {
+ cwmp_log_error("pthread_attr_init() failed");
+ return CWMP_ERROR;
+ }
+
+ err = pthread_attr_setstacksize(&cwmp_worker_thread_attr, size);
+
+ if (err != 0)
+ {
+ cwmp_log_error("pthread_attr_setstacksize() failed");
+
+ return CWMP_ERROR;
+ }
+
+ cwmp_worker_threaded = 1;
+
+ return CWMP_OK;
+}
+#endif
+
+
+
+
+static void * cwmp_worker_thread_agent(cwmp_t * cwmp)
+{
+ cwmp_agent_session(cwmp);
+ return NULL;
+}
+
+
+static void * cwmp_worker_thread_udpd(cwmp_t * cwmp)
+{
+
+ return NULL;
+}
+
+#ifdef WIN32
+static unsigned int __stdcall cwmp_worker_thread_httpd(cwmp_t * cwmp)
+#else
+static unsigned int cwmp_worker_thread_httpd(cwmp_t * cwmp)
+#endif
+{
+ return httpd_build_server(cwmp);
+}
+
+#ifdef WIN32
+static unsigned int __stdcall cwmp_worker_thread_tasks(cwmp_t * cwmp)
+#else
+static unsigned int cwmp_worker_thread_tasks(cwmp_t * cwmp)
+#endif
+{
+ //tasks_build_server(cwmp);
+ pthread_exit(0);
+ return 0;
+}
+
+
+
+
+void cwmp_worker_thread_start(cwmp_t * cwmp)
+{
+#ifdef WIN32
+ unsigned tid1, tid2;
+ CreateThread(NULL, 0, cwmp_worker_thread_httpd, cwmp, 0, &tid1);
+// CreateThread(NULL, 0, cwmp_worker_thread_tasks, cwmp, 0, &tid2);
+#else
+ pthread_t th1, th2, th3;
+ pthread_create(&th1, NULL, (void*)cwmp_worker_thread_httpd, cwmp);
+// pthread_create(&th2, NULL, (void*)cwmp_worker_thread_tasks, cwmp);
+
+#endif
+ cwmp_agent_session(cwmp);
+
+}
+