Exemple #1
0
void test_ModifyResponse()
{
	/// Building a ModifyResponse ///

	DNDSMessage_t *msg;	// a DNDS Message

	DNDSMessage_new(&msg);
	DNDSMessage_set_channel(msg, 0);
	DNDSMessage_set_pdu(msg, pdu_PR_dsm);

	DSMessage_set_seqNumber(msg, 0);
	DSMessage_set_ackNumber(msg, 300);
	DSMessage_set_operation(msg, dsop_PR_modifyResponse);

	ModifyResponse_set_result(msg, DNDSResult_success);

	/// Encoding part

	asn_enc_rval_t ec;	// Encoder return value
	FILE *fp = fopen("dnds.ber", "wb"); // BER output
	ec = der_encode(&asn_DEF_DNDSMessage, msg, write_out, fp);
	fclose(fp);

	xer_fprint(stdout, &asn_DEF_DNDSMessage, msg);

	DNDSMessage_del(msg);
}
Exemple #2
0
void test_DelRequest()
{
#if 0
	/// Building a DelRequest ///

	DNDSMessage_t *msg;	// a DNDS Message
	DNDSObject_t *objAcl;	// a DNDS Object

	DNDSMessage_new(&msg);
	DNDSMessage_set_channel(msg, 0);
	DNDSMessage_set_pdu(msg, pdu_PR_dsm);	// Directory Service Message

	DSMessage_set_seqNumber(msg, 200);
	DSMessage_set_ackNumber(msg, 0);
	DSMessage_set_operation(msg, dsop_PR_delRequest);

	DelRequest_set_objectType(msg, DNDSObject_PR_acl, &objAcl);

	Acl_set_id(objAcl, 1);
	Acl_set_contextId(objAcl, 2);
	Acl_set_description(objAcl, "une description", 15);

	/// Encoding part

	asn_enc_rval_t ec;	// Encoder return value
	FILE *fp = fopen("dnds.ber", "wb"); // BER output
	ec = der_encode(&asn_DEF_DNDSMessage, msg, write_out, fp);
	fclose(fp);

	xer_fprint(stdout, &asn_DEF_DNDSMessage, msg);

	DNDSMessage_del(msg);
#endif
}
Exemple #3
0
void test_ModifyRequest()
{
#if 0
	/// Building a ModifyRequest ///

	DNDSMessage_t *msg;		// a DNDS Message
	DNDSObject_t *objAclGroup;

	DNDSMessage_new(&msg);
	DNDSMessage_set_channel(msg, 0);
	DNDSMessage_set_pdu(msg, pdu_PR_dsm);

	DSMessage_set_seqNumber(msg, 300);
	DSMessage_set_ackNumber(msg, 0);
	DSMessage_set_operation(msg, dsop_PR_modifyRequest);

	ModifyRequest_set_objectType(msg, DNDSObject_PR_aclgroup, &objAclGroup);

	AclGroup_set_id(objAclGroup, 1);
	AclGroup_set_contextId(objAclGroup, 1);
	AclGroup_set_name(objAclGroup, "group-name", 10);
	AclGroup_set_description(objAclGroup, "a description", 13);

	/// Encoding part

	asn_enc_rval_t ec;	// Encoder return value
	FILE *fp = fopen("dnds.ber", "wb"); // BER output
	ec = der_encode(&asn_DEF_DNDSMessage, msg, write_out, fp);
	fclose(fp);

	xer_fprint(stdout, &asn_DEF_DNDSMessage, msg);

	DNDSMessage_del(msg);
#endif
}
Exemple #4
0
void test_NodeConnectInfo()
{
	/// Building a NodeConnectInfo ///
	int ret;

	DNDSMessage_t *msg;

	DNDSMessage_new(&msg);
	DNDSMessage_set_channel(msg, 0);
	DNDSMessage_set_pdu(msg, pdu_PR_dsm);	// Directory Service Message

	DSMessage_set_seqNumber(msg, 800);
	DSMessage_set_ackNumber(msg, 0);
	//DSMessage_set_operation(msg, dsop_PR_nodeConnectInfo);

	//NodeConnectInfo_set_certName(msg, "unique_name@context", 19);
	//NodeConnectInfo_set_ipAddr(msg, "44.128.0.1");
	//NodeConnectInfo_set_state(msg, ConnectState_connected);

	/// Encoding part

	asn_enc_rval_t ec;	// Encoder return value
	FILE *fp = fopen("dnds.ber", "wb"); // BER output
	ec = der_encode(&asn_DEF_DNDSMessage, msg, write_out, fp);
	fclose(fp);

	xer_fprint(stdout, &asn_DEF_DNDSMessage, msg);

	DNDSMessage_del(msg);
}
Exemple #5
0
void test_AuthRequest()
{
	/// Building an AuthRequest ///

	DNDSMessage_t *msg;	// a DNDS Message

	DNDSMessage_new(&msg);
	DNDSMessage_set_channel(msg, 0);
	DNDSMessage_set_pdu(msg, pdu_PR_dsm);	// Directory Service Message

	DSMessage_set_seqNumber(msg, 100);
	DSMessage_set_ackNumber(msg, 0);
	DSMessage_set_operation(msg, dnop_PR_authRequest);

	AuthRequest_set_certName(msg, "nib@1", 5);

	/// Encoding part

	asn_enc_rval_t ec;	// Encoder return value
	FILE *fp = fopen("dnds.ber", "wb"); // BER output
	ec = der_encode(&asn_DEF_DNDSMessage, msg, write_out, fp);
	fclose(fp);

	xer_fprint(stdout, &asn_DEF_DNDSMessage, msg);

	DNDSMessage_del(msg);
}
Exemple #6
0
test_AddRequest_context()
{
	/// Building context AddRequest ///

	DNDSMessage_t *msg;
	DNDSObject_t *obj;

	DNDSMessage_new(&msg);
	DNDSMessage_set_channel(msg, 0);
	DNDSMessage_set_pdu(msg, pdu_PR_dsm);

	DSMessage_set_seqNumber(msg, 0);
	DSMessage_set_ackNumber(msg, 0);
	DSMessage_set_operation(msg, dsop_PR_addRequest);

	AddRequest_set_objectType(msg, DNDSObject_PR_context, &obj);

	Context_set_clientId(obj, 100);
	Context_set_description(obj, "home network1", 13);
	Context_set_network(obj, "44.128.0.0");
	Context_set_netmask(obj, "255.255.255.0");

	/// Encoding part

	asn_enc_rval_t ec;	// Encoder return value
	FILE *fp = fopen("dnds.ber", "wb"); // BER output
	ec = der_encode(&asn_DEF_DNDSMessage, msg, write_out, fp);
	fclose(fp);

	xer_fprint(stdout, &asn_DEF_DNDSMessage, msg);

	DNDSMessage_del(msg);
}
Exemple #7
0
void test_SearchRequest_context()
{
	/// Building a SearchRequest context ///
	int ret;

	DNDSMessage_t *msg;	// a DNDS Message

	DNDSMessage_new(&msg);
	DNDSMessage_set_channel(msg, 0);
	DNDSMessage_set_pdu(msg, pdu_PR_dsm);	// Directory Service Message

	DSMessage_set_seqNumber(msg, 800);
	DSMessage_set_ackNumber(msg, 0);
	DSMessage_set_operation(msg, dsop_PR_searchRequest);

	SearchRequest_set_searchType(msg, SearchType_all);
	SearchRequest_set_objectName(msg, ObjectName_context);

	/// Encoding part

	asn_enc_rval_t ec;	// Encoder return value
	FILE *fp = fopen("dnds.ber", "wb"); // BER output
	ec = der_encode(&asn_DEF_DNDSMessage, msg, write_out, fp);
	fclose(fp);

	xer_fprint(stdout, &asn_DEF_DNDSMessage, msg);

	DNDSMessage_del(msg);

}
Exemple #8
0
void test_TerminateRequest()
{
	/// Building a TerminateRequest ///

	DNDSMessage_t *msg;	// a DNDS Message

	DNDSMessage_new(&msg);
	DNDSMessage_set_channel(msg, 0);
	DNDSMessage_set_pdu(msg, pdu_PR_dsm);

	DSMessage_set_seqNumber(msg, 0);
	DSMessage_set_ackNumber(msg, 400);
	DSMessage_set_operation(msg, dsop_PR_terminateRequest);

	/// Encoding part

	asn_enc_rval_t ec;	// Encoder return value
	FILE *fp = fopen("dnds.ber", "wb"); // BER output
	ec = der_encode(&asn_DEF_DNDSMessage, msg, write_out, fp);
	fclose(fp);

	xer_fprint(stdout, &asn_DEF_DNDSMessage, msg);

	DNDSMessage_del(msg);
}
Exemple #9
0
test_AddRequest_node()
{
	/// Building node AddRequest ///

	DNDSMessage_t *msg;
	DNDSObject_t *obj;

	DNDSMessage_new(&msg);
	DNDSMessage_set_channel(msg, 0);
	DNDSMessage_set_pdu(msg, pdu_PR_dsm);

	DSMessage_set_seqNumber(msg, 0);
	DSMessage_set_ackNumber(msg, 0);
	DSMessage_set_operation(msg, dsop_PR_addRequest);

	AddRequest_set_objectType(msg, DNDSObject_PR_node, &obj);

	Node_set_contextId(obj, 100);
	Node_set_description(obj, "voip node 1", 11);

	/// Encoding part

	asn_enc_rval_t ec;	// Encoder return value
	FILE *fp = fopen("dnds.ber", "wb"); // BER output
	ec = der_encode(&asn_DEF_DNDSMessage, msg, write_out, fp);
	fclose(fp);

	xer_fprint(stdout, &asn_DEF_DNDSMessage, msg);

	DNDSMessage_del(msg);
}
Exemple #10
0
void test_SearchResponse()
{

	printf("TEST SEARCH RESPONSE\n");

	/// Building a SearchResponse

	DNDSMessage_t *msg;	// A DNDS Message

	DNDSMessage_new(&msg);
	DNDSMessage_set_channel(msg, 0);
	DNDSMessage_set_pdu(msg, pdu_PR_dsm);

	DSMessage_set_seqNumber(msg, 0);
	DSMessage_set_ackNumber(msg, 1);
	DSMessage_set_action(msg, action_listNode);
	DSMessage_set_operation(msg, dsop_PR_searchResponse);

	SearchResponse_set_result(msg, DNDSResult_success);
	SearchResponse_set_searchType(msg, SearchType_object);
/*
/// objContext
	DNDSObject_t *objContext;
	DNDSObject_new(&objContext);
	DNDSObject_set_objectType(objContext, DNDSObject_PR_context);

	Context_set_id(objContext, 40);
	SearchResponse_add_object(msg, objContext);
*/
/// Node
	DNDSObject_t *objNode;
	DNDSObject_new(&objNode);
	DNDSObject_set_objectType(objNode, DNDSObject_PR_node);

//	Node_set_contextId(objNode, 10);
	Node_set_description(objNode, "yo", strlen("yo"));
	Node_set_uuid(objNode, "abc", strlen("abc"));
	Node_set_certificate(objNode, "certificate", 11);
	Node_set_certificateKey(objNode, "key", 3);
	Node_set_status(objNode, 2);

	SearchResponse_add_object(msg, objNode);


	/// Encoding part

	asn_enc_rval_t ec;	// Encoder return value
	FILE *fp = fopen("dnds.ber", "wb"); // BER output
	ec = der_encode(&asn_DEF_DNDSMessage, msg, write_out, fp);
	fclose(fp);

	xer_fprint(stdout, &asn_DEF_DNDSMessage, msg);

	DNDSMessage_del(msg);
}
Exemple #11
0
void test_SearchResponse_context()
{
	/// Building a SearchResponse

	DNDSMessage_t *msg;	// A DNDS Message

	DNDSMessage_new(&msg);
	DNDSMessage_set_channel(msg, 0);
	DNDSMessage_set_pdu(msg, pdu_PR_dsm);

	DSMessage_set_seqNumber(msg, 0);
	DSMessage_set_ackNumber(msg, 400);
	DSMessage_set_operation(msg, dsop_PR_searchResponse);

	SearchResponse_set_result(msg, DNDSResult_success);

	DNDSObject_t *objContext;
	DNDSObject_new(&objContext);
	DNDSObject_set_objectType(objContext, DNDSObject_PR_context);

	Context_set_id(objContext, 10);
	Context_set_topology(objContext, Topology_mesh);
	Context_set_description(objContext, "home network", 12);
	Context_set_network(objContext, "44.128.0.0");
	Context_set_netmask(objContext, "255.255.0.0");
	Context_set_serverCert(objContext, "serverCert", 10);
	Context_set_serverPrivkey(objContext, "serverPrivkey", 13);
	Context_set_trustedCert(objContext, "trustedCert", 11);

	SearchResponse_add_object(msg, objContext);

	/// Encoding part

	asn_enc_rval_t ec;	// Encoder return value
	FILE *fp = fopen("dnds.ber", "wb"); // BER output
	ec = der_encode(&asn_DEF_DNDSMessage, msg, write_out, fp);
	fclose(fp);

	xer_fprint(stdout, &asn_DEF_DNDSMessage, msg);

	DNDSMessage_del(msg);

}
Exemple #12
0
void test_AddRequest()
{
	/// Building a AddRequest ///

	DNDSMessage_t *msg;		// a DNDS Message
	DNDSObject_t *objClient;	// a DS Object

	DNDSMessage_new(&msg);
	DNDSMessage_set_channel(msg, 0);
	DNDSMessage_set_pdu(msg, pdu_PR_dsm);	// Directory Service Message

	DSMessage_set_seqNumber(msg, 4034);
	DSMessage_set_ackNumber(msg, 0);	// seq XOR ack
	DSMessage_set_operation(msg, dsop_PR_addRequest);

	AddRequest_set_objectType(msg, DNDSObject_PR_client, &objClient);

	Client_set_id(objClient, 987);
	Client_set_firstname(objClient, "firstname", 9);
	Client_set_lastname(objClient, "lastname", 8);
	Client_set_email(objClient, "*****@*****.**", 15);
	Client_set_password(objClient, "password", 8);
	Client_set_company(objClient, "mycompany", 9);
	Client_set_phone(objClient, "thephone", 8);
	Client_set_country(objClient, "mycountry", 9);
	Client_set_stateProvince(objClient, "stateProvince", 13);
	Client_set_city(objClient, "mycity", 6);
	Client_set_postalCode(objClient, "postalCode", 10);
	Client_set_status(objClient, 0);

	/// Encoding part

	asn_enc_rval_t ec;	// Encoder return value
	FILE *fp = fopen("dnds.ber", "wb"); // BER output
	ec = der_encode(&asn_DEF_DNDSMessage, msg, write_out, fp);
	fclose(fp);

	xer_fprint(stdout, &asn_DEF_DNDSMessage, msg);

	DNDSMessage_del(msg);
}
Exemple #13
0
void test_SearchRequest()
{
	/// Building a SearchRequest()

	DNDSMessage_t *msg;	// a DNDS Message
	DNDSObject_t *objNode; // a DNDS Object

	DNDSMessage_new(&msg);
	DNDSMessage_set_channel(msg, 0);
	DNDSMessage_set_pdu(msg, pdu_PR_dsm);

	DSMessage_set_seqNumber(msg, 400);
	DSMessage_set_ackNumber(msg, 0);
	DSMessage_set_operation(msg, dsop_PR_searchRequest);

	SearchRequest_set_searchType(msg, SearchType_object);


	DNDSObject_new(&objNode);
	DNDSObject_set_objectType(objNode, DNDSObject_PR_node);

	Node_set_contextId(objNode, 0);
	Node_set_provCode(objNode, "secret-prov-code", strlen("secret-prov-code"));
	Node_set_ipAddress(objNode, "127.0.0.1");

	SearchRequest_set_object(msg, objNode);

	/// Encoding part

	asn_enc_rval_t ec;	// Encoder return value
	FILE *fp = fopen("dnds.ber", "wb"); // BER output
	ec = der_encode(&asn_DEF_DNDSMessage, msg, write_out, fp);
	fclose(fp);

	xer_fprint(stdout, &asn_DEF_DNDSMessage, msg);

	DNDSMessage_del(msg);

}
Exemple #14
0
void test_AddRequest()
{
	/// Building a AddRequest ///

	DNDSMessage_t *msg;		// a DNDS Message
	DNDSObject_t *objClient;	// a DS Object

	DNDSMessage_new(&msg);
//	DNDSMessage_set_version(msg, 1);
	DNDSMessage_set_channel(msg, 0);
	DNDSMessage_set_pdu(msg, pdu_PR_dsm);	// Directory Service Message

	DSMessage_set_seqNumber(msg, 1);
	DSMessage_set_ackNumber(msg, 1);	// seq XOR ack
	DSMessage_set_operation(msg, dsop_PR_addRequest);
//	DSMessage_set_action(msg, action_addClient);

	AddRequest_set_objectType(msg, DNDSObject_PR_client, &objClient);

//	Client_set_id(objClient, 987);
	Client_set_email(objClient, "test@test", 9);
	Client_set_password(objClient, "test", 4);
//	Client_set_status(objClient, 0);

	/// Encoding part

	asn_enc_rval_t ec;	// Encoder return value
	FILE *fp = fopen("dnds.ber", "wb"); // BER output
	ec = der_encode(&asn_DEF_DNDSMessage, msg, write_out, fp);
	fclose(fp);

	xer_fprint(stdout, &asn_DEF_DNDSMessage, msg);

	asn_fprint(stdout, &asn_DEF_DNDSMessage, msg);


	DNDSMessage_del(msg);
}
Exemple #15
0
void test_SearchResponse()
{
	/// Building a SearchResponse

	DNDSMessage_t *msg;	// A DNDS Message

	DNDSMessage_new(&msg);
	DNDSMessage_set_channel(msg, 0);
	DNDSMessage_set_pdu(msg, pdu_PR_dsm);

	DSMessage_set_seqNumber(msg, 0);
	DSMessage_set_ackNumber(msg, 400);
	DSMessage_set_operation(msg, dsop_PR_searchResponse);

	SearchResponse_set_result(msg, DNDSResult_success);

/// objContext
	DNDSObject_t *objContext;
	DNDSObject_new(&objContext);
	DNDSObject_set_objectType(objContext, DNDSObject_PR_context);

	Context_set_id(objContext, 40);
	SearchResponse_add_object(msg, objContext);

/// Node
	DNDSObject_t *objNode;
	DNDSObject_new(&objNode);
	DNDSObject_set_objectType(objNode, DNDSObject_PR_node);

	Node_set_contextId(objNode, 10);
	Node_set_certificate(objNode, "certificate", 11);
	Node_set_certificateKey(objNode, "key", 3);
	Node_set_status(objNode, 2);

	SearchResponse_add_object(msg, objNode);
/*
/// User1
	DNDSObject_t *objUser1;	// A User Object
	DNDSObject_new(&objUser1);
	DNDSObject_set_objectType(objUser1, DNDSObject_PR_user);

	User_set_id(objUser1, 1);
	User_set_contextId(objUser1, 1);
	User_set_name(objUser1, "1icboul", 7);
	User_set_password(objUser1, "1wd1wd", 6);
	User_set_firstname(objUser1, "1icolas", 7);
	User_set_lastname(objUser1, "1ouliane", 8);
	User_set_email(objUser1, "*****@*****.**", 15);
	User_set_role(objUser1, 0);
	User_set_status(objUser1, 0);

	SearchResponse_add_object(msg, objUser1);

/// User2
	DNDSObject_t *objUser2;	// A User Object
	DNDSObject_new(&objUser2);
	DNDSObject_set_objectType(objUser2, DNDSObject_PR_user);

	User_set_id(objUser2, 2);
	User_set_contextId(objUser2, 2);
	User_set_name(objUser2, "2icboul", 6);
	User_set_password(objUser2, "2wd2wd", 6);
	User_set_firstname(objUser2, "2icolas", 7);
	User_set_lastname(objUser2, "2ouliane", 8);
	User_set_email(objUser2, "*****@*****.**", 15);
	User_set_role(objUser2, 0);
	User_set_status(objUser2, 0);

	SearchResponse_add_object(msg, objUser2);
*/
	/// Encoding part

	asn_enc_rval_t ec;	// Encoder return value
	FILE *fp = fopen("dnds.ber", "wb"); // BER output
	ec = der_encode(&asn_DEF_DNDSMessage, msg, write_out, fp);
	fclose(fp);

	xer_fprint(stdout, &asn_DEF_DNDSMessage, msg);

	DNDSMessage_del(msg);
}