Ejemplo n.º 1
0
/** \brief Initializes BOOTP client
 * 	\author
 *		\li Jari Lahti ([email protected])
 *	\date 19.07.2002
 *	\return
 *		\li	-1 - Error during initialization
 *		\li >=0 - OK
 *
 *	Invoke this function to initialize BOOTP client. This will also trigger
 *	BOOTP address-fetching procedure.
 *
 */
INT8 bootpc_init (UINT8 mode)
{
	/* Already initialized?	*/

	if(bootp_app_init)
		return(1);

	/* Get socket handle		*/

	bootp.sochandle = udp_getsocket(0, bootpc_eventlistener, UDP_OPT_SEND_CS | UDP_OPT_CHECK_CS);

	if(bootp.sochandle < 0)
		return(-1);

	/* Put it to listening mode	*/

	if( udp_open(bootp.sochandle, BOOTP_CLIENTPORT) < 0 )
		return(-1);

	/* Get timer handle			*/

	bootp.tmrhandle = get_timer();
	bootp.bootsecs = 0;
	bootp.mode = mode;

	bootp.state = BOOTPC_STATE_DISABLED;


	bootp_app_init = 1;

	return(1);

}
Ejemplo n.º 2
0
void UDP_Init (void)
{
	DEBUGOUT("Initializing UDP Echo client\r\n");

	udp_soch = udp_getsocket(0 , UPD_PanelEventlistener , UDP_OPT_SEND_CS | UDP_OPT_CHECK_CS);
	
	if(udp_soch == -1)
	    {
		DEBUGOUT("No free UDP sockets!! \r\n");
		RESET_SYSTEM();
	    }
	
	/* open socket */
	(void)udp_open(udp_soch, UDP_AK_PORT);
}
Ejemplo n.º 3
0
void UDP_Init (void)
{
	DEBUGOUT("Initializing UDP Echo client\r\n");



  eeprom_read_buffer(EE_ADDR_UDPTRACE_IP, (UINT8 *)&udp_ipaddr, 4);
	//udp_ipaddr = localmachine.defgw;
  udp_port= 5001;
  //udp_ipaddr = 0xC0A80105; //192.168.1.5
	udp_soch = udp_getsocket(0 , UPD_PanelEventlistener , UDP_OPT_SEND_CS | UDP_OPT_CHECK_CS);
	
	if(udp_soch == -1)
	    {
		DEBUGOUT("No free UDP sockets!! \r\n");
		RESET_SYSTEM();
	    }
	
	/* open socket */
	(void)udp_open(udp_soch, UDP_AK_PORT);
}
Ejemplo n.º 4
0
/* Initialize resources needed for the UDP socket application */
void udp_demo_init(void){

	DEBUGOUT("Initializing UDP demo client\r\n");
	
	/* Get socket:
	 * 	0 - for now not type of service implemented in UDP
	 * 	udp_echo_eventlistener - pointer to listener function
	 *	UDP_OPT_SEND_CS|UDP_OPT_CHECK_CS - checksum options. Calculate
	 *		checksum for outgoing packets and check checksum for
	 *		received packets.
	 */
	udp_demo_soch=udp_getsocket(0 , udp_demo_eventlistener , UDP_OPT_SEND_CS | UDP_OPT_CHECK_CS);
	
	if(udp_demo_soch == -1){
		DEBUGOUT("No free UDP sockets!! \r\n");
		RESET_SYSTEM();
	}
	
	/* open socket for receiving/sending of the data on defined port*/
	udp_open(udp_demo_soch,UDP_DEMO_PORT);
	
	/* for now no data sending */
	udp_demo_senddata=0;
}