Updated API for uiplib and resolv to use uip_ipaddr_t instead of uint16_t for compability with IPv6
This commit is contained in:
parent
c13bb8666b
commit
b54c6e673b
22 changed files with 194 additions and 106 deletions
|
@ -29,7 +29,7 @@
|
|||
*
|
||||
* This file is part of the Contiki desktop environment for the C64.
|
||||
*
|
||||
* $Id: email.c,v 1.7 2010/01/31 21:44:49 oliverschmidt Exp $
|
||||
* $Id: email.c,v 1.8 2010/05/31 15:22:08 nifi Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -182,15 +182,16 @@ email_quit(void)
|
|||
static void
|
||||
applyconfig(void)
|
||||
{
|
||||
u16_t addr[2], *addrptr;
|
||||
uip_ipaddr_t addr;
|
||||
uip_ipaddr_t *addrptr;
|
||||
char *cptr;
|
||||
|
||||
for(cptr = smtpserver; *cptr != ' ' && *cptr != 0; ++cptr);
|
||||
*cptr = 0;
|
||||
|
||||
addrptr = &addr[0];
|
||||
addrptr = &addr;
|
||||
#if UIP_UDP
|
||||
if(uiplib_ipaddrconv(smtpserver, (unsigned char *)addr) == 0) {
|
||||
if(uiplib_ipaddrconv(smtpserver, &addr) == 0) {
|
||||
addrptr = resolv_lookup(smtpserver);
|
||||
if(addrptr == NULL) {
|
||||
resolv_query(smtpserver);
|
||||
|
@ -199,7 +200,7 @@ applyconfig(void)
|
|||
}
|
||||
}
|
||||
#else /* UIP_UDP */
|
||||
uiplib_ipaddrconv(smtpserver, (unsigned char *)addr);
|
||||
uiplib_ipaddrconv(smtpserver, &addr);
|
||||
#endif /* UIP_UDP */
|
||||
smtp_configure("contiki", addrptr);
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
* $Id: smtp-socket.c,v 1.3 2007/11/18 01:00:50 oliverschmidt Exp $
|
||||
* $Id: smtp-socket.c,v 1.4 2010/05/31 15:22:08 nifi Exp $
|
||||
*/
|
||||
#include "smtp.h"
|
||||
|
||||
|
@ -60,7 +60,7 @@ struct smtp_state {
|
|||
static struct smtp_state s;
|
||||
|
||||
static char *localhostname;
|
||||
static u16_t smtpserver[2];
|
||||
static uip_ipaddr_t smtpserver;
|
||||
|
||||
#define ISO_nl 0x0a
|
||||
#define ISO_cr 0x0d
|
||||
|
@ -201,11 +201,10 @@ smtp_appcall(void *state)
|
|||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
smtp_configure(char *lhostname, u16_t *server)
|
||||
smtp_configure(char *lhostname, uip_ipaddr_t *server)
|
||||
{
|
||||
localhostname = lhostname;
|
||||
smtpserver[0] = server[0];
|
||||
smtpserver[1] = server[1];
|
||||
uip_ipaddr_copy(&smtpserver, server);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
unsigned char
|
||||
|
@ -214,7 +213,7 @@ smtp_send(char *to, char *cc, char *from, char *subject,
|
|||
{
|
||||
struct uip_conn *conn;
|
||||
|
||||
conn = tcp_connect((uip_ipaddr_t *)smtpserver, HTONS(25), NULL);
|
||||
conn = tcp_connect(&smtpserver, HTONS(25), NULL);
|
||||
if(conn == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
*
|
||||
* This file is part of the uIP TCP/IP stack.
|
||||
*
|
||||
* $Id: smtp.h,v 1.2 2006/08/21 21:31:34 oliverschmidt Exp $
|
||||
* $Id: smtp.h,v 1.3 2010/05/31 15:22:08 nifi Exp $
|
||||
*
|
||||
*/
|
||||
#ifndef __SMTP_H__
|
||||
|
@ -41,7 +41,7 @@
|
|||
void smtp_done(unsigned char error);
|
||||
|
||||
/* Functions. */
|
||||
void smtp_configure(char *localhostname, u16_t *smtpserver);
|
||||
void smtp_configure(char *localhostname, uip_ipaddr_t *smtpserver);
|
||||
|
||||
unsigned char smtp_send(char *to, char *cc, char *from,
|
||||
char *subject, char *msg,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue