void test_OBEX_Connect_header_gen(void)
{
	u_int32 tid;
	u_int8 version;
	u_int8 flags;
	u_int16 max_length;
	u_int16 target_length;
	u_int8* target;
	u_int16 header_length;
	t_DataBuf *databuf;
	int retValue;

  struct host_buf* h_buff;
	void (*callbackfunc)(u_int8 status, t_DataBuf* data)= connectCallbackFn;

  h_buff = host_buf_alloc(100);
	host_buf_reserve_header(h_buff,30);

  databuf= (t_DataBuf*)h_buff;

	tid = 0x000000bb;
	version = 0x10;
	flags = 0x00;
	max_length = 0x2000;

	target = pMalloc(10);

	target[0] = 0x01;
	target[1] = 0x02;
	target[2] = 0x03;
	target[3] = 0x04;
	target[4] = 0x05;

	target_length = 0x0005;

	header_length = 0x0000;

	/*databuf = pMalloc(240);*/

	retValue = OBEX_Connect(tid,version,flags,max_length,target_length,target,header_length,databuf,callbackfunc);
  cuReport("Connect not working with target- basic",(retValue == BT_NOERROR));

	target = 0x00;
	target_length = 0;

	retValue = OBEX_Connect(tid,version,flags,max_length,target_length,target,header_length,databuf,callbackfunc);
  cuReport("Connect not working without target - basic",(retValue == BT_NOERROR));

}
Exemplo n.º 2
0
prh_t_hu_outcome UT_TP_RFC_BV_07_C(int p1, void *arg)
{
  int ret, dummy;
  void *conn_handle;
  t_bdaddr remote_dev;
  struct host_buf *pdu_buf;
  int pdu_type;
  int chan=TEST_REMOTE_CHAN;
  int ptype;
  prh_t_rfcomm_control_params ctrl_params;
  prh_t_hu_outcome outcome=HU_FAILED;

  u_int8 expected_answer[]={ 0x29, 0x53, 0x01, 0x0C };  
  u_int8 expected_length=4;

  ret=PE_SrvRegisterPort("/dev/ptyr5", &chan, UT_RFCOMM_test_connect_cb);

  if (ret==BT_NOERROR)
    {
      pMemcpy(remote_dev.bytes, "\x00\x01\x02\x03\x04\x05", 6);

      ret=prh_stub_l2cap_setup_l2_connection(remote_dev, RFCOMM_PSM, TEST_CID, &conn_handle);            
      if (ret==BT_NOERROR)
	{
	  rftest_sendsabm(conn_handle, 0, 1, 1);
	  rftest_dumppdu();
	  
	  rftest_sendsabm(conn_handle, 10, 1, 1);
	  rftest_takepdu(&pdu_buf, &pdu_type);
	  
	  do {
	    rftest_takepdu(&pdu_buf, &pdu_type);
	    
	    ptype=pdu_buf->data[1];
	    if (ptype==0xef) /* check is this a UIH frame */
	      {
		int type;
				
		if ((pdu_buf->data[3] & 0xFC) == PRH_RFCOMM_CC_TYPE_MSC)
		  {
		    pMemset(&ctrl_params, 0, sizeof(ctrl_params));
		    rftest_sendmsc(conn_handle, 10, 0, &ctrl_params);
		    PE_SrvDisconnectPort(5);
		  }
		L2_FreeWriteBuffer(pdu_buf);
	      }
	  } while(ptype!=0x53);
	  
	  
	  if (!(pMemcmp(pdu_buf->data, expected_answer, expected_length)))
	    test_outcome=1;
	  L2_FreeWriteBuffer(pdu_buf);
	}
      else
	test_outcome=0;
    }
  else
    test_outcome=0;
  cuReport("TP_RFC_BV_07_C failed\n", test_outcome==1);
  return;
}
Exemplo n.º 3
0
// Write your test routines like this:
void p(void){
cuReport("Test should work",(addint(4,3)==7));
cuReport("Test should fail",(addint(2,7)==9));
}