Commit 6a6e0249 authored by garciay's avatar garciay
Browse files

STF538: Certificate TPs implementation

parent f2e7dfca
Loading
Loading
Loading
Loading
+61 −61
Original line number Original line Diff line number Diff line
@@ -176,65 +176,65 @@ int asn1c_ber2per(asn_TYPE_descriptor_t &td, const TTCN_Buffer & ber, TTCN_Buffe
}
}


// OER Encoding
// OER Encoding
#include <xer_decoder.h>
//#include <xer_decoder.h>
#include <xer_encoder.h>
//#include <xer_encoder.h>
#include <oer_decoder.h>
//#include <oer_decoder.h>
#include <oer_encoder.h>
//#include <oer_encoder.h>

//
int asn1c_oer2xer(asn_TYPE_descriptor_t &td, const TTCN_Buffer & oer, TTCN_Buffer & xer, void** ctx )
//int asn1c_oer2xer(asn_TYPE_descriptor_t &td, const TTCN_Buffer & oer, TTCN_Buffer & xer, void** ctx )
{
//{
	//void** obj = ctx;
//	//void** obj = ctx;
	int rc = -1;
//	int rc = -1;
	asn_dec_rval_t rc_d;
//	asn_dec_rval_t rc_d;

//
	rc_d = oer_decode(NULL, 
//	rc_d = oer_decode(NULL,
                    &td, ctx, 
//                    &td, ctx,
                    oer.get_read_data(), oer.get_read_len());
//                    oer.get_read_data(), oer.get_read_len());
  
//
	if(rc_d.code == RC_OK){
//	if(rc_d.code == RC_OK){
		asn_enc_rval_t rc_e;
//		asn_enc_rval_t rc_e;
		xer.clear();
//		xer.clear();
		rc_e = xer_encode(&td,
//		rc_e = xer_encode(&td,
                      (const asn_oer_constraints_t*)ctx,
//                      (const asn_oer_constraints_t*)ctx,
                      XER_F_BASIC,
//                      XER_F_BASIC,
                      asn1c_collect_encoded_data,
//                      asn1c_collect_encoded_data,
                      &xer);
//                      &xer);
		rc = rc_e.encoded;
//		rc = rc_e.encoded;
	}
//	}
	/*if(obj) {
//	/*if(obj) {
		ASN_STRUCT_FREE(td, obj);
//		ASN_STRUCT_FREE(td, obj);
    }*/
//    }*/
	return rc;
//	return rc;
}
//}

//

//
int asn1c_xer2oer(asn_TYPE_descriptor_t &td, const TTCN_Buffer & xer, TTCN_Buffer & oer, void** ctx )
//int asn1c_xer2oer(asn_TYPE_descriptor_t &td, const TTCN_Buffer & xer, TTCN_Buffer & oer, void** ctx )
{
//{
	//void** obj = ctx;
//	//void** obj = ctx;
	int rc = -1;
//	int rc = -1;
	asn_dec_rval_t rc_d;
//	asn_dec_rval_t rc_d;
	rc_d = xer_decode( NULL, &td,
//	rc_d = xer_decode( NULL, &td,
                     ctx,
//                     ctx,
                     xer.get_data(), xer.get_len());
//                     xer.get_data(), xer.get_len());
	if(rc_d.code == RC_OK){
//	if(rc_d.code == RC_OK){
    loggers::get_instance().log("asn1c_ber2per: XER decoding succeed");
//    loggers::get_instance().log("asn1c_ber2per: XER decoding succeed");
		asn_enc_rval_t rc_e;
//		asn_enc_rval_t rc_e;
		//per.clear();
//		//per.clear();
		rc_e = oer_encode(&td,
//		rc_e = oer_encode(&td,
                       ctx, 
//                       ctx,
                       asn1c_collect_encoded_data,
//                       asn1c_collect_encoded_data,
                       &oer);
//                       &oer);
		rc = rc_e.encoded;
//		rc = rc_e.encoded;
    if(rc < 0) {
//    if(rc < 0) {
      loggers::get_instance().warning("asn1c_ber2per: OER encoding failed");
//      loggers::get_instance().warning("asn1c_ber2per: OER encoding failed");
    }
//    }
	} else {
//	} else {
    loggers::get_instance().warning("asn1c_ber2per: XER decoding failed");
//    loggers::get_instance().warning("asn1c_ber2per: XER decoding failed");
    //    td.free_struct(&td, *ctx, 0);
//    //    td.free_struct(&td, *ctx, 0);
  }
//  }
	/*if(obj) {
//	/*if(obj) {
		ASN_STRUCT_FREE(td, obj);
//		ASN_STRUCT_FREE(td, obj);
    }*/
//    }*/
	return rc;
//	return rc;
}
//}
+6 −7
Original line number Original line Diff line number Diff line
@@ -2,19 +2,18 @@


#include <sys/types.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/socket.h>
#if (OSTYPE == linux)
#if (OSTYPE == cygwin)
#include <netinet/ether.h> // Used for raw sockets
#include <netdb.h>
#include <w32api/winsock2.h>
#else
#else
#include <netinet/ether.h> // Used for raw sockets
#include <net/ethernet.h> // Used for raw sockets
#include <linux/if_packet.h> // Used for raw sockets
#endif
#endif
#include <netinet/in.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <arpa/inet.h>
#include <net/if.h> // Used for raw sockets
#include <net/if.h> // Used for raw sockets
#if (OSTYPE == linux)
#include <net/ethernet.h> // Used for raw sockets
#include <linux/if_packet.h> // Used for raw sockets
#else
#endif


#include "TLayer.hh"
#include "TLayer.hh"
#include "Params.hh"
#include "Params.hh"
+26 −0
Original line number Original line Diff line number Diff line
@@ -2,8 +2,34 @@
#define UDP_LAYER_H
#define UDP_LAYER_H


#include <arpa/inet.h>
#include <arpa/inet.h>
#if (OSTYPE == cygwin)
#include <netdb.h>
#include <w32api/winsock2.h>
/*struct iphdr {
    #if defined(__LITTLE_ENDIAN_BITFIELD)
        u_char    ihl:4,
                version:4;
    #elif defined (__BIG_ENDIAN_BITFIELD)
        u_char    version:4,
                ihl:4;
    #else
        #error  "Please fix <asm/byteorder.h>"
    #endif
        u_char   tos;
        u_short  tot_len;
        u_short  id;
        u_short  frag_off;
         u_char   ttl;
         u_char   protocol;
         u_short  check;
         u_int  saddr;
         u_int  daddr;
         /*The options start here. */
};*/
#else
#include <linux/ip.h>
#include <linux/ip.h>
#include <linux/udp.h>
#include <linux/udp.h>
#endif


#include "TLayer.hh"
#include "TLayer.hh"
#include "Params.hh"
#include "Params.hh"