library/src/exploitation/Utilities/BP-Gadgets.cc
// returns a gadget argument type, allocated via tail queue allocator.
returns a gadget argument type, allocated via tail queue allocator.
returns a gadget argument type allocated via tail queue allocator .
char * BP_GetGadgetArgumentType(BP_GADGET_ARG_TYPE type, P_BP_LINKL tq)
{
	switch(type)
	{
		case BP_GADGET_ARG_TYPE_UNSET:
			return tq ? tq_strdup(tq, "BP_GADGET_ARG_TYPE_UNSET", BPLN) : bpstrdup("BP_GADGET_ARG_TYPE_UNSET");
			break;
		case BP_GADGET_ARG_TYPE_CHAR_STRING:
			return tq ? tq_strdup(tq, "BP_GADGET_ARG_TYPE_CHAR_STRING", BPLN) : bpstrdup("BP_GADGET_ARG_TYPE_CHAR_STRING");
			break;
		case BP_GADGET_ARG_TYPE_UCHAR_STRING:
			return tq ? tq_strdup(tq, "BP_GADGET_ARG_TYPE_UCHAR_STRING", BPLN) : bpstrdup("BP_GADGET_ARG_TYPE_UCHAR_STRING");
			break;
		case BP_GADGET_ARG_TYPE_UINT64:
			return tq ? tq_strdup(tq, "BP_GADGET_ARG_TYPE_UINT64", BPLN) : bpstrdup("BP_GADGET_ARG_TYPE_UINT64");
			break;
		case BP_GADGET_ARG_TYPE_UINT32:
			return tq ? tq_strdup(tq, "BP_GADGET_ARG_TYPE_UINT32", BPLN) : bpstrdup("BP_GADGET_ARG_TYPE_UINT32");
			break;
		case BP_GADGET_ARG_TYPE_UINT16:
			return tq ? tq_strdup(tq, "BP_GADGET_ARG_TYPE_UINT16", BPLN) : bpstrdup("BP_GADGET_ARG_TYPE_UINT16");
			break;
		case BP_GADGET_ARG_TYPE_UINT8:
			return tq ? tq_strdup(tq, "BP_GADGET_ARG_TYPE_UINT8", BPLN) : bpstrdup("BP_GADGET_ARG_TYPE_UINT8");
			break;
		case BP_GADGET_ARG_TYPE_INT32:
			return tq ? tq_strdup(tq, "BP_GADGET_ARG_TYPE_INT32", BPLN) : bpstrdup("BP_GADGET_ARG_TYPE_INT32");
			break;
		case BP_GADGET_ARG_TYPE_INT16:
			return tq ? tq_strdup(tq, "BP_GADGET_ARG_TYPE_INT16", BPLN) : bpstrdup("BP_GADGET_ARG_TYPE_INT16");
			break;
		case BP_GADGET_ARG_TYPE_INT8:
			return tq ? tq_strdup(tq, "BP_GADGET_ARG_TYPE_INT8", BPLN) : bpstrdup("BP_GADGET_ARG_TYPE_INT8");
			break;
		default:
			return NULL;
	}
	return NULL;
}
char * BP_GetGadgetArgumentType ( BP_GADGET_ARG_TYPE type , P_BP_LINKL tq ) { switch ( type ) { case BP_GADGET_ARG_TYPE_UNSET : return tq ? tq_strdup ( tq , " " , BPLN ) : bpstrdup ( " " ) ; break ; case BP_GADGET_ARG_TYPE_CHAR_STRING : return tq ? tq_strdup ( tq , " " , BPLN ) : bpstrdup ( " " ) ; break ; case BP_GADGET_ARG_TYPE_UCHAR_STRING : return tq ? tq_strdup ( tq , " " , BPLN ) : bpstrdup ( " " ) ; break ; case BP_GADGET_ARG_TYPE_UINT64 : return tq ? tq_strdup ( tq , " " , BPLN ) : bpstrdup ( " " ) ; break ; case BP_GADGET_ARG_TYPE_UINT32 : return tq ? tq_strdup ( tq , " " , BPLN ) : bpstrdup ( " " ) ; break ; case BP_GADGET_ARG_TYPE_UINT16 : return tq ? tq_strdup ( tq , " " , BPLN ) : bpstrdup ( " " ) ; break ; case BP_GADGET_ARG_TYPE_UINT8 : return tq ? tq_strdup ( tq , " " , BPLN ) : bpstrdup ( " " ) ; break ; case BP_GADGET_ARG_TYPE_INT32 : return tq ? tq_strdup ( tq , " " , BPLN ) : bpstrdup ( " " ) ; break ; case BP_GADGET_ARG_TYPE_INT16 : return tq ? tq_strdup ( tq , " " , BPLN ) : bpstrdup ( " " ) ; break ; case BP_GADGET_ARG_TYPE_INT8 : return tq ? tq_strdup ( tq , " " , BPLN ) : bpstrdup ( " " ) ; break ; default : return NULL ; } return NULL ; }
returns a gadget argument type, allocated via tail queue allocator.
returns a gadget argument type allocated via tail queue allocator .
// Switch based on the category value, fail if lookup fails // return null in the case of lookup failure