示例#1
0
/**
 * Transmit APRS log packet
 */
uint32_t aprs_encode_log(uint8_t* message, mod_t mod)
{
	ax25_t packet;
	packet.data = message;
	packet.max_size = 512; // TODO: replace 512 with real size
	packet.mod = mod;

	// Encode APRS header
	ax25_send_header(&packet, APRS_CALLSIGN, APRS_SSID, APRS_PATH);
	ax25_send_string(&packet, "{{L");

	// Encode log message
	uint8_t i;
	for(i=0; i<LOG_TRX_NUM; i++) {
		gpsFix_t dummy;
		gpsFix_t *data = &dummy; // TODO: Implement getNextLogPoint() for this assignment
		uint8_t base64[BASE64LEN(sizeof(gpsFix_t))+1];
		base64_encode((uint8_t*)data, base64, sizeof(gpsFix_t));
		ax25_send_string(&packet, (char*)base64);
	}

	// Send footer
	ax25_send_footer(&packet);
	nrzi_encode(&packet);
	scramble(&packet);

	return packet.size;
}
_LIT8(KPlainMechanism, "PLAIN "); //Space intentional, may find a better way of doing this.
_LIT8(KSmtpAuthLoginCommand, "AUTH LOGIN\r\n");
_LIT8(KCramMD5Mechanism, "CRAM-MD5");

_LIT8(KSmtpAuthBase64StringUsername,"username*"); // To match a folded 'username:'******'username'
_LIT8(KSmtpAuthBase64StringPassword,"password*"); // To match a folded 'password:'******'password'

const TInt KMaxLengthOfPlainMessageComponent = 255;
const TInt KMd5BlockLength = 64;

#define BASE64LEN(x) ((x*4)/3) // Every 3 bytes will be turned into 4 bytes

const TInt KPreambleLength = 18; //"AUTH LOGIN\r\nPLAIN "
const TInt KMaxLengthOfPlainMessage=	KPreambleLength + 1/*NUL*/ + KMaxLengthOfPlainMessageComponent/*Username*/ + 1/*NUL*/ + KMaxLengthOfPlainMessageComponent/*Password*/ + 2/* /r/n */;
const TInt KMaxLengthOfPlainMessageBase64= BASE64LEN(KMaxLengthOfPlainMessage);



//
//CSmtpAuthMechanismHelper
//

CSmtpAuthMechanismHelper::CSmtpAuthMechanismHelper(const CSmtpSettings& aSettings) : iSettings(aSettings)
	{
	}
	
//
//CSmtpAuthPlainMechanismHelper
//